Submission #918354

#TimeUsernameProblemLanguageResultExecution timeMemory
918354Ferid20072020Easter Eggs (info1cup17_eastereggs)C++14
100 / 100
28 ms6188 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int up = 2e5 + 5; vector<int> g[up]; vector<int> List; void DFS(int node , int from){ List.push_back(node); for(auto to : g[node]){ if(to != from){ DFS(to , node); } } } int findEgg (int N, vector < pair < int, int > > bridges) { List.clear(); int i; for(i=0 ; i<up ; i++){ g[i].clear(); } for(i=0 ; i<bridges.size() ; i++){ g[bridges[i].first].push_back(bridges[i].second); g[bridges[i].second].push_back(bridges[i].first); } DFS(1 , 0); int l = 0 , r = N - 1 , mid; vector<int> c; while(l < r){ mid = (l + r) / 2; for(i=0 ; i<=mid ; i++){ c.push_back(List[i]); } if(query(c) == 1){ r = mid; } else{ l = mid + 1; } c.clear(); } return List[l]; }

Compilation message (stderr)

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