QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#448353 | #4912. WereYouLast | asupersalmon | 100 ✓ | 12781ms | 5060kb | C++14 | 2.3kb | 2024-06-19 15:40:18 | 2024-06-19 15:40:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
bool query(int);
void modify(int,bool);
bool WereYouLast(int N, int m){
if(N == (1<<10)){
int num = 0;
for(int i = 0; i < 10; i++){
num += ((int)query(i+1)<<i);
}
if(num == (1<<10)-1) return 1;
num++;
for(int i = 0; i < 10; i++){
modify(i+1,(num&(1<<i))>0);
}
return 0;
}
else if(N == (1<<16)){
bitset<65> arr("00000000000000000000000000000000010000000110011101000010111000000");
int num = 1;
bool die = true;
int l[6];
bool blob[6];
int s = 5;
for(int i = 0; i < 5; i++){
blob[i] = query(num);
die &= (blob[i]^arr[num]);
l[i]= num;
num = num * 2;
if(blob[i]^arr[num/2]) num++;
}
if(die) return 1;
for(int i = s - 1; i >= 0; i--){
if(!(blob[i]^arr[l[i]]) ){
modify(l[i],!arr[l[i]]);
s = i - 1;
break;
}
modify(l[i],arr[l[i]]);
}
for(int i = s; i >= 0; i--){
modify(l[i],arr[l[i]]);
}
return 0;
}
else if(N == (1<<20)){
bitset<65> arr("00000000000000000000000000000000011001000110000010000010000000000");
int num = 1;
bool die = true;
int l[6];
bool blob[6];
int s = 5;
for(int i = 0; i < 5; i++){
blob[i] = query(num);
die &= (blob[i]^arr[num]);
l[i]= num;
num = num * 2;
if(blob[i]^arr[num/2]) num++;
}
if(die) return 1;
for(int i = s - 1; i >= 0; i--){
if(!(blob[i]^arr[l[i]]) ){
modify(l[i],!arr[l[i]]);
s = i - 1;
break;
}
modify(l[i],arr[l[i]]);
}
for(int i = s; i >= 0; i--){
modify(l[i],arr[l[i]]);
}
return 0;
}
else if(true){
bitset<65> arr("00000000000000000001101001100101000000000100001111000010000000000");
int num = 1;
bool die = true;
int l[6];
bool blob[6];
int s = 6;
for(int i = 0; i < 6; i++){
blob[i] = query(num);
die &= (blob[i]^arr[num]);
l[i]= num;
num = num * 2;
if(blob[i]^arr[num/2]) num++;
if( arr[1]^blob[0] && i == 3){
s = 4;
break;
}
}
if(die) return 1;
for(int i = s - 1; i >= 0; i--){
if(!(blob[i]^arr[l[i]]) ){
modify(l[i],!arr[l[i]]);
s = i - 1;
break;
}
modify(l[i],arr[l[i]]);
}
for(int i = s; i >= 0; i--){
modify(l[i],arr[l[i]]);
}
return 0;
}
return 1;
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 3932kb
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: 13ms
memory: 4928kb
input:
65536 100000
output:
12345876 5 5
result:
ok Correct Answer. C1 = 5. C2 = 5.
Subtask #3:
score: 30
Accepted
Test #3:
score: 30
Accepted
time: 212ms
memory: 5004kb
input:
1048576 100000
output:
12345876 5 5
result:
ok Correct Answer. C1 = 5. C2 = 5.
Subtask #4:
score: 40
Accepted
Test #4:
score: 40
Accepted
time: 12781ms
memory: 5060kb
input:
67108864 100000
output:
12345876 6 6
result:
ok Correct Answer. C1 = 6. C2 = 6.