Submission #713826

#TimeUsernameProblemLanguageResultExecution timeMemory
713826AstraytHighway Tolls (IOI18_highway)C++17
Compilation error
0 ms0 KiB
#include "highway.h" #include <bits/stdc++.h> using namespace std; void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { int M = U.size(), d = B - A; vector<int> w(M, 0), adj[N]; for(int i = 0; i < M; ++i){ adj[U[i]].pb(i); adj[V[i]].pb(i); } int S = -1, T = -1; long long toll = ask(w); for(int i = 0; i < N; ++i){ for(auto id:adj[i]){ w[i] = 1; } long long cur = ask(w); if(cur - toll == d && S == -1){ S = i; }else T = i; } answer(S, T); }

Compilation message (stderr)

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:9:13: error: 'class std::vector<int>' has no member named 'pb'
    9 |   adj[U[i]].pb(i);
      |             ^~
highway.cpp:10:13: error: 'class std::vector<int>' has no member named 'pb'
   10 |   adj[V[i]].pb(i);
      |             ^~
highway.cpp:15:12: warning: unused variable 'id' [-Wunused-variable]
   15 |   for(auto id:adj[i]){
      |            ^~