# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896914 | oblantis | Game (IOI14_game) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const ll inf = 1e18 + 10000;
const int mod = 1e9+7;
const int maxn = 1500 + 12;
int p[maxn], cnt[maxn][maxn], n;
void initialize(int m) {
n = m;
for(int i = 0; i < n; i++){
p[i] = i;
for(int j = 0; j < n; j++){
cnt[i][j] = 1;
}
cnt[i][i] = 0;
}
}
int hasEdge(int u, int v) {
bool ok = 0;
int pu = p[u], pv = p[v];
if(cnt[pu][pv] == 1){
for(int i = 0; i < n; i++){
if(p[i] == pv || p[i] == pu){
p[i] = pu;
continue;
}
cnt[pu][i] += cnt[pv][i];
cnt[i][pu] += cnt[i][pv];
}
ok = 1;
}
cnt[pu][pv]--;
cnt[pv][pu]--;
return ok;
}
//void solve() {
//}
//int main() {
//ios_base::sync_with_stdio(0);
//cin.tie(0);
//int times = 1;
////cin >> times;
//for(int i = 1; i <= times; i++) {
//solve();
//}
//return 0;
}