답안 #282141

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282141 2020-08-24T03:57:54 Z thtsshz_bgwrswh 질문 (CEOI14_question_grader) C++
100 / 100
5444 ms 48232 KB
#include<algorithm>
#include<string>
using namespace std;
bool first=1;
string s[925];
int encode(int n,int x,int y){
	int i;
	if(first){
		first=0;
		s[1]="000000111111";
		for(i=2;i<=920;i++){
			s[i]=s[i-1];
			next_permutation(s[i].begin(),s[i].end());
		}
	}
	for(i=0;i<12;i++)
		if(s[x][i]=='1'&&s[y][i]=='0')
			return i+1;
}
#include<algorithm>
#include<string>
using namespace std;
bool first=1;
string s[925];
int decode(int n,int q,int h){
	int i;
	if(first){
		first=0;
		s[1]="000000111111";
		for(i=2;i<=920;i++){
			s[i]=s[i-1];
			next_permutation(s[i].begin(),s[i].end());
		}
	}
	return s[q][h-1]=='1';
}

Compilation message

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