Submission #3046018


Source Code Expand

#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
using namespace std;
using ll = long long;
typedef pair <int, int> pii;
int main()
{

	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	string s;
	//long long n, A[1000000000];
	int n, m, q;
	//int   y[100001], z[100001], x[10001] = {};
	//pii y[100001];
	//pair<int, float> pii[100001];
	ll A[100001];
	cin >> n;
	cin >> l;
	ll t;
	cin >> t;
	t %= l;
	for (a = 0; a < n; a++)
	{
		cin >> b;
		cin >> c;
		if (a == 0)
		{
			d = b;
			e = c;
		}
		if (e != c)
		{
			if (e == 2)
			{
				f -= (t * 2 + l - (b - d)) / l;
				f %= n;
				f += n;
				f %= n;
			}
			else
			{
				f += (t * 2 + l - (b - d)) / l;
				f %= n;
			}
		}

		if (c == 1)
		{
			//cout << (b+t)%l << endl;
			A[a] = (b + t) % l;
		}
		else
		{
			//cout << (b - t+l) % l << endl;
			A[a] = (b - t + l) % l;
			A[a] += l;
			A[a] %= l;
		}
		//cout << endl;
		//cout << f << endl;
	}
	for (a = 0; a < n; a++)
	{
		//cout << A[a] << endl;
	}
	//cout << endl;
	//cout << f << endl;
	if (e == 1)
	{


		d = (d + t) % l;
		sort(A, A + n);
		//f = 0;
		//cout << d << endl;
		//cout << lower_bound(A, A + n, d) - A << endl;
		g = lower_bound(A, A + n, d) - A;

		cout << endl;
		f = (g - f) % n;
		f += n;
		f %= n;
	}
	else
	{
		d = (d - t) % l;
		d += l;
		d %= l;
		sort(A, A + n);
		//f = 0;
		//cout << d << endl;
		//cout << lower_bound(A, A + n, d) - A << endl;
		g = lower_bound(A, A + n, d) - A;
		//cout << endl;
		f = (g - f) % n;
		f += n;
		f %= n;
		/*if (A[g] == A[g - 1])
		{

		}*/
	}
	for (a = 0; a < n; a++)
	{
		cout << A[f] << endl;
		f++;
		if (f == n)
		{
			f = 0;
		}
	}

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;


	return 0;
}

Submission Info

Submission Time
Task C - Ants on a Circle
User aguroshou
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2150 Byte
Status WA
Exec Time 216 ms
Memory 1920 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 2
AC × 10
WA × 10
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 256 KB
sample_02.txt AC 1 ms 256 KB
subtask_1_01.txt WA 130 ms 1280 KB
subtask_1_02.txt WA 110 ms 1024 KB
subtask_1_03.txt WA 212 ms 1920 KB
subtask_1_04.txt WA 216 ms 1920 KB
subtask_1_05.txt WA 34 ms 512 KB
subtask_1_06.txt WA 49 ms 512 KB
subtask_1_07.txt WA 204 ms 1664 KB
subtask_1_08.txt WA 202 ms 1664 KB
subtask_1_09.txt WA 134 ms 1152 KB
subtask_1_10.txt WA 115 ms 1024 KB
subtask_1_11.txt AC 29 ms 512 KB
subtask_1_12.txt AC 187 ms 1792 KB
subtask_1_13.txt AC 139 ms 1408 KB
subtask_1_14.txt AC 125 ms 1280 KB
subtask_1_15.txt AC 1 ms 256 KB
subtask_1_16.txt AC 1 ms 256 KB