제출 #595220

#제출 시각아이디문제언어결과실행 시간메모리
595220birthdaycake게임 (IOI14_game)C++17
0 / 100
25 ms47208 KiB
#include "game.h" #include<bits/stdc++.h> #define endl '\n' #define mod 1000000007 using namespace std; vector<int>adj[2000001]; int dsu[2000001],rnk[2000001]; set<pair<int,int>>d; int N; int Find(int x){ if(dsu[x] == x) return x; return dsu[x] = Find(dsu[x]); } void Unite(int a, int b){ a = Find(a); b = Find(b); if(rnk[a] < rnk[b]) swap(a,b); if(rnk[a] == rnk[b]) rnk[a]++; dsu[b] = a; } void initialize(int n) { N = n; for(int i = 0; i < n; i++) dsu[i] = i; } int hasEdge(int u, int v) { int set_a = Find(u), set_b = Find(v); if(set_a == set_b) return 0; vector<int>x,y; for(int i = 0; i < N; i++){ if(Find(i) == set_a) x.push_back(i); if(Find(i) == set_b) y.push_back(i); } for(int i = 0; i < x.size(); i++){ for(int j = 0; j < y.size(); j++){ if(!d.count({x[i],y[i]})) return 0; } } d.insert({u,v}); d.insert({v,u}); return 1; }

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

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