답안 #189138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
189138 2020-01-13T22:21:54 Z TadijaSebez 질문 (CEOI14_question_grader) C++11
100 / 100
1573 ms 79384 KB
#include <vector>
std::vector<int> v;
int encode(int n, int x, int y)
{
	if(v.empty()) for(int i=1;v.size()<=920;i++) if(__builtin_popcount(i)==6) v.push_back(i);
	for(int i=0;i<12;i++) if((v[x]>>i&1) && !(v[y]>>i&1)) return i+1;
}
#include <vector>
std::vector<int> e;
int decode (int n, int q, int h)
{
	if(e.empty()) for(int i=1;e.size()<=920;i++) if(__builtin_popcount(i)==6) e.push_back(i);
	return (e[q]>>(h-1)&1)?1:0;
}

Compilation message

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