Submission #1483390
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { #ifdef HOME freopen("in", "r", stdin); #endif int n, l, t; bool first = 1; while (scanf("%d%d%d", &n, &l, &t) == 3) { if (first) first = 0; else printf("\n"); vector<int> x(n), w(n); for (int i = 0; i < n; i++) { scanf("%d%d", &x[i], &w[i]); if (w[i] == 2) w[i] = -1; } int who = 0; for (int i = 1; i < n; i++) { if (w[i] != w[0]) { int full = t / l; who = (who + 2 * full * w[0] % n + n) % n; int dist = w[0] == 1 ? x[i] - x[0] : x[0] - x[i]; if (dist < 0) dist += l; if (dist <= t % l * 2) who = (who + w[0] + n) % n; if (t % l * 2 >= dist + l) who = (who + w[0] + n) % n; } } for (int i = 0; i < n; i++) { x[i] = (x[i] + w[i] * t % l + l) % l; } int pos = x[0]; sort(x.begin(), x.end()); int id = lower_bound(x.begin(), x.end(), pos) - x.begin(); if (id + 1 < n && x[id + 1] == pos && w[0] == 1) pos++; vector<int> ans(n); for (int i = 0; i < n; i++) ans[(who + i) % n] = x[(id + i) % n]; for (int i = 0; i < n; i++) printf("%d\n", ans[i]); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Ants on a Circle |
User | izban |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1414 Byte |
Status | WA |
Exec Time | 35 ms |
Memory | 2304 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &x[i], &w[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 | AC | 21 ms | 1536 KB |
subtask_1_02.txt | AC | 17 ms | 1152 KB |
subtask_1_03.txt | AC | 34 ms | 2304 KB |
subtask_1_04.txt | AC | 35 ms | 2304 KB |
subtask_1_05.txt | AC | 6 ms | 512 KB |
subtask_1_06.txt | AC | 8 ms | 640 KB |
subtask_1_07.txt | WA | 31 ms | 2048 KB |
subtask_1_08.txt | AC | 31 ms | 2048 KB |
subtask_1_09.txt | AC | 21 ms | 1408 KB |
subtask_1_10.txt | AC | 18 ms | 1280 KB |
subtask_1_11.txt | AC | 5 ms | 512 KB |
subtask_1_12.txt | AC | 27 ms | 2176 KB |
subtask_1_13.txt | AC | 21 ms | 1664 KB |
subtask_1_14.txt | AC | 19 ms | 1536 KB |
subtask_1_15.txt | AC | 1 ms | 256 KB |
subtask_1_16.txt | AC | 1 ms | 256 KB |