# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066754 | 2024-08-20T06:17:44 Z | sleepntsheep | Alternating Current (BOI18_alternating) | C++17 | 25 ms | 1620 KB |
#include <stdio.h> #include <algorithm> #include <vector> #include <utility> using namespace std; using iii = pair<pair<int, int>, int>; int n, m; char ans[1<<18]; iii a[1<<18]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; ++i) scanf("%d%d", &a[i].first.first, &a[i].first.second), a[i].second = i; sort(a, a + m); int e1 = 0, e2 = 0; for (int j = 0, i = 1; i <= n; ++i) { while (j < m and a[j].first.first == i) { if (e1 <= e2) { e1 = max(e1, a[j].first.second); ans[a[j].second] = '1'; } else { e2 = max(e2, a[j].first.second); ans[a[j].second] = '0'; } ++j; } if (e1 + 1 < i or e2 + 1 < i) { puts("impossible"); return 0; } } puts(ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 348 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 348 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 348 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1620 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 7 ms | 1488 KB | no wires in direction 0 between segments 1 and 1 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 348 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |