QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#686561#8965. Jeloucup-team004100 ✓3ms3696kbC++231.5kb2024-10-29 14:18:362024-10-29 14:18:37

Judging History

This is the latest submission verdict.

  • [2024-10-29 14:18:37]
  • Judged
  • Verdict: 100
  • Time: 3ms
  • Memory: 3696kb
  • [2024-10-29 14:18:36]
  • Submitted

answer

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;
    std::cin >> N;
    
    N /= 2;
    
    int F;
    std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    while (true) {
        F = rng() % (1 << N) + (1 << N);
        
        bool ok = true;
        for (int s = 2; s < (1 << N); s++) {
            int x = F;
            
            int d = std::__lg(s);
            
            for (int i = N; i >= d; i--) {
                if (x >> i & 1) {
                    x ^= s << (i - d);
                }
            }
            
            if (x == 0) {
                ok = false;
                break;
            }
        }
        if (ok) {
            break;
        }
    }
    
    std::cout << (1 << N) << "\n";
    
    auto mul = [&](int x, int y) {
        int z = 0;
        for (int i = 0; i < N; i++) {
            if (x >> i & 1) {
                z ^= y << i;
            }
        }
        for (int i = 2 * N - 1; i >= N; i--) {
            if (z >> i & 1) {
                z ^= F << (i - N);
            }
        }
        return z;
    };
    
    for (int x = 0; x < (1 << N); x++) {
        int a = x | (mul(x, mul(x, x)) << N);
        std::cout << a << " \n"[x == (1 << N) - 1];
    }
    
    
    return 0;
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 1ms
memory: 3632kb

input:

18

output:

512
0 513 4098 7683 32772 43525 61446 54791 60936 31753 114186 73739 224780 250893 155150 190479 237072 113681 253970 118291 49684 182293 56342 186903 70680 239129 10778 168987 83996 250397 5662 163871 162336 255009 53794 81955 100900 15397 213542 194599 196136 258089 71210 5163 134700 206893 99886 ...

result:

points 1.0 OK, |S| = 512

Subtask #2:

score: 20
Accepted

Test #2:

score: 20
Accepted
time: 1ms
memory: 3584kb

input:

20

output:

1024
0 1025 8194 15363 65540 87045 122886 109575 524296 599049 696330 760843 983052 947213 876558 789519 660496 938001 209938 485395 509972 252949 927766 664599 240664 444441 527386 880667 552988 869405 200734 408607 157728 667681 601122 93219 97316 619557 718886 190503 1046568 426025 408618 1006635...

result:

points 1.0 OK, |S| = 1024

Subtask #3:

score: 20
Accepted

Test #3:

score: 20
Accepted
time: 1ms
memory: 3580kb

input:

26

output:

8192
0 8193 65538 122883 524292 696325 983046 876551 4194312 4792329 5570570 6086667 7864332 7577613 7012366 6316047 33554448 35790865 38338578 40624147 44564500 42508309 48693270 46620695 62914584 65740825 60620826 62316571 56098844 57778205 50528286 53108767 41205792 49340449 56999970 65085475 398...

result:

points 1.0 OK, |S| = 8192

Subtask #4:

score: 20
Accepted

Test #4:

score: 20
Accepted
time: 2ms
memory: 3696kb

input:

28

output:

16384
0 16385 131074 245763 1048580 1392645 1966086 1753095 8388616 9584649 11141130 12173323 15728652 15155213 14024718 12632079 67108880 71581713 76677138 81248275 89128980 85016597 97386518 93241367 125829144 131481625 121241626 124633115 112197660 115556381 101056542 106217503 187596832 17031171...

result:

points 1.0 OK, |S| = 16384

Subtask #5:

score: 20
Accepted

Test #5:

score: 20
Accepted
time: 3ms
memory: 3652kb

input:

30

output:

32768
0 32769 262146 491523 2097156 2785285 3932166 3506183 16777224 19169289 22282250 24346635 31457292 30310413 28049422 25264143 134217744 143163409 153354258 162496531 178257940 170033173 194773014 186482711 251658264 262963225 242483226 249266203 224395292 231112733 202113054 212434975 82467228...

result:

points 1.0 OK, |S| = 32768