Submission #1037884

# Submission time Handle Problem Language Result Execution time Memory
1037884 2024-07-29T09:41:55 Z shenfe1 Magic Show (APIO24_show) C++17
0 / 100
1000 ms 17600 KB
#include "Alice.h"
#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

const int MAX=5010;

struct DSU{
    int f[MAX];

    void init(int n){
        for(int i=1;i<=n;i++)f[i]=i;
    }

    int get(int v){
        return (f[v]==v?v:get(f[v]));
    }

    void unite(int a,int b){
        a=get(a),b=get(b);
        f[a]=b;
    }
}D;

bool bit(ll i,int j){
    return (i>>j)&1;
}

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

vector<pair<int,int>> Alice(){
    vector<pair<int,int>> res;
    ll x=setN(5000);
    int n=5000;
    D.init(n);
    vector<pair<int,int>> e;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if(bit(x,(i+j)%60)){
                e.pb({i,j});
            }
        }
    }
    shuffle(all(e),rng);
    for(auto [x,y]:e){
        if(D.get(x)!=D.get(y)){
            D.unite(x,y);
            res.pb({x,y});
        }
    }
    return res;
}
#include "Bob.h"
#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

const int MAX=5010;

long long Bob(vector<pair<int,int>> V){
    ll ans=0;
    for(auto [x,y]:V){
        int a=(x+y)%60;
        ans|=(1ll<<a);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 17600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 17600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 17600 KB Time limit exceeded
2 Halted 0 ms 0 KB -