QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#85743#4820. Kitten's ComputerhuzhaoyangAC ✓1ms3528kbC++141.5kb2023-03-08 10:47:442023-03-08 10:47:46

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-08 10:47:46]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3528kb
  • [2023-03-08 10:47:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int N=405,M=64,L=6;
int t[N],A[M],U[M],V[M];ull a[N];
set<pair<int,int> >S;
void SET(int i,int j){
	a[i]=a[j],t[i]=t[j]+1;
	printf("SET %d %d\n",i,j);
}
void XOR(int i,int j,int k){
	a[i]=(a[j]^a[k]),t[i]=max(t[j],t[k])+1;
	printf("XOR %d %d %d\n",i,j,k);
}
void AND(int i,int j,int k){
	a[i]=(a[j]&a[k]),t[i]=max(t[j],t[k])+1;
	printf("AND %d %d %d\n",i,j,k);
}
void LSH(int i,int x){
	a[i]<<=x,t[i]++;
	printf("LSH %d %d\n",i,x);
}
void RSH(int i,int x){
	a[i]>>=x,t[i]++;
	printf("RSH %d %d\n",i,x);
}
int main(){
	for(int i=0;i<M;i++){
		A[i]=i+5; 
		SET(3,2),LSH(3,M-i-1),RSH(3,M-1);
		for(int t=0;t<L;t++)SET(4,3),LSH(3,(1<<t)),XOR(3,3,4);
		SET(4,1),LSH(4,i),AND(A[i],3,4);
		S.insert(make_pair(t[A[i]],A[i]));
	}
	while (S.size()>2){
		int x=(*S.begin()).second;S.erase(S.begin());
		int y=(*S.begin()).second;S.erase(S.begin());
		int z=(*S.begin()).second;S.erase(S.begin());
		XOR(1,x,y),AND(y,x,y),XOR(x,1,z),AND(1,1,z),XOR(y,1,y),LSH(y,1);
		S.insert(make_pair(t[x],x)),S.insert(make_pair(t[y],y));
	}
	int x=(*S.begin()).second;S.erase(S.begin());
	int y=(*S.begin()).second;S.erase(S.begin());
	for(int i=0;i<M;i++){
		U[i]=(i<<1)+M+5,V[i]=U[i]+1;
		AND(U[i],x,y),LSH(U[i],i),XOR(V[i],x,y),LSH(V[i],i);
	}
	for(int t=0;t<L;t++)
		for(int i=0;i<M-(1<<t);i++)
			AND(1,V[i],U[i+(1<<t)]),XOR(U[i],1,U[i]),AND(V[i],V[i],V[i+(1<<t)]);
	XOR(1,x,y),XOR(1,1,U[1]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

main

output:

SET 3 2
LSH 3 63
RSH 3 63
SET 4 3
LSH 3 1
XOR 3 3 4
SET 4 3
LSH 3 2
XOR 3 3 4
SET 4 3
LSH 3 4
XOR 3 3 4
SET 4 3
LSH 3 8
XOR 3 3 4
SET 4 3
LSH 3 16
XOR 3 3 4
SET 4 3
LSH 3 32
XOR 3 3 4
SET 4 1
LSH 4 0
AND 5 3 4
SET 3 2
LSH 3 62
RSH 3 63
SET 4 3
LSH 3 1
XOR 3 3 4
SET 4 3
LSH 3 2
XOR 3 3 4
SET 4 3
LSH ...

result:

ok Correct: depth=58