QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202115#6641. XOR Dicearseny_y#AC ✓2ms3564kbC++231.7kb2023-10-05 19:30:552023-10-05 19:30:56

Judging History

你现在查看的是最新测评结果

  • [2023-10-05 19:30:56]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3564kb
  • [2023-10-05 19:30:55]
  • 提交

answer

//I wrote this code 4 u today
#include <bits/stdc++.h>

template<class t> using vc = std::vector<t>;

#define nd node*
#define pnd pair<nd, nd>

using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vc<pll> vpll;
typedef vc<vll> vvll;
typedef vc<vpll> vvpll;

template<const ll MOD>
struct mod_mul : std::multiplies<const ll> {
    ll operator()(const ll a, const ll b) {
        return (a * b) % MOD;
    }
};


template<typename T>
inline void sort(T &a) {
    sort(a.begin(), a.end());
}

template<typename T>
inline void unique(T &a) {
    a.resize(unique(a.begin(), a.end()) - a.begin());
}

template<typename T>
inline void reverse(T &a) {
    reverse(a.begin(), a.end());
}

const ll INF = 9023372036854775808ll;
const ll MOD = 1000000007ll;

vc<int> a;
int n, d;

bool check() {
    for (int i = 0; i < 1 << a.size(); ++i) {
        int xr = 0;
        for (int j = 0; j < 6; ++j) {
            if (i >> j & 1) xr ^= a[j];
        }
        if (xr % d != 0) return false;
    }
    return true;
}

bool gen() {
    if (a.size() == 6) {
        if (check()) {
            for (int z = 0; z < n; ++z) {
                for (auto &i: a) cout << i << ' ';
                cout << '\n';
            }
            exit(0);
            return true;
        }
        return false;
    }
    for (int x = a.back() + 1; x < 1000000; ++x) {
        a.push_back(x);
        if (check() && gen()) return true;
        a.pop_back();
    }
    return false;
}

int main() {
    cin.tie(nullptr)->ios_base::sync_with_stdio(false);
    cin >> n >> d;
    a = {0};
    gen();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3388kb

input:

3 2

output:

0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 

result:

ok Correct answer

Test #2:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

100 60

output:

0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 60 960 1020 15360 15420 
0 6...

result:

ok Correct answer

Test #3:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

99 2

output:

0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 6 8 10 
0 2 4 ...

result:

ok Correct answer

Test #4:

score: 0
Accepted
time: 2ms
memory: 3564kb

input:

99 59

output:

0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 45312 45371 
0 59 708 767 4...

result:

ok Correct answer

Test #5:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

93 17

output:

0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 68 85 
0 17 34 51 6...

result:

ok Correct answer

Test #6:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

100 49

output:

0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245 2058 2107 
0 49 196 245...

result:

ok Correct answer

Test #7:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

100 5

output:

0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 80 85 
0 5 10 15 8...

result:

ok Correct answer

Test #8:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

1 57

output:

0 57 1026 1083 2052 2109 

result:

ok Correct answer

Test #9:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

1 22

output:

0 22 264 286 704 726 

result:

ok Correct answer

Test #10:

score: 0
Accepted
time: 1ms
memory: 3392kb

input:

1 60

output:

0 60 960 1020 15360 15420 

result:

ok Correct answer

Test #11:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

1 2

output:

0 2 4 6 8 10 

result:

ok Correct answer

Test #12:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

10 24

output:

0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 
0 24 96 120 384 408 

result:

ok Correct answer