QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#491767 | #4912. WereYouLast | ddxrS | 90 | 6429ms | 5112kb | C++14 | 644b | 2024-07-25 21:55:40 | 2024-07-25 21:55:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
bool query(int);
void modify(int, bool);
bool WereYouLast(int n, int m) {
int p = log2(n), x;
int s[5], t;
s[0] = query(p + 1 + 1), s[1] = query(p + 1 + 2), s[2] = query(p + 1 + 3), s[3] = query(p + 1 + 4), s[4] = query(p + 1 + 5);
t = s[0] + 2 * s[1] + 4 * s[2] + 8 * s[3] + 16 * s[4];
x = query(t + 1);
if(t == p) return true;
if(x || t == p - 1) modify(t + 1, 0), t++;
else modify(t + 1, 1), t = 0;
modify(p + 1 + 1, t & 1), modify(p + 1 + 2, (t / 2) & 1), modify(p + 1 + 3, (t / 4) & 1), modify(p + 1 + 4, (t / 8) & 1), modify(p + 1 + 5, (t / 16) & 1);
return false;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3864kb
input:
1024 10
output:
12345876 -2 12
result:
wrong answer Invalid Operation At Position 12.
Subtask #2:
score: 20
Accepted
Test #2:
score: 20
Accepted
time: 7ms
memory: 5028kb
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: 98ms
memory: 5108kb
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: 6429ms
memory: 5112kb
input:
67108864 100000
output:
12345876 6 6
result:
ok Correct Answer. C1 = 6. C2 = 6.