제출 #67733

#제출 시각아이디문제언어결과실행 시간메모리
67733tempytemptempEaster Eggs (info1cup17_eastereggs)C++14
10 / 100
3 ms704 KiB
#include <vector> #include <cassert> #include <algorithm> #include "grader.h" using namespace std; int findEgg(int N, vector < pair < int, int > > bridges); int query(vector < int > islands); int findEgg(int n, vector<pair<int,int>>bridges){ assert(n<=16); bool pos[n+1]; for(int i=1; i<=n; i++) pos[i]=1; for(int i=0; i<bridges.size(); i++){ if(!pos[bridges[i].first] && !pos[bridges[i].second]) continue; if(!pos[bridges[i].first]){ if(query({bridges[i].second})) return bridges[i].second; else{ pos[bridges[i].second]=0; continue; } } else if(!pos[bridges[i].second]){ if(query({bridges[i].first})) return bridges[i].first; else{ pos[bridges[i].first]=0; continue; } } if(query({bridges[i].first, bridges[i].second})){ if(query({bridges[i].first})) return bridges[i].first; else return bridges[i].second; } else{ pos[bridges[i].first]=pos[bridges[i].second]=0; } } return -1; }

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

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:14:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<bridges.size(); i++){
               ~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...