제출 #399053

#제출 시각아이디문제언어결과실행 시간메모리
399053Bill_00게임 (IOI14_game)C++14
0 / 100
1 ms332 KiB
#include "game.h" #include <bits/stdc++.h> #define pb push_back using namespace std; int a[1505][1505],p[1505],sz[1505]; bool flag[1505][1505]; vector<int>vec[1505]; int find(int node){ if(node==p[node]) return node; else return p[node]=find(p[node]); } void initialize(int n) { for(int i=1;i<=n;i++){ p[i]=i; sz[i]=1; } } int hasEdge(int u, int v) { u++; v++; u=find(u); v=find(v); if(a[u][v]+1==sz[u]*sz[v]){ if(sz[u]<sz[v]){ swap(u,v); } for(int y=0;y<vec[v].size();y++){ a[u][v]+=a[v][vec[v][y]]; a[v][u]+=a[vec[v][y]][v]; if(flag[u][vec[v][y]]==0){ vec[u].pb(vec[v][y]); flag[u][vec[v][y]]=1; } if(flag[vec[v][y]][u]==0){ vec[vec[v][y]].pb(u); flag[vec[v][y]][u]=1; } } sz[u]+=sz[v]; u=p[v]; cout << 1 << '\n'; } else{ if(flag[u][v]==0){ vec[u].pb(v); flag[u][v]=1; } if(flag[v][u]==0){ vec[v].pb(u); flag[v][u]=1; } a[u][v]++; a[v][u]++; cout << 0 << '\n'; } return 0; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |      for(int y=0;y<vec[v].size();y++){
      |                  ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...