Submission #1358395
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i) template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;} template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;} int nextInt() { int x; scanf("%d", &x); return x; } int T[100000 + 10]; int main2() { int N = nextInt(); int C = nextInt(); int K = nextInt(); REP(i, N) T[i] = nextInt(); int ans = 0; int c = 0; int limit = -1; REP(i, N) { int t = T[i]; if (limit < t || c == C) { ans++; c = 0; limit = t + K; } c++; } if (c >= 2) ans++; cout << ans << endl; return 0; } int main() { for (;!cin.eof();cin>>ws) main2(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Airport Bus |
User | hs484 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 790 Byte |
Status | WA |
Exec Time | 13 ms |
Memory | 640 KB |
Compile Error
./Main.cpp: In function ‘int nextInt()’: ./Main.cpp:10:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int x; scanf("%d", &x); return x; ^
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 | 13 ms | 640 KB |
in3.txt | WA | 13 ms | 640 KB |
in4.txt | AC | 13 ms | 640 KB |
in5.txt | WA | 1 ms | 256 KB |
in6.txt | WA | 12 ms | 640 KB |
in7.txt | WA | 11 ms | 640 KB |
in8.txt | WA | 12 ms | 640 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |