#include <bits/stdc++.h>
#define fi first
#define se second
#define ryan bear
#define all(V) ((V).begin()), ((V).end())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<int> vim;
typedef vector<ll> vlm;
vim a1;
int f1(int a) {
int ret=0;
while (a) {ret+=a&1; a>>=1;}
return ret;
}
void init1() {
for (int i=0; i<(1<<12); i++) if (f1(i)==6) a1.push_back(i);
}
int encode (int n, int x, int y) {
if (!a1.size()) init1();
x=a1[x], y=a1[y];
for (int i=0; i<12; i++) if ((x&(1<<i))&&!(y&(1<<i))) return i+1;
}
#include <bits/stdc++.h>
#define fi first
#define se second
#define ryan bear
#define all(V) ((V).begin()), ((V).end())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<int> vim;
typedef vector<ll> vlm;
vim a2;
int f2(int a) {
int ret=0;
while (a) {ret+=a&1; a>>=1;}
return ret;
}
void init2() {
for (int i=0; i<(1<<12); i++) if (f2(i)==6) a2.push_back(i);
}
int decode (int n, int q, int h) {
if (!a2.size()) init2();
q=a2[q];
return ((1<<(h-1))&q)?1:0;
}
Compilation message
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1586 ms |
125192 KB |
Output is correct - maxh = 12 |
2 |
Correct |
1592 ms |
125040 KB |
Output is correct - maxh = 12 |