#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second
#define pii pair<int, int>
int mat1[1000][20];
int mat2[1000][1000];
int bit(int mask) {
int ret = 0;
for (int i = 0; i < 12; i++) {
if (mask & (1 << i)) ret++;
}
return ret;
}
int encode(int n, int x, int y) {
int pos = 1;
for (int i = 1; i <= (1 << 12); i++) {
if (bit(i) != 6) continue;
for (int j = 0; j < 12; j++) {
if (i & (1 << j)) {
mat1[pos][j] = 1;
}
else {
mat1[pos][j] = 0;
}
}
pos++;
}
for (int i = 0; i < 1000; i++) {
for (int j = 0; j < 1000; j++) {
if (i == j) continue;
for (int k = 0; k < 12; k++) {
if (!mat1[i][k] && mat1[j][k]) {
mat2[i][j] = k;
}
}
}
}
return mat2[x][y];
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second
#define pii pair<int, int>
int mat1[1000][20];
int bit(int mask) {
int ret = 0;
for (int i = 0; i < 12; i++) {
if (mask & (1 << i)) ret++;
}
return ret;
}
int decode(int n, int q, int h) {
int pos = 1;
for (int i = 1; i <= (1 << 12); i++) {
if (bit(i) != 6) continue;
for (int j = 0; j < 12; j++) {
if (i & (1 << j)) {
mat1[pos][j] = 1;
}
else {
mat1[pos][j] = 0;
}
}
pos++;
}
return mat1[q][h];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7020 ms |
4160 KB |
Time limit exceeded |
2 |
Incorrect |
2167 ms |
4476 KB |
the encoded value must be greater than or equal to 1 |