Submission #918531

#TimeUsernameProblemLanguageResultExecution timeMemory
918531hasanovrEaster Eggs (info1cup17_eastereggs)C++14
100 / 100
12 ms1676 KiB
#include <bits/stdc++.h> #include "grader.h" #define ll long long #define ld long double #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define vpl vector<pair<ll,ll>> #define pii pair<int, int> #define pll pair<ll, ll> #define F first #define S second #define in insert #define mp make_pair #define vll vector<ll> #define vint vector<int> #define vs vector<string> #define vbl vector<bool> #define sll set<ll> #define ss set<string> #define mll map<ll, ll> #define msl multiset<ll> #define pque priority_queue #define all(v) v.begin(),v.end() #define rall(v) (v).rbegin(),(v).rend() #define np next_permutation #define sz(q) sizeof(q)/sizeof(q[0]) #define INF 0x3F3F3F3F #define MAX 1e10 #define LOG 17 #define lb lower_bound #define ub upper_bound #define mem(q, p) memset(q, p, sizeof(q)) #define maxel *max_element #define minel *min_element #define yes cout << "YES\n" #define no cout << "NO\n" const int MOD = 1e9 + 7; const int maxn = 5e5 + 5; const int logn = 19; const int sz = 2e5+5; const int width = 3; ///gcd & lcm ll gcd(ll q, ll p){ return p == 0 ? q : gcd(p, q%p); } ll lcm(ll q, ll p){ return q*p / gcd(q, p); } using namespace std; vll g[550], eggs; ll used[550]; void dfs(ll v){ eggs.pb(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].F].pb(bridges[i].S); g[bridges[i].S].pb(bridges[i].F); } dfs(1); ll l = 0, r = N - 1; while (l < r){ ll mid = (l + r)/2; vint f; for (ll i = 0; i<mid+1; i++) f.pb(eggs[i]); (query(f)) ? r = mid : l = mid+1; } return eggs[l]; }

Compilation message (stderr)

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