제출 #294570

#제출 시각아이디문제언어결과실행 시간메모리
294570Dovran통행료 (IOI18_highway)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "highway.h" #define N 200009 #define pii pair <int, int> #define ff first #define ss second #define sz size #define pb push_back #define ll long long using namespace std; int m, ln; vector<int>e[N]; vector<int>asd; map<int, int>c[N]; int tap(vector<int>v){ l=0, r=v.sz()-1; while(l<=r){ int md=(l+r)/2; for(int i=0; i<m; i++) asd[i]=0; for(int i=0; i<=md; i++) for(auto j:e[v[i]]) asd[c[v[i]][j]]=1; x=ask(asd); if(x!=ln) in=md, r=md-1; else l=md+1; } return v[in]; } void find_pair(int n, std::vector<int>u, std::vector<int>v, int a, int b){ m=u.size(); for(int i=0; i<m; i++){ e[u[i]].pb(v[i]); e[v[i]].pb(u[i]); c[v[i]][u[i]]=i; c[u[i]][v[i]]=i; asd.pb(0); } ln=ask(asd); int l=0, r=m-1; int x, in; while(r>=l){ int md=(l+r)/2; for(int i = 0; i < m; i++) asd[i] = 0; for(int i=0; i<=md; i++) asd[i]=1; x=ask(asd); if(x==ln) l=md+1; else in = md, r=md-1; } // answer(0, 0); // return; queue<pii> q; q.push({u[in], 1}); q.push({v[in], 2}); int vis[N]; vector<int> C, D; while(!q.empty()){ int nd=q.front().ff; int tp=q.front().ss; q.pop(); vis[nd]=tp; if(tp==1) C.pb(nd); else D.pb(nd); for(auto i:e[nd]) if(!vis[i]) vis[i]=tp, q.push({i, tp}); } answer(tap(C), tap(D)); }

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

highway.cpp: In function 'int tap(std::vector<int>)':
highway.cpp:19:2: error: 'l' was not declared in this scope
   19 |  l=0, r=v.sz()-1;
      |  ^
highway.cpp:19:7: error: 'r' was not declared in this scope
   19 |  l=0, r=v.sz()-1;
      |       ^
highway.cpp:26:3: error: 'x' was not declared in this scope
   26 |   x=ask(asd);
      |   ^
highway.cpp:28:4: error: 'in' was not declared in this scope; did you mean 'ln'?
   28 |    in=md, r=md-1;
      |    ^~
      |    ln
highway.cpp:32:11: error: 'in' was not declared in this scope; did you mean 'ln'?
   32 |  return v[in];
      |           ^~
      |           ln