Submission #293870

#TimeUsernameProblemLanguageResultExecution timeMemory
293870Trickster통행료 (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 <int> 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<int>)':
highway.cpp:16:12: error: request for member 'second' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)in))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   16 | #define ss second
      |            ^~~~~~
highway.cpp:50:18: note: in expansion of macro 'ss'
   50 |     return v[in].ss;
      |                  ^~