QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#187699#4912. WereYouLastCrysfly100 ✓3718ms5000kbC++20649b2023-09-24 20:52:442023-09-24 20:52:45

Judging History

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

  • [2023-09-24 20:52:45]
  • 评测
  • 测评结果:100
  • 用时:3718ms
  • 内存:5000kb
  • [2023-09-24 20:52:44]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)

bool query(int);
void modify(int,bool);

bool WereYouLast(int n,int m){
	if(n==(1<<10)){
		int p=1;
		while(p<=10 && query(p)) modify(p,0),++p;
		if(p==11)return 1;
		modify(p,1);
		return 0;
	}
	int t=0,x=0;
	For(i,0,4)if(query(i+1))t|=(1<<i);
	x=t;
	if((1<<t)==n)return 1;
	bool bo=query(t+6);
	if(!bo && (1<<(t+1))!=n) modify(t+6,1),t=0;
	else modify(t+6,0),t++;
	For(i,0,4) if((x>>i&1)!=(t>>i&1)) modify(i+1,t>>i&1);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3896kb

input:

1024 10

output:

12345876 10 10

result:

ok Correct Answer.
C1 = 10.
C2 = 10.

Subtask #2:

score: 20
Accepted

Test #2:

score: 20
Accepted
time: 5ms
memory: 5000kb

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: 60ms
memory: 4940kb

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: 3718ms
memory: 5000kb

input:

67108864 100000

output:

12345876 6 6

result:

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