Submission #1092054

#TimeUsernameProblemLanguageResultExecution timeMemory
1092054codexistentGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int v, p[1005]; set<pair<int, int>> adj[1005]; set<pair<int, int>> edge[1005][1005]; int find(int x){ return (p[x] == x) ? x : (p[x] = find(p[x])); } void onion(int a, int b){ a = find(a), b = find(b); if(a == b) return; if(adj[a].size() < adj[b].size()) swap(a, b); for(auto i : adj[b]){ adj[a].insert(i); int x = find(i.first), y = find(i.second); if(x == b) swap(a, b); edge[min(a, y)][max(a, y)].insert(i); edge[min(b, y)][max(b, y)].erase(i); } adj[b].clear(i); p[a] = p[b] = a; } void initialize(int n) { v = n; FOR(i, 0, n - 1) p[i] = i; FOR(i, 0, n - 1){ FOR(j, i + 1, n - 1){ adj[i].insert(make_pair(i, j)); adj[j].insert(make_pair(i, j)); edge[i][j].insert(make_pair(i, j)); } } } int hasEdge(int u, int v) { pair<int, int> e = make_pair(min(u, v), max(u, v)); u = find(u), v = find(v); if(u == v) return 1; adj[u].erase(e); adj[v].erase(e); edge[min(u, v)][max(u, v)].erase(e); if(edge[min(u, v)][max(u, v)].size() == 0){ onion(u, v); return 1; } return 0; }

Compilation message (stderr)

game.cpp: In function 'void onion(int, int)':
game.cpp:27:18: error: 'i' was not declared in this scope
   27 |     adj[b].clear(i);
      |                  ^
game.cpp: In function 'void initialize(int)':
game.cpp:34:9: error: 'i' was not declared in this scope
   34 |     FOR(i, 0, n - 1) p[i] = i;
      |         ^
game.cpp:34:5: error: 'FOR' was not declared in this scope
   34 |     FOR(i, 0, n - 1) p[i] = i;
      |     ^~~