제출 #123470

#제출 시각아이디문제언어결과실행 시간메모리
123470ekrem게임 (IOI14_game)C++98
100 / 100
485 ms25236 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], vis[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]; for(int i = 1; i <= n; i++){ of[yy][i] += of[xx][i]; of[i][yy] += of[xx][i]; } // 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); of[xx][yy]++; of[yy][xx]++; if(of[xx][yy] == sz[xx]*sz[yy]){ of[xx][yy]--; of[yy][xx]--; merge(xx, yy); return 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...