Submission #1157019


Source Code Expand

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;
long long n, c, k;
long long num[MaxN + 5];
long long tot, cot, ans;
int main()
{
	scanf("%I64d%I64d%I64d", &n, &c, &k);
	for(int i = 1; i <= n; i++)scanf("%I64d", &num[i]);
	sort(num + 1, num + n + 1);
	ans = num[1] + k;
	tot = 1;
	cot = 1;
	for(int i = 2; i <= n; i++)
	{
		if(num[i] <= ans && tot < c){tot++;continue;}
		else
		{
			tot = 0;
			cot++;
			ans = num[i] + k;
		}
	}
	printf("%I64d\n", cot);
}

Submission Info

Submission Time
Task A - Airport Bus
User tanruidd
Language C++14 (GCC 5.4.1)
Score 0
Code Size 570 Byte
Status WA
Exec Time 62 ms
Memory 896 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:37: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
  scanf("%I64d%I64d%I64d", &n, &c, &k);
                                     ^
./Main.cpp:13:37: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
./Main.cpp:13:37: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long long int*’ [-Wformat=]
./Main.cpp:14:51: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
  for(int i = 1; i <= n; i++)scanf("%I64d", &num[i]);
                                                   ^
./Main.cpp:29:23: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
  printf("%I64d\n", cot);
                       ^
./Main.cpp:13:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_resu...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 9
WA × 3
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 128 KiB
in2.txt WA 61 ms 896 KiB
in3.txt AC 61 ms 896 KiB
in4.txt WA 61 ms 896 KiB
in5.txt AC 1 ms 128 KiB
in6.txt AC 61 ms 896 KiB
in7.txt WA 53 ms 896 KiB
in8.txt AC 62 ms 896 KiB
sample1.txt AC 0 ms 128 KiB
sample2.txt AC 1 ms 128 KiB