Submission #293869

#TimeUsernameProblemLanguageResultExecution timeMemory
293869TricksterHighway Tolls (IOI18_highway)C++14
Compilation error
0 ms0 KiB
#include <algorithm> #include <highway.h> #include <string.h> #include <iostream> #include <stdio.h> #include <vector> #include <queue> #include <cmath> #include <set> #include <map> using namespace std; #define maxN 200010 #define ff first #define ss second #define ll long long #define pb push_back #define mod 1000000007 #define pii pair <ll, ll> // #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") ll bigmod(ll a,ll e) {if(e==0)return 1;ll x=bigmod(a*a%mod,e>>1);return e&1?x*a%mod:x;} int L[maxN]; int n, m, dis; vector <pii> E[maxN]; vector <int> T[maxN]; int tap(vector <pii> v) { int sz = v.size(); int l = 0, r = sz-1, md, in = 0; while(l <= r) { md = (l+r)/2; vector <int> arr; for(int i = 0; i < m; i++) arr.pb(0); for(int i = md; i < sz; i++) for(auto h: T[v[i]]) arr[h] = 1; int cur = ask(arr); if(dis != cur) l = md+1, in = md; else r = md-1; } return v[in].ss; } void find_pair(int N, vector <int> U, vector <int> V, int A, int B) { m = U.size(), n = N; for(int i = 0; i < m; i++) { E[U[i]].pb({V[i], i}); E[V[i]].pb({U[i], i}); } vector <int> arr; for(int i = 0; i < m; i++) arr.pb(0); dis = ask(arr); int l = 0, r = m-1, md, in = 0; while(l <= r) { md = (l+r)/2; vector <int> arr; for(int i = 0; i < m; i++) arr.pb((i <= md ? 1 : 0)); int cur = ask(arr); if(dis != cur) r = md-1, in = md; else l = md+1; } queue <pii> Q; vector <int> C, D; Q.push({U[in], 1}); Q.push({V[in], 2}); L[U[in]] = 1; L[V[in]] = 2; while(!Q.empty()) { int nd = Q.front().ff; int tp = Q.front().ss; Q.pop(); if(tp == 1) C.pb(nd); if(tp == 2) D.pb(nd); for(auto i: E[nd]) { int to = i.ff; if(L[to]) continue; L[to] = tp; Q.push({to, tp}); T[to].pb(i.ss); } } answer(tap(C), tap(D)); }

Compilation message (stderr)

highway.cpp: In function 'int tap(std::vector<std::pair<long long int, long long int> >)':
highway.cpp:42:26: error: no match for 'operator[]' (operand types are 'std::vector<int> [200010]' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'})
   42 |             for(auto h: T[v[i]])
      |                          ^
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:107:16: error: could not convert 'C' from 'vector<int>' to 'vector<std::pair<long long int, long long int>>'
  107 |     answer(tap(C), tap(D));
      |                ^
      |                |
      |                vector<int>
highway.cpp:107:24: error: could not convert 'D' from 'vector<int>' to 'vector<std::pair<long long int, long long int>>'
  107 |     answer(tap(C), tap(D));
      |                        ^
      |                        |
      |                        vector<int>