제출 #293432

#제출 시각아이디문제언어결과실행 시간메모리
293432Trickster통행료 (IOI18_highway)C++14
컴파일 에러
0 ms0 KiB
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define N 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 n, m;
int L[N];
vector <pii> Lv[N], E[N];

void dfs(int nd, int pr, int in)
{
    if(nd) {
        L[nd] = L[pr]+1;
        Lv[L[nd]].pb({nd, in});
    }

    for(auto i: E[nd]) {
        if(i.ff == pr) continue;

        dfs(i.ff, nd, i.ss);
    }
}

void find_pair(int N, vector <int> U, vector <int> V, int A, int B) 
{
    m = E.size();

    for(int i = 0; i < m; i++) {
        E[U[i]].pb({V[i], i});
        E[V[i]].pb({U[i], i});
    }

    dfs(0, -1, -1);

    vector <int> arr;
    for(int i = 0; i < m; i++) arr.pb(0);

    int ans = ask(arr) / A;

    for(auto i: Lv[ans]) {
        vector <int> arr;
        for(int h = 0; h < m; h++) arr.pb((i.ss != h ? 0 : 1));

        int cur = ask(arr);

        if(ans * A != cur) {
            answer(0, i.ff);
            return;
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

highway.cpp:13:11: error: expected ',' or '...' before numeric constant
   13 | #define N 200010
      |           ^~~~~~
highway.cpp:43:20: note: in expansion of macro 'N'
   43 | void find_pair(int N, vector <int> U, vector <int> V, int A, int B)
      |                    ^
highway.cpp: In function 'void find_pair(int)':
highway.cpp:45:11: error: request for member 'size' in 'E', which is of non-class type 'std::vector<std::pair<long long int, long long int> > [200010]'
   45 |     m = E.size();
      |           ^~~~
highway.cpp:48:11: error: 'U' was not declared in this scope
   48 |         E[U[i]].pb({V[i], i});
      |           ^
highway.cpp:48:21: error: 'V' was not declared in this scope
   48 |         E[U[i]].pb({V[i], i});
      |                     ^
highway.cpp:57:15: error: 'ask' was not declared in this scope
   57 |     int ans = ask(arr) / A;
      |               ^~~
highway.cpp:57:26: error: 'A' was not declared in this scope
   57 |     int ans = ask(arr) / A;
      |                          ^
highway.cpp:66:13: error: 'answer' was not declared in this scope
   66 |             answer(0, i.ff);
      |             ^~~~~~