Submission #263183

#TimeUsernameProblemLanguageResultExecution timeMemory
263183NicolaAbusaad2014Highway Tolls (IOI18_highway)C++14
Compilation error
0 ms0 KiB
#include "highway.h" #include <bits/stdc++.h> using namespace std; map<long,long>m; vector<long long>v; void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { int M = U.size(); for (int i = 0; i < M; ++i) { w[i] = 0; } long long mn=ask(w); for (int j = 0; j < M; ++j) { std::vector<int> w(M); for (int i = 0; i < M; ++i) { w[i] = 0; if(i==j){ w[i]=1; } } long long toll = ask(w); if(toll>mn){ v.push_back(U[j]); v.push_back(V[j]); m[V[j]]++; m[U[j]]++; } } vector<int>ans; for(long i=0;i<v.size();i++){ if(m[v[i]]==1){ ans.push_back(v[i]); } answer(ans[0], ans[1]); }

Compilation message (stderr)

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:9:7: error: 'w' was not declared in this scope
    9 |       w[i] = 0;
      |       ^
highway.cpp:11:22: error: 'w' was not declared in this scope
   11 |     long long mn=ask(w);
      |                      ^
highway.cpp:29:17: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   for(long i=0;i<v.size();i++){
      |                ~^~~~~~~~~
highway.cpp:34:1: error: expected '}' at end of input
   34 | }
      | ^
highway.cpp:6:77: note: to match this '{'
    6 | void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
      |                                                                             ^