Submission #2179986
Source Code Expand
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; #define M 100005 #define ll long long #define PI atan(1.0)*4 #define mst(x,v) memset(x,v,sizeof(x)) #define inf (int)1e9 typedef pair<int,int> P; ll a[M]; int main() { ll n,t,d,c,ans,anger; scanf("%lld %lld %lld",&n,&t,&d); for(int i=0;i<n;i++) scanf("%lld",&a[i]); sort(a,a+n); anger=a[0]+d; ans=1;c=1; for(int i=1;i<n;i++) { if(c<t && a[i]<=anger) { c++; } else { anger=a[i]+d; c=1; ans++; } // printf("anger:%2lld now car:%2lld now ple:%2lld\n",anger,ans,c); } printf("%lld\n",ans); }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | vjudge4 |
Language | C++14 (Clang 3.8.0) |
Score | 300 |
Code Size | 681 Byte |
Status | AC |
Exec Time | 19 ms |
Memory | 1152 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 | 7 ms | 1016 KB |
in2.txt | AC | 19 ms | 1152 KB |
in3.txt | AC | 19 ms | 1024 KB |
in4.txt | AC | 19 ms | 1024 KB |
in5.txt | AC | 1 ms | 256 KB |
in6.txt | AC | 19 ms | 1024 KB |
in7.txt | AC | 17 ms | 896 KB |
in8.txt | AC | 19 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |