Submission #1108304

#TimeUsernameProblemLanguageResultExecution timeMemory
1108304AriadnaGame (IOI14_game)C++14
0 / 100
2 ms512 KiB
#include <bits/stdc++.h> #define fi first #define se second using namespace std; int n; vector<int> cnt, adj, val; int aux = 0; void initialize(int N) { n = N; cnt = vector<int>(n, 0); adj = vector<int>(n); val = vector<int>(n, -1); } int hasEdge(int u, int v) { if (val[u] == -1) { val[u] = aux; ++aux; } if (val[v] == -1) { val[v] = aux; ++aux; } if (cnt[val[u]]+cnt[val[v]] == 0) { ++cnt[val[u]]; ++cnt[val[v]]; adj[max(val[u], val[v])] = min(val[u], val[v]); return 1; } if (cnt[val[u]]+cnt[adj[val[u]]] == 2*(n-1)-1 || cnt[val[v]]+cnt[adj[val[v]]] == 2*(n-1)-1) { ++cnt[val[u]]; ++cnt[val[v]]; return 1; } ++cnt[val[u]]; ++cnt[val[v]]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...