QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#75584#4912. WereYouLast4182_543_731100 ✓8013ms4740kbC++439b2023-02-05 20:51:332023-02-05 20:51:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-05 20:51:36]
  • 评测
  • 测评结果:100
  • 用时:8013ms
  • 内存:4740kb
  • [2023-02-05 20:51:33]
  • 提交

answer

bool query(int);
void modify(int,bool);
bool WereYouLast(int n,int m)
{
	if(n==1024)
	{
		int rv=1;
		for(int i=1;i<=10;i++)rv+=query(i),modify(i,rv&1),rv>>=1;
		return rv;
	}
	int l=1;while((1<<l)<n)l++;
	int id=0;for(int i=1;i<=5;i++)id=id*2+query(i);
	if(id==l)return 1;
	int rv=query(6+id),nt;
	if(rv||id==l-1)nt=id+1,rv=0;
	else rv=1,nt=0;
	modify(6+id,rv);
	for(int i=5;i>=1;i--)modify(i,nt&1),nt>>=1;
	return 0;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

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

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: 130ms
memory: 4728kb

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: 8013ms
memory: 4704kb

input:

67108864 100000

output:

12345876 6 6

result:

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