제출 #429645

#제출 시각아이디문제언어결과실행 시간메모리
429645Amylopectin게임 (IOI14_game)C++14
100 / 100
535 ms19076 KiB
#include <iostream> #include <stdio.h> #include "game.h" //#include "grader.cpp" using namespace std; const int mxn = 2e3 + 10; int gr[mxn] = {},ctg[mxn][mxn] = {},ra[mxn] = {},n,mem[mxn] = {}; int figr(int l) { int cn = l,f; while(gr[cn] != cn) { cn = gr[cn]; } while(gr[l] != l) { f = gr[l]; gr[l] = cn; l = f; } return cn; } int mer(int l,int r) { int pl,pr,f,i,j; pl = figr(l); pr = figr(r); if(ra[pl] < ra[pr]) { f = pl; pl = pr; pr = f; } gr[pr] = pl; mem[pl] += mem[pr]; if(ra[pl] == ra[pr]) { ra[pl] ++; } for(i=0; i<n; i++) { ctg[pl][i] += ctg[pr][i]; ctg[i][pl] += ctg[i][pr]; } return 0; } void initialize(int nn) { int i,j; n = nn; for(i=0; i<n; i++) { mem[i] = 1; gr[i] = i; } } int hasEdge(int u, int v) { int i,j,pl = figr(u),pr = figr(v); if(pl == pr) { return 0; } ctg[pl][pr] ++; ctg[pr][pl] ++; if(ctg[pl][pr] == mem[pl] * mem[pr]) { mer(pl,pr); return 1; } return 0; } //int main() //{ // cout << "Hello world!" << endl; // return 0; //}

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

game.cpp: In function 'int mer(int, int)':
game.cpp:25:19: warning: unused variable 'j' [-Wunused-variable]
   25 |     int pl,pr,f,i,j;
      |                   ^
game.cpp: In function 'void initialize(int)':
game.cpp:49:11: warning: unused variable 'j' [-Wunused-variable]
   49 |     int i,j;
      |           ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:60:9: warning: unused variable 'i' [-Wunused-variable]
   60 |     int i,j,pl = figr(u),pr = figr(v);
      |         ^
game.cpp:60:11: warning: unused variable 'j' [-Wunused-variable]
   60 |     int i,j,pl = figr(u),pr = figr(v);
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...