# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
522397 | 2022-02-04T19:40:01 Z | LucaDantas | Alternating Current (BOI18_alternating) | C++17 | 26 ms | 2744 KB |
// subtask não circular #include <bits/stdc++.h> using namespace std; using pii = pair<int,int>; vector<pair<pii, int>> wires; int main() { int n, m; scanf("%d %d", &n, &m); for(int i = 0, a, b; i < m; i++) scanf("%d %d", &a, &b), wires.push_back({{a, b}, i}); sort(wires.begin(), wires.end()); vector<int> ans(m); int a = 1, b = 1, cor = 0; for(int i = 0; i < m; i++) { if(a > b) swap(a, b), cor ^= 1; if(wires[i].first.first > a) return puts("impossible"), 0; a = wires[i].first.second + 1; ans[wires[i].second] = cor; } if(min(a, b) < m+1) return puts("impossible"), 0; for(int i = 0; i < m; i++) printf("%d", ans[i]); puts(""); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 292 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 292 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 292 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 2744 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 11 ms | 1828 KB | Output is correct |
4 | Incorrect | 14 ms | 1728 KB | 'impossible' claimed, but there is a solution |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 292 KB | 'impossible' claimed, but there is a solution |
4 | Halted | 0 ms | 0 KB | - |