QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#743363#4912. WereYouLastI_be_wanna100 ✓3537ms4988kbC++20595b2024-11-13 19:01:272024-11-13 19:01:33

Judging History

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

  • [2024-11-13 19:01:33]
  • 评测
  • 测评结果:100
  • 用时:3537ms
  • 内存:4988kb
  • [2024-11-13 19:01:27]
  • 提交

answer

#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: 3960kb

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: 4ms
memory: 4988kb

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: 56ms
memory: 4904kb

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: 3537ms
memory: 4988kb

input:

67108864 100000

output:

12345876 6 6

result:

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