QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#816546 | #5349. 密钥 | hhoppitree | 100 ✓ | 124ms | 162484kb | C++14 | 1.1kb | 2024-12-16 13:57:37 | 2024-12-16 13:57:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e7 + 5;
bitset<N> v;
int s[N], ct[N], vl[N];
signed main() {
int n, sd, m; scanf("%d%d%d", &n, &sd, &m);
auto rnd = [&] {
sd = ((sd * 12321) ^ 9999) % 32768;
return sd;
};
for (int i = 1; i <= n * 2 + 1; ++i) {
v[i] = rnd() / 128 % 2;
}
int t = v.count();
for (int i = 1; t > n; ++i) {
if (v[i] == 1) v[i] = 0, --t;
}
for (int i = 1; t < n; ++i) {
if (v[i] == 0) v[i] = 1, ++t;
}
for (int i = 1, z = n + 1; i <= n * 2 + 1; ++i) {
z += (v[i] ? 1 : -1);
if (v[i] == 1) ++s[z];
}
for (int i = n * 2; i; --i) s[i] += s[i + 1];
for (int i = 1, z = n + 1; i <= n * 2 + 1; ++i) {
z += (v[i] ? 1 : -1);
if (v[i] == 1) ++ct[z];
vl[i] = (v[i] ? -1 : s[z + 1] - ct[z + 1]);
}
printf("%ld\n", find(vl + 1, vl + n * 2 + 2, 0) - vl);
printf("%ld\n", find(vl + 1, vl + n * 2 + 2, m) - vl);
printf("%ld\n", find(vl + 1, vl + n * 2 + 2, n - m) - vl);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 0ms
memory: 6140kb
input:
5 1113 1
output:
1 2 7
result:
points 1.0 ok
Test #2:
score: 10
Accepted
time: 2ms
memory: 7928kb
input:
30 4567 15
output:
53 57 57
result:
points 1.0 ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 5824kb
input:
900 9876 123
output:
1793 1307 488
result:
points 1.0 ok
Test #4:
score: 10
Accepted
time: 0ms
memory: 6620kb
input:
60000 5566 60000
output:
120001 8 120001
result:
points 1.0 ok
Test #5:
score: 10
Accepted
time: 3ms
memory: 7316kb
input:
99999 9988 50000
output:
199993 1 3
result:
points 1.0 ok
Test #6:
score: 10
Accepted
time: 19ms
memory: 35660kb
input:
2000000 3479 1234567
output:
4000001 246933 3753076
result:
points 1.0 ok
Test #7:
score: 10
Accepted
time: 56ms
memory: 83180kb
input:
5000000 1010 999
output:
9999996 9994668 5329
result:
points 1.0 ok
Test #8:
score: 10
Accepted
time: 112ms
memory: 130756kb
input:
8000000 8888 888888
output:
15999988 1777780 14222219
result:
points 1.0 ok
Test #9:
score: 10
Accepted
time: 124ms
memory: 146624kb
input:
9000000 9753 3333333
output:
17999996 666669 17333328
result:
points 1.0 ok
Test #10:
score: 10
Accepted
time: 121ms
memory: 162484kb
input:
10000000 10000 7142857
output:
19999994 5714287 14285708
result:
points 1.0 ok
Extra Test:
score: 0
Extra Test Passed