QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#187699 | #4912. WereYouLast | Crysfly | 100 ✓ | 3718ms | 5000kb | C++20 | 649b | 2023-09-24 20:52:44 | 2023-09-24 20:52:45 |
Judging History
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;
}
详细
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.