Submission #263188

#TimeUsernameProblemLanguageResultExecution timeMemory
263188salmaHighway Tolls (IOI18_highway)C++14
Compilation error
0 ms0 KiB
#include "highway.h" #include<bits/stdc++.h> using namespace std; void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { int M = U.size(); std::vector<int> w(M); map<int,int>a; for (int i = 0; i < M; ++i) { w[i] = 0; } long long toll = ask(w); int cnt = toll/A; for(int i=0;i<N;i++){ if(cnt == 0)break; w[i]=1; if(toll != ask(w)){ a[V[i]]++; a[U[i]]++; cnt--; } w[i]=0; } map<int,int>::iterator it = m.begin(); int ans1=-1 , ans2=-1; for(;it!=m.end();it++){ if(it->secind == 1){ if(ans1==-1)ans1=it->first; else{ ans2 = it->first; break; } } } answer(ans1 , ans2); }

Compilation message (stderr)

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:26:33: error: 'm' was not declared in this scope
   26 |     map<int,int>::iterator it = m.begin();
      |                                 ^
highway.cpp:29:16: error: 'struct std::pair<const int, int>' has no member named 'secind'; did you mean 'second'?
   29 |         if(it->secind == 1){
      |                ^~~~~~
      |                second