Submission #875786

#TimeUsernameProblemLanguageResultExecution timeMemory
875786AiperiiiEaster Eggs (info1cup17_eastereggs)C++14
100 / 100
11 ms1240 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector <int> g[513]; vector <int> tin; void dfs(int v,int p){ tin.push_back(v); for(auto to : g[v]){ if(to!=p)dfs(to,v); } } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i=1;i<=N;i++)g[i].clear(); tin.clear(); 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); } dfs(1,-1); int l=0,r=N-1; while(l<r){ int md=(l+r)/2; vector <int> check; for(int i=0;i<=md;i++)check.push_back(tin[i]); if(query(check))r=md; else l=md+1; } return tin[l]; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:16: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]
   16 |     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...