Submission #1513592
Source Code Expand
#include <cstdio>
#include <algorithm>
using namespace std;
struct state { int id, r, x; };
bool operator<(const state& s1, const state& s2) { return s1.x < s2.x; };
int N, L, T, x, w; state s[100009], t[100009];
int main() {
scanf("%d %d %d", &N, &L, &T);
for (int i = 0; i < N; i++) {
scanf("%d %d", &x, &w);
for (int j = 0; j < 3; j++) {
s[i + j * N] = state{ i, j, x - (w == 1 ? -1 : 1) * (j - 1) * L };
t[i + j * N] = state{ i, j, x - (w == 1 ? -1 : 1) * ((j - 1) * L + T % L) };
}
}
sort(s, s + 3 * N);
sort(t, t + 3 * N);
int r = (1LL * s[N].id * (T / L)) % N;
for (int i = 0; i < N; i++) printf("%d\n", (1LL * t[(r + i) % N + N].x + L) % L);
return 0;
}
Submission Info
Submission Time
2017-08-14 22:37:32+0900
Task
C - Ants on a Circle
User
square1001
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
701 Byte
Status
RE
Exec Time
97 ms
Memory
1920 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:19:81: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
for (int i = 0; i < N; i++) printf("%d\n", (1LL * t[(r + i) % N + N].x + L) % L);
^
./Main.cpp:8:31: 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:10:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &x, &w);
^
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
128 KB
sample_02.txt
AC
1 ms
128 KB
subtask_1_01.txt
RE
96 ms
128 KB
subtask_1_02.txt
WA
1 ms
256 KB
subtask_1_03.txt
RE
96 ms
128 KB
subtask_1_04.txt
RE
96 ms
128 KB
subtask_1_05.txt
WA
9 ms
1408 KB
subtask_1_06.txt
WA
12 ms
1920 KB
subtask_1_07.txt
RE
96 ms
128 KB
subtask_1_08.txt
RE
97 ms
128 KB
subtask_1_09.txt
RE
97 ms
128 KB
subtask_1_10.txt
RE
97 ms
128 KB
subtask_1_11.txt
AC
6 ms
1280 KB
subtask_1_12.txt
RE
96 ms
128 KB
subtask_1_13.txt
RE
96 ms
128 KB
subtask_1_14.txt
RE
97 ms
128 KB
subtask_1_15.txt
AC
1 ms
128 KB
subtask_1_16.txt
AC
1 ms
128 KB