Submission #1349916

#TimeUsernameProblemLanguageResultExecution timeMemory
1349916thelegendary08Magic Show (APIO24_show)C++17
100 / 100
2 ms836 KiB
#include<bits/stdc++.h>
#include "Alice.h"
#define int long long
#define vi vector<int>
#define pii pair<signed,signed>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define f0r(i,n) for(int i=0; i<n; i++)
#define FOR(i,k,n) for(int i = k ; i < n; i++)
#define dout2(x,y) cout<<x<<' '<<#x<<' '<<y<<' '<<#y<<endl
using namespace std; 
mt19937 rng(1911);
std::vector<std::pair<signed,signed>> Alice(){
	int n = 5000; int x = setN(n);
	vector<pii>v; v.eb(1,2); vi b(n+1); FOR(i,1,n+1)b[i] = rng() % 60; 
	for(int i = 3; i <= n; i++){
		int p1 = -1, p2 = -1; 
		while(p1 == p2){
			p1 = rng() % (i-1) + 1, p2 = rng() % (i-1) + 1; 
		}//dout2(p1,p2);
		if((1LL << b[i]) & x)v.eb(p2,i); else v.eb(p1,i);
	}
    return v; 
}
#include<bits/stdc++.h>
#include "Bob.h"
#define int long long
#define vi vector<int>
#define pii pair<signed,signed>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define f0r(i,n) for(int i=0; i<n; i++)
#define FOR(i,k,n) for(int i = k ; i < n; i++)
#define dout2(x,y) cout<<x<<' '<<#x<<' '<<y<<' '<<#y<<endl
using namespace std; 
mt19937 RNG(1911);
long long Bob(std::vector<std::pair<signed,signed>> V){
	int n = 5000; vi par(n+1); for(auto [a,b] : V)if(a < b)par[b]=a; else par[a]=b;
	vi b(n+1, -1); FOR(i,1,n+1)b[i] = RNG() % 60; int ans = 0; FOR(i,3,n+1){
		int p1 = -1, p2 = -1; 
		while(p1 == p2){
			p1 = RNG() % (i-1) + 1, p2 = RNG() % (i-1) + 1; 
		}
		// dout2(p1,p2);
		if(par[i] == -1)continue; 
		if(par[i] == p2)ans |= (1LL << b[i]); 
	} //cout<<ans<<" ans"<<'\n';
    return ans; 
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...