제출 #280423

#제출 시각아이디문제언어결과실행 시간메모리
280423salma통행료 (IOI18_highway)C++14
컴파일 에러
0 ms0 KiB
#include "highway.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; vector<int>ans; vector<int>w; ll toll , dp; void solve(int lo , int hi){ if(lo == hi){ w[lo] = 1; if(ask(w) > toll) ans.push_back(lo); w[i] = 0; return; } int md = (lo+hi)/2; int ok = 0; for(int i = lo ; i<=md ; i++) w[i] = 1; if(ask(w) > toll) ok = 1; for(int i = lo ; i<=md ; i++) w[i] = 0; if(ok) solve(lo , md); ok = 0; for(int i = md+1 ; i<=hi ; i++) w[i] = 1; if(ask(w) > toll) ok = 1; for(int i = md+1 ; i<=hi ; i++) w[i] = 0; if(ok) solve(md+1 , hi); return ; } void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { int M = U.size(); for (int i = 0; i < M; ++i) { w.push_back(0); } toll = ask(w); dp = toll / A; solve(0,M-1); map<int,int>m; for(int i=0;i<dp;i++){ m[U[ans[i]]]++; m[V[ans[i]]]++; } map<int,int>::iterator it = m.begin(); int S=-1,T=-1; for(; it!=m.end();it++){ if(it->second == 1){ if(S == -1)S=it->first; else{ T = it->first; break; } } } answer(S, T); }

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

highway.cpp: In function 'void solve(int, int)':
highway.cpp:17:11: error: 'i' was not declared in this scope; did you mean 'hi'?
   17 |         w[i] = 0;
      |           ^
      |           hi