Submission #875721

#TimeUsernameProblemLanguageResultExecution timeMemory
875721AiperiiiEaster Eggs (info1cup17_eastereggs)C++14
0 / 100
1 ms460 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; int findEgg (int N, vector < pair < int, int > > bridges) { vector <int> g[N+1]; for(int i=0;i<bridges.size();i++){ g[bridges[i].first].push_back(bridges[i].second); g[bridges[i].second].push_back(bridges[i].first); } vector <int> vec,vis(N+1); queue <int> q; queue <vector <int> > d; for(int i=1;i<=N;i++){ if(vis[i]==0){ q.push(i); while(!q.empty()){ int v=q.front(); q.pop(); vec.push_back(v); vis[v]=1; for(auto to : g[v]){ if(vis[to]==0){ q.push(to); break; } } } d.push(vec); vec.clear(); } } while(!d.empty()){ vector <int> v=d.front(); d.pop(); if(query(v)==1){ if(v.size()==1){ cout<<v[0]<<endl;exit(0); } else{ int x=(v.size()+1)/2; vector <int> s; while(s.size()<x){ s.push_back(v.back()); v.pop_back(); } d.push(v); d.push(s); } } } return 0; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:7:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i=0;i<bridges.size();i++){
      |                 ~^~~~~~~~~~~~~~~
eastereggs.cpp:44:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |                 while(s.size()<x){
      |                       ~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...