Submission #918504

#TimeUsernameProblemLanguageResultExecution timeMemory
918504vjudge1Easter Eggs (info1cup17_eastereggs)C++17
100 / 100
12 ms1776 KiB
#include <bits/stdc++.h> #include "grader.h" #define ll long long #define pll pair<ll, ll> using namespace std; vector<ll>g[550], eggs; ll used[550]; void dfs(ll v) { eggs.push_back(v); used[v] = 1; for (auto u : g[v]){ if (used[u] == 0){ dfs(u); } } } int findEgg (int N, vector < pair < int, int > > bridges) { for (ll 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); ll l = 0, r = N - 1; while (l < r){ ll m = (l + r)/2; vector<int>f; for (ll i = 0; i<m+1; i++){ f.push_back(eggs[i]); } if (query(f)){ r = m; } else { l = m + 1; } } return eggs[l]; }

Compilation message (stderr)

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