QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#75584 | #4912. WereYouLast | 4182_543_731 | 100 ✓ | 8013ms | 4740kb | C++ | 439b | 2023-02-05 20:51:33 | 2023-02-05 20:51:36 |
Judging History
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.