제출 #936017

#제출 시각아이디문제언어결과실행 시간메모리
936017peterandvoi게임 (IOI14_game)C++17
0 / 100
1 ms608 KiB
#include <bits/stdc++.h> using namespace std; #ifdef ngu #include "debug.h" #else #define debug(...) 42 #endif vector<vector<int>> cnt; vector<int> lab; int get(int u) { return lab[u] < 0 ? u : lab[u] = get(lab[u]); } int hasEdge(int u, int v) { u = get(u); v = get(v); if (cnt[u][v] > 1) { cnt[u][v]--; return 0; } if (lab[u] > lab[v]) { swap(u, v); } lab[u] += lab[v]; lab[v] = u; for (int i = 0; i < (int) lab.size(); ++i) { cnt[u][i] += cnt[v][i]; cnt[i][u] = cnt[u][i]; } return 1; } void initialize(int n) { cnt.resize(n, vector<int>(n)); lab.resize(n, -1); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { cnt[i][j] = i != j; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...