Submission #2531667


Source Code Expand

#include<cstdio>
#include<algorithm>
const int N=1e5+5;
int a[N],n,l,t,x,w;
long long cnt=1;
using namespace std;
inline char tc(void)
{
	static char fl[100000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,100000,stdin),A==B)?EOF:*A++;
}
inline void read(int &x)
{
	x=0; char ch=tc();
	while (ch<'0'||ch>'9') ch=tc();
	while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=tc();
}
inline void write(int x)
{
	if (x/10) write(x/10);
	putchar(x%10+'0');
}
int main()
{
	//freopen("B.in","r",stdin); freopen("B.out","w",stdout);
	register int i;
	read(n); read(l); read(t);
	for (i=1;i<=n;++i)
	{
		read(x); read(w);
		if (w==1) a[i]=(x+t)%l,cnt+=(x+t)/l; else a[i]=(x-t%l+l)%l,cnt-=t%l>x?t/l+1:t/l;
	}
	cnt=(cnt%n+n-1)%n+1;
	sort(a+1,a+n+1);
	for (i=cnt;i<=n;++i)
	write(a[i]),putchar('\n');
	for (i=1;i<cnt;++i)
	write(a[i]),putchar('\n');
	return 0;
}

Submission Info

Submission Time
Task C - Ants on a Circle
User hl666
Language C++14 (GCC 5.4.1)
Score 700
Code Size 881 Byte
Status AC
Exec Time 18 ms
Memory 1536 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 2
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 128 KB
sample_02.txt AC 1 ms 128 KB
subtask_1_01.txt AC 11 ms 1024 KB
subtask_1_02.txt AC 8 ms 896 KB
subtask_1_03.txt AC 17 ms 1536 KB
subtask_1_04.txt AC 18 ms 1536 KB
subtask_1_05.txt AC 2 ms 384 KB
subtask_1_06.txt AC 3 ms 512 KB
subtask_1_07.txt AC 14 ms 1280 KB
subtask_1_08.txt AC 13 ms 1280 KB
subtask_1_09.txt AC 8 ms 896 KB
subtask_1_10.txt AC 7 ms 768 KB
subtask_1_11.txt AC 3 ms 384 KB
subtask_1_12.txt AC 15 ms 1408 KB
subtask_1_13.txt AC 10 ms 1152 KB
subtask_1_14.txt AC 9 ms 1024 KB
subtask_1_15.txt AC 1 ms 128 KB
subtask_1_16.txt AC 1 ms 128 KB