Submission #123453

#TimeUsernameProblemLanguageResultExecution timeMemory
123453ekremGame (IOI14_game)C++98
15 / 100
3 ms504 KiB
#include <bits/stdc++.h> #include "game.h" #define st first #define nd second #define mp make_pair #define pb push_back #define mod 1000000007 #define N 1505 using namespace std; typedef long long ll; int n, ata[N], sz[N], deg[N], of[N][N]; int atabul(int x){return ata[x] = (ata[x] == x)?x:atabul(ata[x]);} void merge(int x, int y){ int xx = atabul(x); int yy = atabul(y); if(xx != yy){ ata[xx] = yy; sz[yy] += sz[xx]; if(sz[yy] == n){ cout << "OF MKAKAKKKF" << endl; } } } void initialize(int nn){ n = nn; for(int i = 1; i <= n; i++){ ata[i] = i; sz[i] = 1; } } int hasEdge(int u, int v){u++;v++; int xx = atabul(u); int yy = atabul(v); if(sz[xx] + sz[yy] == n){ of[u][v] = 1; of[v][u] = 1; return 0; } int say = 0; for(int i = 1; i <= n; i++) say += of[u][i]|of[v][i]; if(say >= n - 2){ merge(xx, yy); return 1; } of[u][v] = 1; of[v][u] = 1; return 0; } // int read_int() { // int x; // assert(scanf("%d", &x) == 1); // return x; // } // int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // int n, u, v; // n = read_int(); // initialize(n); // for (int i = 0; i < n * (n - 1) / 2; i++) { // u = read_int(); // v = read_int(); // printf("%d\n", hasEdge(u, v)); // } // for(int i = 1; i <= n; i++) // cout << i << " " << deg[i] << endl; // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...