Submission #1156433
Source Code Expand
#include <iostream> #include <sstream> #include <vector> #include <cmath> #include <ctime> #include <cassert> #include <iomanip> #include <cstdio> #include <float.h> #include <queue> #include <set> #include <map> #include <fstream> #include <cstdlib> #include <string> #include <cstring> #include <algorithm> #include <numeric> #include <stack> #include <functional> using namespace std; #define endl '\n' #define MOD 1000000007 #define INF 1ll<<30 // #define MAX 100010 #define eps 1e-11 #define bit_max 1ll<<32 #define _USE_MATH_DEFINES long long binpow(long long a,long long b) { if (b == 1) return a; long long res = binpow(a, b/2)%MOD; if (b % 2) return (res*((res*a)%MOD))%MOD; else return (res * res)%MOD; } long long int fact(long long int a) { if(a==0||a==1) return 1; long long int ans = 1; for(int i=a;i>=1;i--) ans = (ans * i)% MOD; return ans; } long long int ivmod(long long int a) { return binpow(a,MOD-2); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // #ifndef ONLINE_JUDGE // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); // #endif int n,c,k; cin>>n>>c>>k; int t[n]; for(int i=0;i<n;i++) { cin>>t[i]; } sort(t,t+n); int count = 0; int ans = 0; for(int i=0;i<n;i++) { int j =i; int temp = 0; while(t[i]+k<=t[j]&&temp<c) { j++; temp++; if(j==n) break; } ans++; i = j+1; } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | Axelius |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1751 Byte |
Status | WA |
Exec Time | 17 ms |
Memory | 640 KB |
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 | WA | 1 ms | 256 KB |
in2.txt | WA | 17 ms | 640 KB |
in3.txt | WA | 17 ms | 640 KB |
in4.txt | WA | 17 ms | 640 KB |
in5.txt | WA | 1 ms | 256 KB |
in6.txt | WA | 17 ms | 640 KB |
in7.txt | WA | 15 ms | 640 KB |
in8.txt | WA | 17 ms | 640 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |