제출 #1349812

#제출 시각아이디문제언어결과실행 시간메모리
1349812blameazu마술쇼 (APIO24_show)C++20
0 / 100
2 ms588 KiB
#include <bits/stdc++.h>
using namespace std;

#include "Alice.h"

vector<pair<int,int> > Alice() {
    const int seed = 87;
    const int N = 5000;
    const int m = 25;

    long long x = setN(N);
    vector<int> order(N);
    iota(order.begin(), order.end(), 1);
    for(int i = 0; i < N; i++) {
        swap(order[i], order[(i*seed+seed*67)%N]);
    }

    vector<pair<int, int> > re;
    vector<int> adj(N);
    adj[order.back()] = 1;

    int now = 0;
    int F = 0;
    for(int i = 0; i < m; i++, now += (N/m)) if(x>>i&1) {
        for(int j = now; j < min(N, now + (N/m)-1); j++) if(order[j] != order.back()) {
            adj[order[j]] = 1;
            F = order[j];
            re.push_back({order[j], order.back()});
        }
    }

    for(int i = 1; i <= N; i++) if(!adj[i])
        re.push_back({i, F});
    
    // for(int i = 0; i < re.size(); i++) cout << re[i].first << ' ' << re[i].second << '\n';

    return re;
}
#include <bits/stdc++.h>
using namespace std;

#include "Bob.h"

long long Bob(vector<pair<int,int> > edges){
    const int seed = 87;
	const int N = 5000;
    const int m = 25;

    vector<int> order(N);
    iota(order.begin(), order.end(), 1);
    for(int i = 0; i < N; i++) {
        swap(order[i], order[(i*seed+seed*67)%N]);
    }

    vector<int> OK(N);
    // int OKK = 0;
    for(auto &[a, b] : edges) {
        if(a == order.back()) swap(a, b);
        if(b == order.back()) {
            OK[a] = 1;
            // OKK++;
        }
    }
    // cout << OKK << '\n';

    long long ans = 0;

    for(int i = 0, now = 0; i < m; i++, now+=(N/m)) {
        int ok = 0;
        for(int j = now; j < min(N, now+(N/m)-1); j++) if(order[j] != order.back())
            ok |= OK[order[j]];
        if(ok) ans |= (1LL<<i);
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...