QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#78610 | #4820. Kitten's Computer | Appleblue17 | WA | 6ms | 3572kb | C++14 | 3.1kb | 2023-02-19 21:29:27 | 2023-02-19 21:29:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int N=1e5+5;
bool debug=false;
ull Data[N];
int tme[N];
void SET(int i,int j){
if(!debug) printf("SET %d %d\n",i,j);
Data[i]=Data[j];
tme[i]=max({tme[j]})+1;
}
void XOR(int i,int j,int k){
if(!debug) printf("XOR %d %d %d\n",i,j,j);
Data[i]=Data[j] ^ Data[k];
tme[i]=max({tme[j],tme[k]})+1;
}
void AND(int i,int j,int k){
if(!debug) printf("AND %d %d %d\n",i,j,k);
Data[i]=Data[j] & Data[k];
tme[i]=max({tme[j],tme[k]})+1;
}
void OR(int i,int j,int k){
if(!debug) printf("OR %d %d %d\n",i,j,k);
Data[i]=Data[j] | Data[k];
tme[i]=max({tme[j],tme[k]})+1;
}
void NOT(int i,int j){
if(!debug) printf("NOT %d %d\n",i,j);
Data[i]=~Data[j];
tme[i]=max({tme[j]})+1;
}
void LSH(int i,int x){
if(!debug) printf("LSH %d %d\n",i,x);
Data[i]<<=x;
tme[i]++;
}
void RSH(int i,int x){
if(!debug) printf("RSH %d %d\n",i,x);
Data[i]>>=x;
tme[i]++;
}
int cnt;
int G[64],P[64],S[64],T[64];
int adder(int x,int y){
for(int i=0;i<64;i++){
G[i]=++cnt;
AND(G[i],x,y);
LSH(G[i],63-i);
RSH(G[i],63);
}
for(int i=0;i<64;i++){
P[i]=++cnt;
OR(P[i],x,y);
LSH(P[i],63-i);
RSH(P[i],63);
}
for(int i=0;i<64;i++) T[i]=++cnt;
// cout<<"P: "; for(int i=0;i<64;i++) cout<<Data[P[i]]; cout<<'\n';
// cout<<"G: "; for(int i=0;i<64;i++) cout<<Data[G[i]]; cout<<'\n';
for(int t=0;t<6;t++){
for(int i=64-1;i>=(1<<t);i--){
AND(T[i],G[i-(1<<t)],P[i]);
OR(G[i],G[i],T[i]);
AND(P[i],P[i],P[i-(1<<t)]);
}
// cout<<t<<": "<<'\n';
// cout<<"P: "; for(int i=0;i<64;i++) cout<<Data[P[i]]; cout<<'\n';
// cout<<"G: "; for(int i=0;i<64;i++) cout<<Data[G[i]]; cout<<'\n';
}
// cout<<"S: "; for(int i=0;i<64;i++) cout<<Data[S[i]]; cout<<'\n';
for(int t=0;t<6;t++){
for(int j=0;j+(1<<t)<64;j+=(1<<t)){
OR(G[j],G[j],G[j+(1<<t)]);
}
}
LSH(G[1],1);
XOR(1,x,y);
return 1;
}
int A[64],B[64];
int f[2][64],siz[2],id;
void trans(int x,int y,int z,int s,int c){
XOR(s,x,y);
XOR(s,s,z);
OR(c,x,y);
AND(c,c,z);
AND(x,x,y);
OR(c,c,x);
LSH(c,1);
}
int main(){
cnt=2;
for(int i=0;i<64;i++) B[i]=++cnt;
int sav=cnt;
for(int i=0;i<64;i++){
cnt=sav;
for(int j=0;j<64;j++){
A[j]=++cnt;
SET(A[j],2);
LSH(A[j],63-i);
RSH(A[j],63);
LSH(A[j],j);
}
for(int t=0;t<6;t++){
for(int j=0;j+(1<<t)<64;j+=(1<<t)){
OR(A[j],A[j],A[j+(1<<t)]);
}
}
AND(B[i],A[0],1);
LSH(B[i],i);
}
cnt=sav;
// cout<<"B: "; for(int i=0;i<64;i++) cout<<Data[B[i]]<<" "; cout<<'\n';
for(int i=0;i<64;i++) f[0][i+1]=B[i];
siz[0]=64;
while(siz[id]>2){
id^=1;
siz[id]=0;
for(int t=1;t<=siz[id^1]%3;t++){
f[id][++siz[id]]=f[id^1][t];
}
for(int t=siz[id^1]%3+1;t<=siz[id^1];t+=3){
f[id][++siz[id]]=++cnt;
f[id][++siz[id]]=++cnt;
trans(f[id^1][t],f[id^1][t+1],f[id^1][t+2],cnt-1,cnt);
}
// for(int i=1;i<=siz[id];i++) cout<<Data[f[id][i]]<<" ";
// cout<<'\n';
}
int tot=adder(f[id][1],f[id][2]);
// cout<<Data[tot]<<'\n';
int mx=0;
for(int i=1;i<=cnt;i++) mx=max(mx,tme[i]);
// cout<<cnt<<" "<<mx;
}
详细
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 3572kb
input:
main
output:
SET 67 2 LSH 67 63 RSH 67 63 LSH 67 0 SET 68 2 LSH 68 63 RSH 68 63 LSH 68 1 SET 69 2 LSH 69 63 RSH 69 63 LSH 69 2 SET 70 2 LSH 70 63 RSH 70 63 LSH 70 3 SET 71 2 LSH 71 63 RSH 71 63 LSH 71 4 SET 72 2 LSH 72 63 RSH 72 63 LSH 72 5 SET 73 2 LSH 73 63 RSH 73 63 LSH 73 6 SET 74 2 LSH 74 63 RSH 74 63 LSH 7...
result:
wrong answer Wrong Answer on test 1: a[1]=2839929338295232408, a[2]=10943642511305433214, but found 0