답안 #351633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
351633 2021-01-20T06:05:09 Z Bill_00 질문 (CEOI14_question_grader) C++14
100 / 100
5100 ms 24764 KB
#include <bits/stdc++.h>
// #define N 100001
#define MOD 998244353
#define ll long long
#define pb push_back
const int M=62;
using namespace std;
string s[1000];
bool flag=0;
int encode (int n, int x, int y) {
	if(flag==0){
      	flag=1;
		for(int i=0;i<12;i++){
			s[1]+=((i<6)?'1':'0');
		}
		for(int i=2;i<=920;i++){
			s[i]=s[i-1];
			next_permutation(s[i].begin(),s[i].end());
		}
    }
	for(int i=0;i<12;i++){
      if(s[x][i]=='1' && s[y][i]=='0') return i+1;
    }
}
#include <bits/stdc++.h>
// #define N 100001
#define MOD 998244353
#define ll long long
#define pb push_back
const int M=62;
using namespace std;
string s[1000];
bool flag=0;
int decode (int n, int q, int h) {
	if(flag==0){
      	flag=1;
		for(int i=0;i<12;i++){
			s[1]+=((i<6)?'1':'0');
		}
		for(int 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:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 4235 ms 24576 KB Output is correct - maxh = 12
2 Correct 5100 ms 24764 KB Output is correct - maxh = 12