답안 #133865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133865 2019-07-21T15:31:43 Z doowey Amusement Park (JOI17_amusement_park) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "Ioi.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());


const int MAXN = (int)1e4 + 9;
const int LG = 60;

vector<int> TT[MAXN];
int ti[MAXN];
int cn;

void gt(int u){
    if(ti[u] != -1) return;
    ti[u] = cn ++ ;
    cn %= LG;
    for(auto p : TT[u]){
        gt(p);
    }
}

int pv[LG][MAXN];

set<int> rem;

int match[LG];

ll Ioi(int n, int m, int a[], int b[], int p, int v, int useless) {
   for(int i = 0 ; i < m ; i ++ ){
        TT[a[i]].push_back(b[i]);
        TT[b[i]].push_back(a[i]);
    }
    for(int i = 0 ; i < n ; i ++ )
        ti[i] = -1;
    gt(0);
    int node;
    for(int i = 0 ; i < LG; i ++ ) {
        for(int j = 0 ; j < n; j ++ )
            pv[i][j] = -1;
        queue<int> ff;
        for(int j = 0 ; j < n; j ++){
            if(ti[j] == i){
                pv[i][j] = j;
                ff.push(j);
            }
        }
        while(!ff.empty()){
            node = ff.front();
            ff.pop();
            for(auto p : TT[node]){
                if(pv[i][p] == -1){
                    pv[i][p] = node;
                    ff.push(p);
                }
            }
        }
    }
    for(int i = 0 ; i < LG; i ++ )
        rem.insert(i);
    rem.erase(ti[p]);
    for(int i = 0 ; i < LG; i ++ )
        match[i] = -1;
    match[ti[p]] = v;
    int go;
    int bit;
    int num;
    while(!rem.empty()){
        num = ((int)rnd() % (int)rem.size() + 71) % (int)rem.size();
        auto it = rem.begin();
        for(int j = 0 ; j < num ; j ++ )
            ++ it;
        go = *it;
        do{
            bit = Move(pv[go][p]);
            p = pv[go][p];  
            if(rem.count(ti[p])){
                rem.erase(ti[p]);
                match[ti[p]] = bit;
            }
        }while(pv[go][p] != p);
    }
    ll ret = 0;
    for(int i = 0 ; i < LG; i ++ )
        ret += match[i] * (1ll << i);
    return ret;
}
#include <bits/stdc++.h>
#include "Ioi.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

const int MAXN = (int)1e4 + 9;
const int LG = 60;

vector<int> TT[MAXN];
int ti[MAXN];
int cn;

void gt(int u){
    if(ti[u] != -1) return;
    ti[u] = cn ++ ;
    cn %= LG;
    for(auto p : TT[u]){
        gt(p);
    }
}

int pv[LG][MAXN];

set<int> rem;

int match[LG];

ll Ioi(int n, int m, int a[], int b[], int p, int v, int useless) {
   for(int i = 0 ; i < m ; i ++ ){
        TT[a[i]].push_back(b[i]);
        TT[b[i]].push_back(a[i]);
    }
    for(int i = 0 ; i < n ; i ++ )
        ti[i] = -1;
    gt(0);
    int node;
    for(int i = 0 ; i < LG; i ++ ) {
        for(int j = 0 ; j < n; j ++ )
            pv[i][j] = -1;
        queue<int> ff;
        for(int j = 0 ; j < n; j ++){
            if(ti[j] == i){
                pv[i][j] = j;
                ff.push(j);
            }
        }
        while(!ff.empty()){
            node = ff.front();
            ff.pop();
            for(auto p : TT[node]){
                if(pv[i][p] == -1){
                    pv[i][p] = node;
                    ff.push(p);
                }
            }
        }
    }
    for(int i = 0 ; i < LG; i ++ )
        rem.insert(i);
    rem.erase(ti[p]);
    match[ti[p]] = v;
    int go;
    int bit;
    while(!rem.empty()){
        go = *rem.begin();
        do{
            bit = Move(pv[go][p]);
            p = pv[go][p];  
            if(rem.count(ti[p])){
                rem.erase(ti[p]);
                match[ti[p]] = bit;
            }
        }while(pv[go][p] != p);
    }
    ll ret = 0;
    for(int i = 0 ; i < LG; i ++ )
        ret += match[i] * (1ll << i);
    return ret;
}

Compilation message

Joi.cpp: In function 'll Ioi(int, int, int*, int*, int, int, int)':
Joi.cpp:84:19: error: 'Move' was not declared in this scope
             bit = Move(pv[go][p]);
                   ^~~~
Joi.cpp:84:19: note: suggested alternative: 'node'
             bit = Move(pv[go][p]);
                   ^~~~
                   node