제출 #516652

#제출 시각아이디문제언어결과실행 시간메모리
516652lucriEaster Eggs (info1cup17_eastereggs)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <set> using namespace std; vector<int>v; vector<pair<int,int>>l; bool ok[520]; void constructie(int poz,int n) { int nr=0; while(++nr<=n) { ok[poz]=true; v.push_back(poz); if(ok[l[poz].first]==true) poz=l[poz].second; else poz=l[poz].first; } return; } /*int query(vector < int > islands) { return 1; }*/ int findEgg(int N, vector < pair < int, int > > bridges) { int nra[520]={0}; l.resize(N+5); for(int i=1;i<=N;++i) ok[i]=false; for(auto x:bridges) { ++nra[x.first]; ++nra[x.second]; if(l[nra[x.first]].first==0) l[nra[x.first]].first=x.second; else l[nra[x.first]].second=x.second; if(l[nra[x.second]].first==0) l[nra[x.second]].first=x.first; else l[nra[x.second]].second=x.first; } for(int i=1;i<=N;++i) { if(nra[i]==0) constructie(i,N); break; } int b=0,e=N-1; while(b<=e) { int m=(b+e)/2; vector<int>q; for(int x=b;x<=e;++x) q.push_back(v[x]); int val=query(q); q.clear(); if(val==1) e=m-1; else b=m+1; } v.clear(); l.clear(); return b; }

컴파일 시 표준 에러 (stderr) 메시지

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:58:17: error: 'query' was not declared in this scope
   58 |         int val=query(q);
      |                 ^~~~~