Submission #263185

#TimeUsernameProblemLanguageResultExecution timeMemory
263185NicolaAbusaad2014Highway 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(); vector<long long>w(M); 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:12:22: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   12 |     long long mn=ask(w);
      |                      ^
In file included from highway.cpp:1:
highway.h:7:39: note: in passing argument 1 of 'long long int ask(const std::vector<int>&)'
    7 | long long ask(const std::vector<int> &w);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^
highway.cpp:30: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]
   30 |   for(long i=0;i<v.size();i++){
      |                ~^~~~~~~~~
highway.cpp:35:1: error: expected '}' at end of input
   35 | }
      | ^
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) {
      |                                                                             ^