QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491366#4912. WereYouLastlifan90 5636ms5056kbC++14839b2024-07-25 19:04:392024-07-25 19:04:39

Judging History

This is the latest submission verdict.

  • [2024-07-25 19:04:39]
  • Judged
  • Verdict: 90
  • Time: 5636ms
  • Memory: 5056kb
  • [2024-07-25 19:04:39]
  • Submitted

answer

// 
#include<bits/stdc++.h>
using namespace std;
bool query(int);
void modify(int,bool);
bool WereYouLast(int n,int m){
	if(n==1024){
		int op=query(1);
		if(op){
			int x=0;
			for(int i=2;i<=10;i++)x=x*2+query(i);
			if(x==n-1)return 1;
			x++;
			for(int i=10;i>=2;i--)modify(i,x%2),x>>=1;
		}
		else modify(1,1);
		return 0;
	}
	else{
		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: 3960kb

input:

1024 10

output:

12345876 -3 1024
12345876 -3 1024

result:

wrong answer Wrong Answer At Query 1024.

Subtask #2:

score: 20
Accepted

Test #2:

score: 20
Accepted
time: 6ms
memory: 5056kb

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: 4964kb

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: 5636ms
memory: 4984kb

input:

67108864 100000

output:

12345876 6 6

result:

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