QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#668058 | #9518. 观虫我 (旧版数据) | JWRuixi | 0 | 4674ms | 543544kb | C++20 | 2.4kb | 2024-10-23 11:00:22 | 2024-10-23 11:00:22 |
Judging History
answer
#ifdef LOCAL
#include "stdafx.h"
#else
#include <bits/stdc++.h>
#define IL inline
#define LL long long
#define eb emplace_back
#define sz(v) ((int) (v).size())
#define me(f, x) memset(f, x, sizeof(f))
#define mc(f, g) memcpy(f, g, sizeof(g))
#define L(i, j, k) for (int i = (j); i <= (k); ++i)
#define R(i, j, k) for (int i = (j); i >= (k); --i)
#define FIO(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)
using namespace std;
using vi = vector<int>;
#endif
#ifdef _WIN32
using uint = unsigned;
#endif
using ull = unsigned long long;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
constexpr int N = 1e6 + 9;
constexpr int LIM = 50;
int n, m;
uint sup (uint x) {
return (1U << (n - 6)) - x - 1;
}
struct Q {
uint x; ull y;
} q[N];
uint A, B, C;
uint cost_qry (uint x) {
return 1U << __builtin_popcount((x & A) | (sup(x) & C));
}
uint cost_mdy (uint x) {
return 1U << __builtin_popcount((sup(x) & B) | (x & C));
}
ull a[1U << 26];
int main () {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m;
L (i, 1, m) {
char o[3];
uint x;
cin >> o >> x;
if (*o == '!') {
uint s = x & ((1 << 6) - 1);
q[i].x = x >> 6;
for (uint t = s; t < 64; t = (t + 1) | s) {
q[i].y ^= 1ULL << t;
}
} else {
q[i].x = x;
}
}
uint X = 0, Y = 0, Z = 0;
ull cost = LONG_LONG_MAX;
L (r, 0, LIM - 1) {
A = B = C = 0;
L (i, 0, n - 1) {
int o = rng() % 3;
(o ? (o & 1 ? B : C) : A) |= 1U << i;
}
ull cur = 0;
L (i, 1, m) {
cur += q[i].y ? cost_mdy(q[i].x) : cost_qry(q[i].x >> 6);
}
if (cur < cost) {
cost = cur;
X = A;
Y = B;
Z = C;
}
}
A = X;
B = Y;
C = Z;
cerr << cost << '\n';
L (i, 1, m) {
if (q[i].y) {
uint x = q[i].x;
uint s = (sup(x) & B) | (x & C), r = x & (A | B);
for (uint t = s; ; t = (t - 1) & s) {
a[t | r] ^= q[i].y;
if (!t) {
break;
}
}
} else {
uint x = q[i].x >> 6, c = q[i].x & ((1 << 6) - 1);
uint s = (x & A) | (sup(x) & C), r = x & B;
uint y = 0;
for (uint t = s; ; t = (t - 1) & s) {
y += a[t | r];
if (!t) {
break;
}
}
cout.put('0' | (y >> c & 1)), cout.put('\n');
}
}
}
// I love WHQ!
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 545ms
memory: 21520kb
input:
24 1000000 ! 9475137 ! 4501536 ? 14277831 ? 16695039 ? 5723102 ? 6093887 ? 3014539 ! 475969 ? 12500973 ! 8750136 ? 15617895 ! 4589313 ! 152300 ? 3612579 ? 15248179 ! 764162 ! 4461105 ? 7274495 ? 13299697 ! 8388872 ? 13490383 ! 3875594 ! 9439685 ? 16776189 ! 6443172 ? 13864879 ! 395691 ? 7142271 ? 16...
output:
1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1 1 0 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 ...
result:
wrong answer Wrong answer at operation #4: Incorrect answer.
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 689ms
memory: 28320kb
input:
26 1000000 ! 18006034 ? 66957270 ! 2133064 ! 147618 ! 34621442 ? 49715575 ? 62879287 ! 18620682 ? 67073751 ! 62941186 ! 7634532 ? 67100031 ? 12517237 ! 4804997 ? 65991126 ! 138275 ? 65722687 ? 66043391 ! 19147234 ? 45743743 ! 2242648 ! 44378336 ? 48226020 ! 34341926 ! 665045 ? 55433083 ! 5554254 ? 4...
output:
0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 1 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 1 1 ...
result:
wrong answer Wrong answer at operation #6: Incorrect answer.
Subtask #3:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 1012ms
memory: 52008kb
input:
28 1000000 ! 1081468 ! 128476263 ! 67930241 ? 94304031 ! 103698752 ! 19982 ! 198050624 ? 249519591 ? 71286719 ? 255700799 ! 103309888 ! 819340 ! 12852092 ? 124739445 ? 192734967 ! 101320328 ! 117594711 ? 252032927 ! 134267948 ? 262940285 ! 3155972 ? 267876218 ! 41984160 ? 246413294 ? 246824252 ? 163...
output:
0 1 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 ...
result:
wrong answer Wrong answer at operation #8: Incorrect answer.
Subtask #4:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 1974ms
memory: 150176kb
input:
30 1000000 ! 33852274 ? 1017904007 ? 1046413001 ! 151029382 ? 466826079 ? 250568375 ! 6769874 ! 2106474 ? 536832803 ? 209627867 ! 167104971 ? 1048372157 ! 245380745 ! 25174496 ? 819646460 ! 539548800 ! 671358165 ? 402955591 ? 527753201 ! 582494209 ? 862862931 ? 938974695 ? 263672827 ? 366968669 ? 87...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 1 1 1 1 1 0 0 1 1 0 1 0 1 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1 1 1 ...
result:
wrong answer Wrong answer at operation #27: Incorrect answer.
Subtask #5:
score: 0
Wrong Answer
Test #41:
score: 0
Wrong Answer
time: 4674ms
memory: 543544kb
input:
32 1000000 ! 2474971548 ! 348268033 ? 1055293046 ? 3382525679 ? 1805515707 ? 3210332902 ? 2805668987 ? 4025974780 ! 2217771280 ! 176949664 ! 4213841344 ! 1477473321 ? 3150869759 ? 2127418041 ! 1610631720 ! 3624477314 ! 2288149532 ! 70909964 ! 40117153 ! 1343751456 ? 3758095615 ! 513059275 ! 31956816...
output:
0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 0 1 ...
result:
wrong answer Wrong answer at operation #8: Incorrect answer.