제출 #1260843

#제출 시각아이디문제언어결과실행 시간메모리
1260843patgra질문 (CEOI14_question_grader)C++20
0 / 100
1 ms320 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]));
}
#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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...