QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#127197 | #6641. XOR Dice | Vriance# | WA | 1ms | 3592kb | C++14 | 1.3kb | 2023-07-19 14:02:00 | 2023-07-19 14:02:04 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cctype>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn=500005;
const int INF=0x7f7f;
inline int read(){
int x=0,w=1;char c=getchar();
for(;!isdigit(c);c=getchar())if(c=='-')w=-1;
for(;isdigit(c);x=(x<<3)+(x<<1)+c-'0',c=getchar());
return x*w;
}
inline ll readll(){
ll x=0,w=1;char c=getchar();
for(;!isdigit(c);c=getchar())if(c=='-')w=-1;
for(;isdigit(c);x=(x<<3)+(x<<1)+c-'0',c=getchar());
return x*w;
}
ll a[25];
map<ll,ll>mp;
int judge(int x){
int p=0;
while(x){
if(x&1)p++;
x>>=1;
}
if(p==6)return 1;
else return 0;
}
int main(){
ll n=read(),d=read();
for(int i=0;i<8;i++){
a[i]=d*((i&1)+(i&2)*pow(2,6)+(i&4)*pow(2,12));
mp[a[i]]=1;
}
for(int k=8,b=2;k<=10;){
for(int i=0;i<8;i++){
a[k]=d*b*((i&1)+(i&2)*pow(2,6)+(i&4)*pow(2,12));
if(!mp[a[k]])k++;
mp[a[k]]=1;
}
b++;
}
for(int i=0;i<8;i++){
a[i]=d*((i&1)+(i&2)*pow(2,6)+(i&4)*pow(2,12));
mp[a[i]]=1;
}
for(int i=0,p=1;p<=n;i++){
if(judge(i)){
int x=i,c=0;
while(x){
if(x&1)printf("%d ",a[c]);
x>>=1;c++;
}
p++;
printf("\n");
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3592kb
input:
3 2
output:
0 2 256 258 32768 32770 0 2 256 258 32768 33024 0 2 256 258 32770 33024
result:
ok Correct answer
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3584kb
input:
100 60
output:
0 60 7680 7740 983040 983100 0 60 7680 7740 983040 990720 0 60 7680 7740 983100 990720 0 60 7680 983040 983100 990720 0 60 7740 983040 983100 990720 0 7680 7740 983040 983100 990720 60 7680 7740 983040 983100 990720 0 60 7680 7740 983040 990780 0 60 7680 7740 983100 990780 0 60 7680 983040 ...
result:
wrong answer Invalid output