Submission #1460698


Source Code Expand

// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n,c,k,t[100111],ans;
int main()
{
	get3(n,c,k);
	for(int i=1;i<=n;i++)get1(t[i]);
	sort(t+1,t+n+1);
	int tot=0,mx=0;
	for(int i=1;i<=n;i++)
	{
		if(tot==c||mx<t[i])
		{
			mx=t[i]+k;
			tot=0;
			ans++;
		}
		tot++;
	}
	printendl(ans);
	return 0;
}

Submission Info

Submission Time
Task A - Addition
User OhWeOnFire
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1457 Byte
Status TLE
Exec Time 2103 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
TLE × 2
TLE × 16
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt TLE 2103 ms 640 KB
in10.txt TLE 2103 ms 640 KB
in11.txt TLE 2103 ms 256 KB
in12.txt TLE 2103 ms 256 KB
in2.txt TLE 2103 ms 640 KB
in3.txt TLE 2103 ms 640 KB
in4.txt TLE 2103 ms 640 KB
in5.txt TLE 2103 ms 640 KB
in6.txt TLE 2103 ms 640 KB
in7.txt TLE 2103 ms 640 KB
in8.txt TLE 2103 ms 640 KB
in9.txt TLE 2103 ms 640 KB
sample1.txt TLE 2103 ms 256 KB
sample2.txt TLE 2103 ms 256 KB