# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
992146 |
2024-06-04T03:48:52 Z |
Izaz |
Magic Show (APIO24_show) |
C++17 |
|
2 ms |
1076 KB |
#include <vector>
#include "Alice.h"
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().
int exist[60]={3527,3136,4730,1125,3369,435,4325,1620,1230,4422,404,4690,2085,3427,541,2755,2863,1650,1602,1863,3927,3691,1653,124,3441,199,4583,3585,3336,3318,3070,1227,98,887,4068,2468,387,1328,2903,3043,2568,757,212,2652,3930,4173,2277,3538,4803,3981,3866,3445,369,3785,3368,493,737,3168,2740,789};
int not_Exist[60] ={61,4044,3118,2306,3751,4371,4287,2374,2400,546,858,2794,2282,1314,1430,1730,1997,1531,365,926,1506,1088,3095,3098,2778,337,4677,1874,3587,4023,3032,4920,571,1916,3896,783,1435,3316,796,1092,847,2179,1809,2540,1414,3059,4957,4384,3457,2302,281,4171,3815,1422,2764,2363,1394,4933,4442,379};
long long power[60];
int par[5001];
int sz[5001];
int root(int v){
while(par[v]!=v)
v = par[v];
return v;
}
void merge(int u,int v,std::vector<std::pair<int,int>>&Graph){
int pu = u;
int pv = v;
v = root(v);
u = root(u);
if(u==v)return;
Graph.push_back({pu,pv});
if(sz[u]>sz[v]){
u^=v;
v^=u;
u^=v;
}
sz[v]+=sz[u];
par[u] = par[v];
}
std::vector<std::pair<int,int>> Alice(){
long long number = setN(5000);
power[0]=1;
for(int i = 1;i<=5000;i++){
par[i]=i;
sz[i]=1;
}
for(int i = 1 ; i < 60;i++)power[i]=1ll*power[i-1]*2;
std::vector<std::pair<int,int>>Graph;
for(int i = 0 ; i < 60;i++){
long long p = power[i];
p&=number;
if(p){
merge(i+1,exist[i],Graph);
}
else{
merge(i+1,not_Exist[i],Graph);
}
}
for(int i = 1;i<5000;i++){
merge(i,i+1,Graph);
}
return Graph;
}
#include <vector>
#include "Bob.h"
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().
int exist[60]={3527,3136,4730,1125,3369,435,4325,1620,1230,4422,404,4690,2085,3427,541,2755,2863,1650,1602,1863,3927,3691,1653,124,3441,199,4583,3585,3336,3318,3070,1227,98,887,4068,2468,387,1328,2903,3043,2568,757,212,2652,3930,4173,2277,3538,4803,3981,3866,3445,369,3785,3368,493,737,3168,2740,789};
int not_Exist[60] ={61,4044,3118,2306,3751,4371,4287,2374,2400,546,858,2794,2282,1314,1430,1730,1997,1531,365,926,1506,1088,3095,3098,2778,337,4677,1874,3587,4023,3032,4920,571,1916,3896,783,1435,3316,796,1092,847,2179,1809,2540,1414,3059,4957,4384,3457,2302,281,4171,3815,1422,2764,2363,1394,4933,4442,379};
long long power2[60];
long long Bob(std::vector<std::pair<int,int>> V){
power2[0]=1;
for(int i = 1 ; i < 60;i++)power2[i]=1ll*power2[i-1]*2;
int sz = V.size();
long long total = 0 ;
for(int i = 0 ; i < sz;i++){
int x = V[i].first;
int y = V[i].second;
if(x<=60){
if(exist[x-1]==y){
total |= power2[x-1];
}
}
}
return total;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1076 KB |
Incorrect answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1076 KB |
Incorrect answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1076 KB |
Incorrect answer. |
2 |
Halted |
0 ms |
0 KB |
- |