Submission #1365956
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
//#define FILE_IO
int N, L, T;
int p[100005], d[100005], f[100005], r[100005];
int main()
{
#ifdef FILE_IO
freopen("1.in", "r", stdin);
freopen("1.out", "w", stdout);
#endif
scanf("%d%d%d", &N, &L, &T);
for(int i = 0; i < N; i++)
{
scanf("%d%d", &p[i], &d[i]);
if(d[i] == 2) d[i] = -1;
}
int add = T % L;
for(int i = 0; i < N; i++)
{
if(d[i] == 1) f[i] = (p[i] + add) % L;
else f[i] = (p[i] - add + L) % L;
}
int id = 0;
for(int i = 1; i < N; i++)
if(d[i] != d[0])
{
double timp = 0.0;
int cnt = 0;
if(d[0] == 1)
{
timp = double(p[i] - p[0]) / 2.0;
if(timp > T) cnt = 0;
else cnt = 1 + (int)( ( (double)T - timp ) / ((double)L / 2.0) );
(id += cnt) %= N;
}
else
{
timp = double(p[0] + L - p[i]) / 2.0;
if(timp > T) cnt = 0;
else cnt = 1 + (int)( ( (double)T - timp ) / ((double)L / 2.0) );
(id += N - cnt) %= N;
}
}
for(int i = 0; i < N; i++)
r[(id + i) % N] = f[i];
for(int i = 0; i < N; i++)
printf("%d\n", r[i]);
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Ants on a Circle |
User |
bogdan10bos |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1435 Byte |
Status |
RE |
Exec Time |
101 ms |
Memory |
2816 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:17:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d", &N, &L, &T);
^
./Main.cpp:20:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &p[i], &d[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 700 |
Status |
|
|
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 |
18 ms |
1792 KB |
subtask_1_02.txt |
WA |
14 ms |
1408 KB |
subtask_1_03.txt |
WA |
28 ms |
2816 KB |
subtask_1_04.txt |
WA |
29 ms |
2688 KB |
subtask_1_05.txt |
RE |
101 ms |
384 KB |
subtask_1_06.txt |
WA |
7 ms |
768 KB |
subtask_1_07.txt |
WA |
26 ms |
2432 KB |
subtask_1_08.txt |
WA |
26 ms |
2432 KB |
subtask_1_09.txt |
WA |
17 ms |
1664 KB |
subtask_1_10.txt |
WA |
15 ms |
1408 KB |
subtask_1_11.txt |
AC |
5 ms |
640 KB |
subtask_1_12.txt |
AC |
24 ms |
2432 KB |
subtask_1_13.txt |
WA |
19 ms |
1920 KB |
subtask_1_14.txt |
WA |
18 ms |
1792 KB |
subtask_1_15.txt |
AC |
1 ms |
256 KB |
subtask_1_16.txt |
AC |
1 ms |
256 KB |