제출 #595236

#제출 시각아이디문제언어결과실행 시간메모리
595236birthdaycake게임 (IOI14_game)C++17
42 / 100
1057 ms61524 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 = 1; i <= n; i++) dsu[i] = i; } int hasEdge(int u, int v) { u++; v++; int set_a = Find(u), set_b = Find(v); d.insert({u,v}); d.insert({v,u}); if(set_a == set_b) return 0; vector<int>x,y; for(int i = 1; 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[j]})) return 0; } } Unite(u,v); return 1; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:40:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int i = 0; i < x.size(); i++){
      |                    ~~^~~~~~~~~~
game.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         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...