Submission #918069

#TimeUsernameProblemLanguageResultExecution timeMemory
918069Elvin_FritlEaster Eggs (info1cup17_eastereggs)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N=2e3+5, mod=1e9+7; int n; #include "grader.h" vector<int> d , g[N]; void dfs(int s,int p) { d.push_back(s); for(auto i: g[s]) { if(i == p) { continue; } dfs(i,s); } } int findEgg(int M , vector<pair<int , int>> &a) { n = M; for(int i=0;i<a.size();i++) { g[a[i].first].push_back(a[i].second); g[a[i].second].push_back(a[i].first); } dfs(1 , 1); int l = 1 , r = n , best = -1; while(l <= r) { int mid = (l + r)>>1; vector<int> q; for(int i=0;i<mid;i++) { q.push_back(d[i]); } if(query(q) == 1) { r = mid - 1; best = mid; } else { l = mid + 1; } } return best; }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >&)':
eastereggs.cpp:26: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]
   26 |     for(int i=0;i<a.size();i++) {
      |                 ~^~~~~~~~~
/usr/bin/ld: /tmp/ccsSGVgA.o: in function `main':
grader.cpp:(.text.startup+0x1e6): undefined reference to `findEgg(int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >)'
collect2: error: ld returned 1 exit status