Submission #1156243


Source Code Expand

#include <bits/stdc++.h>
#define ll long long
#define str string
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define ff fflush(stdout)
using namespace std;
ll tme[100005];
int main () { 
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	scanf("%lld %lld %lld", &a, &b, &c);
	for (i = 1; i <= a; i++) {
		scanf("%lld", &tme[i]);
	}
	stable_sort(tme + 1, tme + a + 1);
	d = tme[1]; e = 1; f = 0;
	for (i = 2; i <= a; i++) {
		if (tme[i] - d > c || e == b) {
			f++; e = 1; d = tme[i];
		} else {
			e++;
		}
	}
	printf("%lld\n", ++f);
	return 0;
}

Submission Info

Submission Time
Task A - Airport Bus
User danielykf
Language C++14 (GCC 5.4.1)
Score 300
Code Size 658 Byte
Status AC
Exec Time 20 ms
Memory 1408 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld", &a, &b, &c);
                                     ^
./Main.cpp:16:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &tme[i]);
                         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
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 20 ms 1408 KB
in3.txt AC 20 ms 1408 KB
in4.txt AC 20 ms 1408 KB
in5.txt AC 1 ms 256 KB
in6.txt AC 20 ms 1408 KB
in7.txt AC 18 ms 1280 KB
in8.txt AC 20 ms 1408 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB