Submission #1156771
Source Code Expand
#include<cstdio>
#include<vector>
#include<algorithm>
//#include<numeric>
#include<functional>
//#include<deque>
//#include<string>
//#include<iostream>
using namespace std;
const int one = 1;
const int big = (one<<30);
typedef long long int llint;
//11:10~13:00
int main(void){
int N,C,K,a,i,ans=0,minwait=0,waitN=0;//C人までの人、Kまでの時間,ans=答え,
//minwait=待ってる人の中で一番早い人,waitN=人数
vector<int> T;
scanf("%d %d %d",&N,&C,&K);
for(i=0;i<N;i++){
scanf("%d",&a);
T.push_back(a);
}
sort(T.begin(),T.end());//Tをソート
minwait=T[0];
for(i=0;i<N;i++){
if(minwait+K<T[i]||waitN>=C){
ans++;
minwait=T[i];
waitN=1;
} else{
waitN++;
}
}
ans++;
printf("%d\n",ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Airport Bus |
User |
WA_TLE |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
791 Byte |
Status |
AC |
Exec Time |
19 ms |
Memory |
892 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:19:28: 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:21:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a);
^
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 |
19 ms |
892 KB |
in3.txt |
AC |
19 ms |
892 KB |
in4.txt |
AC |
19 ms |
892 KB |
in5.txt |
AC |
1 ms |
256 KB |
in6.txt |
AC |
19 ms |
892 KB |
in7.txt |
AC |
17 ms |
892 KB |
in8.txt |
AC |
19 ms |
892 KB |
sample1.txt |
AC |
1 ms |
256 KB |
sample2.txt |
AC |
1 ms |
256 KB |