제출 #1068010

#제출 시각아이디문제언어결과실행 시간메모리
1068010Muhammad_Aneeq통행료 (IOI18_highway)C++17
컴파일 에러
0 ms0 KiB
#include <vector> #include <iostream> #include <map> using namespace std; int const MAXN=1e5; vector<int>w; long long dis=0; vector<int>d; void divi(int st,int en) { if (st==en) { d.push_back(st); return; } int mid=(st+en)/2; for (int i=st;i<=mid;i++) w[i]=1; long long g=ask(w); for (int i=st;i<=mid;i++) w[i]=0; if (g>dis) divi(st,mid); for (int i=mid+1;i<=en;i++) w[i]=1; g=ask(w); for (int i=mid+1;i<=en;i++) w[i]=0; if (g>dis) divi(mid+1,en); } void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { int m=U.size(); if (m==N-1) { for (int i=0;i<m;i++) w.push_back(0); dis=ask(w); divi(0,m-1); map<int,int>cnt; for (auto i:d) cnt[U[i]]++,cnt[V[i]]++; vector<int>ans; for (auto i:cnt) if (i.second==1) ans.push_back(i.first); answer(ans[0],ans[1]); } else answer(0,1); }

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

highway.cpp: In function 'void divi(int, int)':
highway.cpp:19:14: error: 'ask' was not declared in this scope
   19 |  long long g=ask(w);
      |              ^~~
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:39:7: error: 'ask' was not declared in this scope
   39 |   dis=ask(w);
      |       ^~~
highway.cpp:48:3: error: 'answer' was not declared in this scope
   48 |   answer(ans[0],ans[1]);
      |   ^~~~~~
highway.cpp:51:3: error: 'answer' was not declared in this scope
   51 |   answer(0,1);
      |   ^~~~~~