Submission #1156749


Source Code Expand

#include<cstdio>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<fstream>

#define rep(i,a,N) for(int i=0+a;i<N;i++)
#define lint long long int
#define SIZE 100005
#define pb push_back
#define MP make_pair

using namespace std;

int main(){
	vector<int> v;
	lint n,c,k;
	cin>>n>>c>>k;
	lint l;
	rep(i,0,n){
		cin>>l;
		v.push_back(l);
	}
	sort(v.begin(),v.end());
	lint st,count=0;
	bool TF=true;
	st=v[0];
	lint i=0,ans=1;
	while(i<n){
		if(st<=v[i]&&st+k>=v[i]&&count<c){
			i++;
			count++;
		}
		else{
			st=v[i];
			ans++;
			i++;
			count=1;
		}
	}
	cout<<ans;
return 0;
}

Submission Info

Submission Time
Task A - Airport Bus
User Aslan168
Language C++14 (GCC 5.4.1)
Score 300
Code Size 755 Byte
Status AC
Exec Time 47 ms
Memory 892 KB

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 46 ms 892 KB
in3.txt AC 46 ms 892 KB
in4.txt AC 46 ms 892 KB
in5.txt AC 2 ms 256 KB
in6.txt AC 47 ms 892 KB
in7.txt AC 41 ms 892 KB
in8.txt AC 47 ms 892 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB