QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491355#4912. WereYouLastlifan90 5867ms4980kbC++14571b2024-07-25 19:00:192024-07-25 19:00:19

Judging History

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

  • [2024-07-25 19:00:19]
  • 评测
  • 测评结果:90
  • 用时:5867ms
  • 内存:4980kb
  • [2024-07-25 19:00:19]
  • 提交

answer

// 
#include<bits/stdc++.h>
using namespace std;
bool query(int);
void modify(int,bool);
bool WereYouLast(int n,int m){
	int x=0;
	for(int i=1;i<=5;i++){
		x=x*2+query(i);
	}
	int yy=0;
	int nn=n;
	while(nn)yy++,nn>>=1;
	yy--;
	if(x==yy)return 1;
	else if(x==yy-1){
		nn=yy;
		for(int i=5;i>=1;i--){
			modify(i,nn%2);
			nn>>=1;
		}
		return 0;
	}
	else{
		int op=query(100+x);
		if(op){
			modify(100+x,0);
			x++;
		}
		else{
			modify(100+x,1);
			x=0;
		}
		for(int i=5;i>=1;i--){
			modify(i,x%2);
			x>>=1;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3904kb

input:

1024 10

output:

12345876 -2 100

result:

wrong answer Invalid Operation At Position 100.

Subtask #2:

score: 20
Accepted

Test #2:

score: 20
Accepted
time: 3ms
memory: 4976kb

input:

65536 100000

output:

12345876 6 6

result:

ok Correct Answer.
C1 = 6.
C2 = 6.

Subtask #3:

score: 30
Accepted

Test #3:

score: 30
Accepted
time: 85ms
memory: 4932kb

input:

1048576 100000

output:

12345876 6 6

result:

ok Correct Answer.
C1 = 6.
C2 = 6.

Subtask #4:

score: 40
Accepted

Test #4:

score: 40
Accepted
time: 5867ms
memory: 4980kb

input:

67108864 100000

output:

12345876 6 6

result:

ok Correct Answer.
C1 = 6.
C2 = 6.