Submission #263251

#TimeUsernameProblemLanguageResultExecution timeMemory
263251salma통행료 (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();

    vector<int> w(M);
    vector<pair<int,int> > adj[N+1];
    for(int i=0;i<M;i++){
        adj[V[i]].push_back({U[i] , i});
        adj[U[i]].push_back({V[i] , i});
    }
    for (int i = 0; i < M; ++i) {
        w[i] = 0;
    }
    long long toll = ask(w);
    int cnt = toll/A;
    int ans1 = 0;
    set<int>s;
    s.insert(0);
    for(int i=0;i<v[ans1].size();i++){
        if(cnt==0)break;
        if(s.count(v[ans1][i]))continue;
        w[v[ans1][i].second]=1;
        if(toll != ask(w)){
            ans1 = v[ans1][i];
            i=0; cnt--;
        }
        w[v[ans1][i].second] = 0;
    }

  answer(0 , ans1);
}

Compilation message (stderr)

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:22:19: error: 'v' was not declared in this scope
   22 |     for(int i=0;i<v[ans1].size();i++){
      |                   ^