Submission #385693

#TimeUsernameProblemLanguageResultExecution timeMemory
385693IwanttobreakfreeEaster Eggs (info1cup17_eastereggs)C++17
0 / 100
2 ms492 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; int findEgg (int N, vector < pair < int, int > > bridges){ vector<int> lista(N); set<int> s; int cont=0; for(int i=0;i<N-1;i++){ if(s.find(bridges[i].first)==s.end()){ lista[s.size()]==bridges[i].first; s.insert(bridges[i].first); } if(s.find(bridges[i].second)==s.end()){ lista[s.size()]==bridges[i].second; s.insert(bridges[i].second); } } int l=0,r=N-1,sol; vector<int> v; while(l<=r){ v.clear(); int mid=(r-l)/2+l; for(int i=l;i<=mid;i++)v.push_back(lista[i]); if(query(v)){ sol=mid; r=mid-1; } else l=mid+1; } return sol; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:12:19: warning: value computed is not used [-Wunused-value]
   12 |    lista[s.size()]==bridges[i].first;
eastereggs.cpp:16:19: warning: value computed is not used [-Wunused-value]
   16 |    lista[s.size()]==bridges[i].second;
eastereggs.cpp:9:6: warning: unused variable 'cont' [-Wunused-variable]
    9 |  int cont=0;
      |      ^~~~
eastereggs.cpp:32:12: warning: 'sol' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |     return sol;
      |            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...