Submission #1162527

#TimeUsernameProblemLanguageResultExecution timeMemory
1162527alexander707070Magic Show (APIO24_show)C++17
100 / 100
2 ms592 KiB
#include <bits/stdc++.h>
#include "Alice.h"

#define MAXN 5007

using namespace std;

// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

mt19937 rnd(42069);

int n,perm[MAXN];

vector< pair<int,int> > Alice(){
	n=5000;
    long long x = setN(n);

    for(int i=1;i<=n;i++)perm[i]=i;
    shuffle(perm+1,perm+n+1,rnd);

    vector< pair<int,int> > edges;
    for(int i=2;i<=10;i++){
        edges.push_back({i-1,i});
    }

    for(int i=11;i<=n;i++){

        int bit=perm[i]%60;
        int curr=((x & (1LL<<bit)) > 0);
        
        int par=rnd()%(i-1)+1;
        while(perm[par]%2!=curr){
            par=rnd()%(i-1)+1;
        }

        edges.push_back({par,i});
    }

    return edges;
}
#include <bits/stdc++.h>
#include "Bob.h"

#define MAXN 5007

using namespace std;

// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

mt19937 rndd(42069);

int nn,permm[MAXN];

long long Bob(vector< pair<int,int> > V){
	
    nn=5000;

    for(int i=1;i<=nn;i++)permm[i]=i;
    shuffle(permm+1,permm+nn+1,rndd);

    long long ans=0;

    for(auto curr:V){
        if(curr.second<=10)continue;

        int bit=permm[curr.second]%60;
        if(permm[curr.first]%2==1)ans|=(1LL<<bit);
    }
	
    return ans; // change this into your code
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...