Submission #1777895
Source Code Expand
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 123456789
//0x3f3f3f3f
#define INFL 10000000000000000
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<int,pii> pdii;
long long int MOD = 1000000007;
ll ggcd(ll a,ll b){
if(b==0)return a;
if(a<b){
ll temp=a;
a=b;
b=temp;
}
ll x=a%b;
return ggcd(b,x);
}
int main(void){
int N;
ll C,K;
cin>> N>> C>> K;
vector<ll> t(N);
rep(i,N)cin>>t[i];
sort(t.begin(),t.end());
int ans=1;
int i=0;
ll now=t[0]+K;
int cnt=0;
while(i<N){
if(cnt==C||t[i]>now){
ans++;
cnt=0;
now=t[i]+K;
//cout<<t[i]<<endl;
}else{
i++;
cnt++;
}
}
cout<<ans<<endl;
}
Submission Info
Submission Time |
|
Task |
A - Airport Bus |
User |
Ktya_59 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1810 Byte |
Status |
AC |
Exec Time |
53 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 |
47 ms |
1024 KB |
in3.txt |
AC |
53 ms |
1024 KB |
in4.txt |
AC |
47 ms |
1024 KB |
in5.txt |
AC |
2 ms |
256 KB |
in6.txt |
AC |
47 ms |
1024 KB |
in7.txt |
AC |
41 ms |
896 KB |
in8.txt |
AC |
47 ms |
1024 KB |
sample1.txt |
AC |
1 ms |
256 KB |
sample2.txt |
AC |
1 ms |
256 KB |