답안 #991943

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991943 2024-06-03T12:29:16 Z Izaz 마술쇼 (APIO24_show) C++17
0 / 100
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]={61,98,124,199,212,281,337,365,369,379,387,404,435,493,541,546,571,737,757,783,789,796,847,858,887,926,1088,1092,1125,1227,1230,1314,1328,1394,1414,1422,1430,1435,1506,1531,1602,1620,1650,1653,1730,1809,1863,1874,1916,1997,2085,2179,2277,2282,2302,2306,2363,2374,2400,2468};
int not_Exist[60] ={2540,2568,2652,2740,2755,2764,2778,2794,2863,2903,3032,3043,3059,3070,3095,3098,3118,3136,3168,3316,3318,3336,3368,3369,3427,3441,3445,3457,3527,3538,3585,3587,3691,3751,3785,3815,3866,3896,3927,3930,3981,4023,4044,4068,4171,4173,4287,4325,4371,4384,4422,4442,4583,4677,4690,4730,4803,4920,4933,4957};
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]={61,98,124,199,212,281,337,365,369,379,387,404,435,493,541,546,571,737,757,783,789,796,847,858,887,926,1088,1092,1125,1227,1230,1314,1328,1394,1414,1422,1430,1435,1506,1531,1602,1620,1650,1653,1730,1809,1863,1874,1916,1997,2085,2179,2277,2282,2302,2306,2363,2374,2400,2468};
int not_Exist[60] ={2540,2568,2652,2740,2755,2764,2778,2794,2863,2903,3032,3043,3059,3070,3095,3098,3118,3136,3168,3316,3318,3336,3368,3369,3427,3441,3445,3457,3527,3538,3585,3587,3691,3751,3785,3815,3866,3896,3927,3930,3981,4023,4044,4068,4171,4173,4287,4325,4371,4384,4422,4442,4583,4677,4690,4730,4803,4920,4933,4957};
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;	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1076 KB Correct.
2 Incorrect 2 ms 1076 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1076 KB Correct.
2 Incorrect 2 ms 1076 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1076 KB Correct.
2 Incorrect 2 ms 1076 KB Incorrect answer.
3 Halted 0 ms 0 KB -