Submission #263183

# Submission time Handle Problem Language Result Execution time Memory
263183 2020-08-13T13:53:28 Z NicolaAbusaad2014 Highway Tolls (IOI18_highway) C++14
Compilation error
0 ms 0 KB
#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

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) {
      |                                                                             ^