Submission #1156422
Source Code Expand
#include<bits/stdc++.h> using namespace std; int main() { long int n,c,k,i,cnt=1,pre,cur,b=0; cin>>n>>c>>k; long int arr[100005]; for(i=1;i<=n;i++) scanf("%ld",&arr[i]); sort(arr+1,arr+n+1); for(i=1;i<=n;i++) { cur=arr[i]; if(i!=1) { if(cur-pre>k) { cnt++; b=1; } else { b++; if(b>c) { b=1; cnt++; } } } else { b++; if(b>c) { b=1; cnt++; } } pre=cur; } cout<<cnt; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | vjudge19 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 822 Byte |
Status | WA |
Exec Time | 19 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:10:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%ld",&arr[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 | 256 KB |
in2.txt | AC | 19 ms | 1024 KB |
in3.txt | WA | 19 ms | 1024 KB |
in4.txt | AC | 19 ms | 1024 KB |
in5.txt | WA | 1 ms | 256 KB |
in6.txt | WA | 19 ms | 1024 KB |
in7.txt | WA | 17 ms | 896 KB |
in8.txt | WA | 19 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |