Submission #2010090
Source Code Expand
#include <bits/stdc++.h> //#include <math.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define pb push_back #define pf push_front #define fi first #define se second #define BIT(x,n) bitset<n>(x) #define PI 3.14159265358979323846 typedef long long ll; typedef pair<int,int> P; typedef pair<int,P> PP; //----------------------------------------------------------------------------- int n; ll c,k,t[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin>>n>>c>>k; REP(i,n) cin>>t[i]; sort(t,t+n); ll cnt=1,ans=1,T=t[0]; FOR(i,1,n) { if(T+k>=t[i]) { if(cnt+1<=c) cnt++; else cnt=1,ans++,T=t[i]; } else { cnt=1,ans++,T=t[i]; } } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | moko_freedom |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 872 Byte |
Status | AC |
Exec Time | 17 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 1 ms | 256 KB |
in2.txt | AC | 17 ms | 1024 KB |
in3.txt | AC | 17 ms | 1024 KB |
in4.txt | AC | 17 ms | 1024 KB |
in5.txt | AC | 1 ms | 256 KB |
in6.txt | AC | 17 ms | 1024 KB |
in7.txt | AC | 15 ms | 896 KB |
in8.txt | AC | 17 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |