QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#134957#6641. XOR DicePanC_ake#AC ✓3ms3576kbC++201.2kb2023-08-05 10:20:072023-08-05 10:20:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 10:20:11]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3576kb
  • [2023-08-05 10:20:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long

const int maxn = 200010;
const int inf = 0x3f3f3f3f3f3f3f3f;

void solve() {
    int n, d;
    cin >> n >> d;
    set<int> st, ans{0, d};
    st.insert(0);
    st.insert(d);
    for (int i = 1; i <= 4; i++) {
        int ok = 0;
        for (int i = 1; i <= 1e6; i++) {
            if (ans.count(i)) continue;
            int now = i;
            int flag = 1;
            for (auto v : st) {
                if ((v ^ now) % d != 0) flag = 0;
            }
            if (flag) {
                set<int> temp = st;
                for (auto v : temp) {
                    st.insert(i ^ v);
                }
                st.insert(i);
                ans.insert(i);
                ok = 1;
                break;
            }
        }
        if (ok == 0) {
            cout << "NONONO" << '\n';
            return;
        }
    }
    for (int i = 0; i < n; i++) {
        for (auto v : ans) cout << v << " ";
        cout << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3504kb

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: 2ms
memory: 3576kb

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: 3476kb

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: 3ms
memory: 3540kb

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: 3468kb

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: 3576kb

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: 3460kb

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: 3572kb

input:

1 57

output:

0 57 1026 1083 2052 2109 

result:

ok Correct answer

Test #9:

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

input:

1 22

output:

0 22 264 286 704 726 

result:

ok Correct answer

Test #10:

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

input:

1 60

output:

0 60 960 1020 15360 15420 

result:

ok Correct answer

Test #11:

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

input:

1 2

output:

0 2 4 6 8 10 

result:

ok Correct answer

Test #12:

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

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