답안 #260551

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260551 2020-08-10T14:00:59 Z babo 질문 (CEOI14_question_grader) C++14
100 / 100
4137 ms 48112 KB
#include <bits/stdc++.h>

using namespace std;

bool did=false;
int ok[922][12];
int perm[12]={0,0,0,0,0,0,1,1,1,1,1,1};

int encode(int n,int x,int y){
	//printf("x %d y %d\n",x,y);
	int i,cnt=0;
	if(!did)
	{
		do{
			for(i=0;i<12;i++)
				ok[cnt][i]=perm[i];
			cnt++;
		}while(next_permutation(perm,perm+12));
		did=true;
	}
	x--;y--;
	for(i=0;i<12;i++)
		if(ok[x][i]&&!ok[y][i]) return i+1;
}
#include <bits/stdc++.h>

using namespace std;

bool did=false;
int ok[922][12];
int perm[12]={0,0,0,0,0,0,1,1,1,1,1,1};


int decode(int n,int q,int h){
	int i,cnt=0;
	q--;
	if(!did)
	{
		do{
			for(i=0;i<12;i++)
				ok[cnt][i]=perm[i];
			cnt++;
		}while(next_permutation(perm,perm+12));
		did=true;
	}
	return ok[q][h-1];
	//printf("h %lld\n",h);
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 3727 ms 48112 KB Output is correct - maxh = 12
2 Correct 4137 ms 47944 KB Output is correct - maxh = 12