Submission #143189

# Submission time Handle Problem Language Result Execution time Memory
143189 2019-08-13T10:11:17 Z neki Highway Tolls (IOI18_highway) C++14
Compilation error
0 ms 0 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  ll M=U.size(), st=0;
  vector<int> arr;arr.resize(M, 0);ll req=ask(arr);
  while(st!=M){
  	ll l=st, r=M;
    while(l<r){
    	ll mid=(l+r)/2;
        loop(i, st, M) arr[i]=(i<=mid);
        if(ask(arr)==req) l=mid+1;
        else r=mid;
    }
    arr[l]=0;st=l+1;
  }
  vector<int> temp(N, 0), ans;
  loop(i, 0, M) if(!arr[i]) temp[U[i]]++,temp[V[i]]++;
  loop(i, 0, N) if(temp[i]==1) ans.push_back(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:13:14: error: 'i' was not declared in this scope
         loop(i, st, M) arr[i]=(i<=mid);
              ^
highway.cpp:13:9: error: 'loop' was not declared in this scope
         loop(i, st, M) arr[i]=(i<=mid);
         ^~~~
highway.cpp:13:9: note: suggested alternative: 'logl'
         loop(i, st, M) arr[i]=(i<=mid);
         ^~~~
         logl
highway.cpp:20:8: error: 'i' was not declared in this scope
   loop(i, 0, M) if(!arr[i]) temp[U[i]]++,temp[V[i]]++;
        ^
highway.cpp:20:3: error: 'loop' was not declared in this scope
   loop(i, 0, M) if(!arr[i]) temp[U[i]]++,temp[V[i]]++;
   ^~~~
highway.cpp:20:3: note: suggested alternative: 'logl'
   loop(i, 0, M) if(!arr[i]) temp[U[i]]++,temp[V[i]]++;
   ^~~~
   logl