QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#743363 | #4912. WereYouLast | I_be_wanna | 100 ✓ | 3537ms | 4988kb | C++20 | 595b | 2024-11-13 19:01:27 | 2024-11-13 19:01:33 |
Judging History
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;}
详细
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.