제출 #283235

#제출 시각아이디문제언어결과실행 시간메모리
283235abyyskit게임 (IOI14_game)C++14
100 / 100
675 ms19960 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; #define FOR(i, x, y) for(int i = x; i < y; ++i) #define pb push_back struct node{ bool vis = false; vector<int> e; int c; int par; int child; }; vector<node> g; int Find(int a){ if (g[a].par == a){ return g[a].par; } g[a].par = Find(g[a].par); return g[a].par; } void Onion(int a, int b){ int ap = Find(a); int bp = Find(b); if (g[ap].child < g[bp].child){ swap(ap, bp); } g[ap].child += g[bp].child; g[bp].par = ap; FOR(i, 0, g.size()){ g[ap].e[i] += g[bp].e[i]; g[i].e[ap] = g[ap].e[i]; } } void initialize(int n) { g.resize(n); FOR(i, 0, n){ g[i].e.resize(n, 1); g[i].c = n; g[i].par = i; g[i].child = 1; } } int hasEdge(int u, int v) { int up = Find(u); int vp = Find(v); if (up == vp){ return 0; } if (g[up].e[vp] != 1){ g[up].e[vp]--; g[vp].e[up]--; return 0; } else{ Onion(up, vp); return 1; } return 1; }

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

game.cpp: In function 'void Onion(int, int)':
game.cpp:4:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define FOR(i, x, y) for(int i = x; i < y; ++i)
......
   33 |  FOR(i, 0, g.size()){
      |      ~~~~~~~~~~~~~~                    
game.cpp:33:2: note: in expansion of macro 'FOR'
   33 |  FOR(i, 0, g.size()){
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...