제출 #986450

#제출 시각아이디문제언어결과실행 시간메모리
986450Rifal게임 (IOI14_game)C++14
15 / 100
1 ms4444 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; const int N = 1500 + 5; int cnt[N][N], ran[N], p[N], siz[N]; bool ok[N]; int nn; int fin(int a) { if(p[a] == a) return a; else return p[a] = fin(p[a]); } void mer(int a, int b) { if(ran[a] < ran[b]) swap(a,b); if(ran[a] == ran[b]) ran[a]++; p[b] = a; } void initialize(int n) { int nn = n; for(int i = 0; i < n; i++) { p[i] = i; siz[i] = 1; } } int hasEdge(int u, int v) { u = fin(u); v = fin(v); cnt[u][v]++; cnt[v][u]++; for(int i = 0; i < nn; i++) ok[i] = 0; if(siz[u]*siz[v] == cnt[u][v]) { mer(u,v); int x = fin(u); siz[x] = siz[u]+siz[v]; for(int i = 0; i < nn; i++) { int y = fin(i); if(ok[y] == 1) continue; ok[y] = 1; cnt[x][y] = cnt[u][y] + cnt[v][y]; cnt[y][x] = cnt[x][y]; } return 1; } else { return 0; } }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'void initialize(int)':
game.cpp:18:9: warning: unused variable 'nn' [-Wunused-variable]
   18 |     int nn = n;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...