Submission #1156564
Source Code Expand
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
int N,C,K;
int T[100010];
int main(){
scanf("%d%d%d" , &N , &C , &K);
repp(i,0,N){
scanf("%d" , T + i);
}
sort(T,T+N);
int ans = 0;
int x = 0;
int y = 0;
repp(i,0,N){
if(x > 0 && T[i] > x){
++ans;
y = 0;
x = 0;
}
if(x == 0){
x = T[i] + K;
}
++y;
if(y == C){
++ans;
x = y = 0;
}
}
if(y > 0) ++ans;
printf("%d\n" , ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Airport Bus |
User |
PIandS |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1092 Byte |
Status |
AC |
Exec Time |
18 ms |
Memory |
512 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d" , &N , &C , &K);
^
./Main.cpp:30:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d" , T + i);
^
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 |
128 KB |
in2.txt |
AC |
18 ms |
512 KB |
in3.txt |
AC |
18 ms |
512 KB |
in4.txt |
AC |
18 ms |
512 KB |
in5.txt |
AC |
1 ms |
128 KB |
in6.txt |
AC |
18 ms |
512 KB |
in7.txt |
AC |
16 ms |
512 KB |
in8.txt |
AC |
18 ms |
512 KB |
sample1.txt |
AC |
1 ms |
128 KB |
sample2.txt |
AC |
1 ms |
128 KB |