Submission #1164233


Source Code Expand

Copy
#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include <queue>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
const ll MOD = 1000000007;

ll N, C, K, temp, ans = 0;
vector<ll> T;
bool fir = true, go = false;

int main() {
	scanf("%lld%lld%lld", &N, &C, &K);
	REP(i, N) {
		scanf("%lld", &temp);
		T.push_back(temp);
	}
	sort(T.begin(), T.end());
	T.push_back(3000000007);
	ll count = 0;
	temp = T[0] + K;
	REP(i, N + 1) {
		count++;
		//    cout<<"Ti"<<T[i]<<":"<<temp<<endl;
		if (count > C || T[i] > temp) {
			//    cout<<"OK"<<endl;
			temp = T[i] + K;
			ans++;
			count = 1;
		}
		else  if (i == N) { /*ans++;*/ }



	}
	cout << ans;
	return 0;
}

Submission Info

Submission Time
Task A - Airport Bus
User eiya
Language C++14 (GCC 5.4.1)
Score 300
Code Size 904 Byte
Status
Exec Time 20 ms
Memory 1400 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld", &N, &C, &K);
                                   ^
./Main.cpp:23:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &temp);
                       ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt
All 300 / 300 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 1 ms 256 KB
in2.txt 20 ms 1400 KB
in3.txt 20 ms 1400 KB
in4.txt 19 ms 1400 KB
in5.txt 1 ms 256 KB
in6.txt 20 ms 1400 KB
in7.txt 17 ms 1400 KB
in8.txt 20 ms 1400 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB