# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
864314 | 2023-10-22T11:34:01 Z | vjudge1 | Monster Game (JOI21_monster) | C++17 | 113 ms | 2340 KB |
#include <bits/stdc++.h> #include "monster.h" using namespace std; namespace { bool example_variable; } // namespace vector<int> Solve(int N) { vector<int> T(N); bool win[N + 10][N + 10]; int cnt[N + 10]; vector<int> g[N + 10]; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { win[i][j] = Query(i, j); win[j][i] = !win[i][j]; if (win[i][j]) { cnt[i]++; g[i].push_back(j); } else { cnt[j]++; g[j].push_back(i); } } } int zero; for (int i = 0; i < N; i++) { if (cnt[i] == 1) { zero = i; T[i] = 0; break; } } bool visited[N + 10]; memset(visited, 0, sizeof(visited)); visited[zero] = 1; queue<int> q; q.push(zero); int num = 1; while (q.size()) { int f = q.front(); q.pop(); for (auto x : g[f]) { if (visited[x]) continue; T[x] = num++; visited[x] = 1; q.push(x); } } // for (auto x : T) cout << x << " "; // cout << endl; return T; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 113 ms | 2340 KB | Wrong Answer [6] |
2 | Halted | 0 ms | 0 KB | - |