Submission #1868388
Source Code Expand
#include <cstdio>
#include <algorithm>
using namespace std;
int n, c, k, ans, x, a[100005];
int main() {
int i;
scanf("%d%d%d", &n, &c, &k);
for(i=1; i<=n; i++) scanf("%d", &a[i]);
sort(a, a+n+1);
for(i=1; i<=n; i++) {
if(x==0 || a[i]-a[i-1]>k) ans++, x=c;
x--;
}
printf("%d", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Airport Bus |
User |
t1234 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
321 Byte |
Status |
WA |
Exec Time |
18 ms |
Memory |
512 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:7:29: 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:8:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(i=1; i<=n; i++) scanf("%d", &a[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 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 |
WA |
18 ms |
512 KB |
in4.txt |
AC |
18 ms |
512 KB |
in5.txt |
WA |
1 ms |
128 KB |
in6.txt |
WA |
18 ms |
512 KB |
in7.txt |
WA |
16 ms |
512 KB |
in8.txt |
WA |
18 ms |
512 KB |
sample1.txt |
AC |
1 ms |
128 KB |
sample2.txt |
AC |
1 ms |
128 KB |