# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
960195 |
2024-04-09T20:54:04 Z |
vjudge1 |
Game (IOI14_game) |
C++17 |
|
1 ms |
600 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1500;
int n, root;
bitset<N> adj[N], edge[N];
void dfs(int x) {
if (x == root) return;
if (adj[x].count() == 1) {
if (root == -1) {
root = x;
return;
}
int y = 0;
while (!adj[x][y]) y++;
adj[x][y] = adj[y][x] = 0;
edge[x][y] = edge[y][x] = 1;
dfs(y);
}
}
void initialize(int nn) {
n = nn;
root = -1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) continue;
adj[i][j] = 1;
}
}
}
int hasEdge(int u, int v) {
if (edge[u][v]) return 1;
adj[u][v] = adj[v][u] = 0;
dfs(u);
dfs(v);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |