QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#134899 | #6641. XOR Dice | nameless_story# | AC ✓ | 1ms | 3560kb | C++20 | 809b | 2023-08-05 09:50:17 | 2023-08-05 09:50:19 |
Judging History
answer
#include"bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(),(x).end()
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
int n,d;
cin>>n>>d;
auto solve=[&](int n,int d)
{
int i,j;
int m=1e6;
vector<int> a;
bool flg=0;
function<void(int)> dfs=[&](int u)
{
a.push_back(u);
if (a.size()==6) { flg=1; return; }
int q=a.size()-1,i,j,x;
for (i=d; i<1<<20; i+=d) if ((u^i)<=m)
{
x=u^i;
for (j=0; j<q; j++) if (x==a[j]||(a[j]^x)%d)
{
break;
}
if (j==q) dfs(x);
if (flg) return;
}
a.pop_back();
};
dfs(0);
assert(a.size()==6);
for (i=0; i<n; i++) for (j=0; j<6; j++) cout<<a[j]<<" \n"[j+1==6];
};
// for (int d=60; d; d--) solve(n,d);
solve(n,d);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
3 2
output:
0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14
result:
ok Correct answer
Test #2:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
100 60
output:
0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 16320 16380 0 60 1020 960 ...
result:
ok Correct answer
Test #3:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
99 2
output:
0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 4 12 14 0 2 6 ...
result:
ok Correct answer
Test #4:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
99 59
output:
0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 0 59 767 708 46020 46079 ...
result:
ok Correct answer
Test #5:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
93 17
output:
0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 119 0 17 51 34 102 ...
result:
ok Correct answer
Test #6:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
100 49
output:
0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0 49 245 196 2254 2303 0...
result:
ok Correct answer
Test #7:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
100 5
output:
0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90 95 0 5 15 10 90...
result:
ok Correct answer
Test #8:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
1 57
output:
0 57 1083 1026 3078 3135
result:
ok Correct answer
Test #9:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
1 22
output:
0 22 286 264 968 990
result:
ok Correct answer
Test #10:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
1 60
output:
0 60 1020 960 16320 16380
result:
ok Correct answer
Test #11:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
1 2
output:
0 2 6 4 12 14
result:
ok Correct answer
Test #12:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
10 24
output:
0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504 0 24 120 96 480 504
result:
ok Correct answer