# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1260847 | patgra | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 673 ms | 39760 KiB |
#include <bits/stdc++.h>
#define rep(a,b,c) for(auto a = (b); a != (c); a++)
#define repD(a,b,c) for(auto a = (b); a != (c); a--)
#define repIn(a, b) for(auto& a : (b))
#define repIn2(a, b, c) for(auto& [a, b] : (c))
constexpr bool dbg = 1;
#define DEBUG if constexpr(dbg)
#define DC DEBUG std::cerr
#define eol std::endl
#define ll long long
#define pb push_back
using namespace std;
namespace {
array<int, 924> genMasks() {
array<int, 924> masks;
int added = 0;
rep(m, 0, 1 << 12) if(__builtin_popcount(m) > 5 && 12 - __builtin_popcount(m) > 5) {
bool g = true;
rep(i, 0, added) if(!((masks[i] & (~m)) && ((~masks[i]) & m))) { g = false; break; }
if(g) masks[added++] = m;
}
return masks;
}
auto masks = genMasks();
};
int encode (int n, int x, int y) {
return __builtin_ctz(masks[x] & (~masks[y])) + 1;
}
#include <bits/stdc++.h>
#define rep(a,b,c) for(auto a = (b); a != (c); a++)
#define repD(a,b,c) for(auto a = (b); a != (c); a--)
#define repIn(a, b) for(auto& a : (b))
#define repIn2(a, b, c) for(auto& [a, b] : (c))
constexpr bool dbg = 1;
#define DEBUG if constexpr(dbg)
#define DC DEBUG std::cerr
#define eol std::endl
#define ll long long
#define pb push_back
using namespace std;
namespace {
array<int, 924> genMasks() {
array<int, 924> masks;
int added = 0;
rep(m, 0, 1 << 12) if(__builtin_popcount(m) > 5 && 12 - __builtin_popcount(m) > 5) {
bool g = true;
rep(i, 0, added) if(!((masks[i] & (~m)) && ((~masks[i]) & m))) { g = false; break; }
if(g) masks[added++] = m;
}
return masks;
}
auto masks = genMasks();
}
int decode (int n, int q, int h) {
return (masks[q] >> (h - 1)) & 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |