답안 #127995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127995 2019-07-10T10:11:33 Z Utaha Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int partner[150];
vector<int> s;

void Anna( int N, long long X, int K, int P[] ){
	srand(123987654);

	vector<int> v;
	for(int i=0;i<150;i++) v.pb(i);
	random_shuffle(v.begin(),v.end());
	for(int i=0;i<150;i+=2){
		partner[v[i]]=v[i+1];
		partner[v[i+1]]=v[i];
		s.pb(v[i]);
	}

	X^=0x84d9302917c854LL;
	// std::cout<<X<<'\n';
	for(long long i=X;i;i/=3) std::cout<<i%3;
	std::cout<<'\n';
	bool ret[150]={0};
	bool notused[150]={0};
	for(int i=0;i<K;i++){
		notused[P[i]]=1;
	}
	int pt=38;
	for(int i:s){
		long long type=X%3;
		if(type==0){
			if(notused[i]) continue;
			ret[i]=1;
			ret[partner[i]]=0;
		}
		else if(type==1){
			if(notused[partner[i]]) continue;
			ret[i]=0;
			ret[partner[i]]=1;
		}
		else{
			if(notused[i]||notused[partner[i]]) continue;
			ret[i]=ret[partner[i]]=1;
		}
		// std::cout<<X%3<<'\n';
		X/=3;
		if(X==0) break;
		pt--;
		if(pt==0) break;
	}
	// for(int i=0;i<N;i++) std::cout<<ret[i];
	// std::cout<<'\n';
	for(int i=0;i<N;i++) Set(i,ret[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> s2;
long long Bruno( int N, int A[] ){
	srand(123987654);

	vector<int> v;
	for(int i=0;i<150;i++) v.pb(i);
	random_shuffle(v.begin(),v.end());
	for(int i=0;i<150;i+=2){
		partner[v[i]]=v[i+1];
		partner[v[i+1]]=v[i];
		s2.pb(v[i]);
	}

	long long ret=0;
	long long base=1;
	for(int i:s){
		if(A[i]==0&&A[partner[i]]==0) continue;

		int type=-1;
		if(A[i]==1){
			if(A[partner[i]]==1) type=2;
			else type=0;
		}
		else type=1;

		// std::cout<<"Bruno: "<<type<<'\n';

		ret+=base*type;
		base*=3;
	}
	// std::cout<<ret<<'\n';
	return ret^0x84d9302917c854LL;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:13:3: error: 'partner' was not declared in this scope
   partner[v[i]]=v[i+1];
   ^~~~~~~
Bruno.cpp:20:12: error: 's' was not declared in this scope
  for(int i:s){
            ^
Bruno.cpp:21:17: error: 'partner' was not declared in this scope
   if(A[i]==0&&A[partner[i]]==0) continue;
                 ^~~~~~~
Bruno.cpp:25:9: error: 'partner' was not declared in this scope
    if(A[partner[i]]==1) type=2;
         ^~~~~~~