Submission #1385291
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n,c,k;
ll a[100005];
int main() {
slld(n);slld(c);slld(k);
for(int i=1;i<=n;i++)
slld(a[i]);
sort(a+1,a+n+1);
ll ans=1,cur=1;
for(int i=2;i<=n;i++)
{
if(i-cur+1>c||a[i]>a[cur]+k)
{
ans++;
cur=i;
}
}
plld(ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Airport Bus |
User |
spj_29 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
917 Byte |
Status |
AC |
Exec Time |
19 ms |
Memory |
1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:27:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
slld(n);slld(c);slld(k);
^
./Main.cpp:27:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
slld(n);slld(c);slld(k);
^
./Main.cpp:27:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
slld(n);slld(c);slld(k);
^
./Main.cpp:29:11: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
slld(a[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 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 |
AC |
1 ms |
256 KB |
in2.txt |
AC |
19 ms |
1024 KB |
in3.txt |
AC |
19 ms |
1024 KB |
in4.txt |
AC |
19 ms |
1024 KB |
in5.txt |
AC |
1 ms |
256 KB |
in6.txt |
AC |
19 ms |
1024 KB |
in7.txt |
AC |
17 ms |
896 KB |
in8.txt |
AC |
19 ms |
1024 KB |
sample1.txt |
AC |
1 ms |
256 KB |
sample2.txt |
AC |
1 ms |
256 KB |