Submission #713824

#TimeUsernameProblemLanguageResultExecution timeMemory
713824LittleOrangeHighway Tolls (IOI18_highway)C++17
Compilation error
0 ms0 KiB
#include "highway.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
struct line{
    ll to,i;
};

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  int M = U.size();
  vector<vector<line>> con(N);
  for(ll i = 0;i<M;i++){
    con[U[i]].push_back({V[i],i});
    con[V[i]].push_back({U[i],i});
  }
  if (M == N-1){
    vector<int> w(M,0);
    ll total_dis = ask(w)/A;
    auto doask = [&](){
        return (ask(w)-total_dis*a)/(b-a);
    };
    if (N<=100){
        vector<int> ans;
        for(int i = 0;i<N;i++){
            for(line l : con[i]){
                w[l.i] = 1;
            }
            if (doask()==1) ans.push_back(i+1);
            for(line l : con[i]){
                w[l.i] = 0;
            }
        }
        answer(ans[0],ans[1]);
    }
  }
}

Compilation message (stderr)

highway.cpp: In lambda function:
highway.cpp:20:34: error: 'a' was not declared in this scope
   20 |         return (ask(w)-total_dis*a)/(b-a);
      |                                  ^
highway.cpp:20:38: error: 'b' was not declared in this scope
   20 |         return (ask(w)-total_dis*a)/(b-a);
      |                                      ^