QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#690870 | #9518. 观虫我 (旧版数据) | hos_lyric# | 20 | 6354ms | 73772kb | C++14 | 2.8kb | 2024-10-31 06:55:25 | 2024-10-31 06:55:25 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#pragma GCC target("avx2")
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
constexpr int BLOCK = 10000;
int N, Q;
vector<char> O;
vector<unsigned> I;
vector<unsigned long long> as, bs;
void build(int e, int p0) {
if (e == 0) {
auto &b = bs[p0];
b ^= (b & 0x00000000ffffffffULL) << 32;
b ^= (b & 0x0000ffff0000ffffULL) << 16;
b ^= (b & 0x00ff00ff00ff00ffULL) << 8;
b ^= (b & 0x0f0f0f0f0f0f0f0fULL) << 4;
b ^= (b & 0x3333333333333333ULL) << 2;
b ^= (b & 0x5555555555555555ULL) << 1;
} else {
--e;
const int p1 = p0 | 1 << e;
for (int p = p0; p < p1; ++p) bs[p | 1 << e] ^= bs[p];
build(e, p0);
build(e, p0 | 1 << e);
}
}
int main() {
for (; ~scanf("%d%d", &N, &Q); ) {
O.resize(Q);
I.resize(Q);
for (int q = 0; q < Q; ++q) {
scanf(" %c%u", &O[q], &I[q]);
}
assert(N==28);
as.assign(1 << (N-6), 0ULL);
bs.assign(1 << (N-6), 0ULL);
for (int qL = 0, qR; qL < Q; qL = qR) {
qR = min(qL + BLOCK, Q);
copy(as.begin(), as.end(), bs.begin());
build(N-6, 0);
for (int q = qL; q < qR; ++q) {
if (O[q] == '!') {
as[I[q] >> 6] ^= 1ULL << (I[q] & 63);
} else {
int ans = bs[I[q] >> 6] >> (I[q] & 63) & 1;
for (int qq = qL; qq < q; ++qq) if (O[qq] == '!') {
if (!(I[qq] & ~I[q])) {
ans ^= 1;
}
}
printf("%d\n", ans);
}
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
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:
result:
Subtask #2:
score: 0
Runtime Error
Test #11:
score: 0
Runtime Error
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:
result:
Subtask #3:
score: 20
Accepted
Test #21:
score: 20
Accepted
time: 6354ms
memory: 73772kb
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 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 1 1 0 1 1 0 1 0 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 1 1 0 1 0 1 ...
result:
ok Accepted.
Test #22:
score: 20
Accepted
time: 6198ms
memory: 73612kb
input:
28 1000000 ! 0 ? 268435455 ? 268435455 ? 268435455 ? 268435455 ? 268435454 ! 262144 ! 2097152 ? 268435455 ? 266338303 ! 0 ? 268435455 ? 268431359 ? 268435455 ? 268435199 ? 268435455 ! 0 ? 268435455 ? 268304383 ? 268435455 ? 267386871 ! 0 ! 0 ! 0 ! 8192 ? 234881023 ? 268435455 ? 268435455 ? 268435455...
output:
1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 1 ...
result:
ok Accepted.
Test #23:
score: 20
Accepted
time: 6132ms
memory: 73756kb
input:
28 1000000 ! 67108864 ? 268369919 ? 108724215 ! 2621440 ! 360576 ? 259319807 ? 62414335 ? 267911039 ? 268434111 ! 204968 ! 3670272 ? 255844319 ! 8404992 ? 267643903 ? 264239485 ? 268435451 ! 67469313 ! 136314896 ? 268435455 ! 0 ? 268361727 ? 266268671 ! 131074 ? 268271607 ! 16384 ! 1705984 ! 270464 ...
output:
1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 1 1 0 1 0 1 1 0 1 0 1 0 1 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 ...
result:
ok Accepted.
Test #24:
score: 20
Accepted
time: 5996ms
memory: 73608kb
input:
28 1000000 ! 1902096 ? 81641694 ? 247381723 ? 268423692 ! 117194752 ? 75033877 ? 226360807 ! 88368128 ? 38723567 ! 50598934 ! 144779282 ? 130765271 ! 211109508 ! 9496640 ? 259837397 ? 192822463 ! 17358848 ! 23330881 ! 199852673 ? 201030356 ! 8467396 ? 249459704 ! 142884899 ! 34112802 ! 167781384 ? 1...
output:
0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 ...
result:
ok Accepted.
Test #25:
score: 20
Accepted
time: 6159ms
memory: 73688kb
input:
28 1000000 ! 210829378 ? 36947522 ? 259790155 ? 268433343 ? 233308142 ? 205687805 ! 262177 ? 246208617 ? 268173279 ! 35651584 ! 8520002 ? 234749947 ? 180634441 ! 147279353 ! 192794271 ! 131076 ? 268353534 ? 130268453 ? 101299305 ? 228765468 ! 33685506 ! 557056 ! 260 ? 268434428 ? 207609440 ? 2572858...
output:
0 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 ...
result:
ok Accepted.
Test #26:
score: 20
Accepted
time: 6184ms
memory: 73604kb
input:
28 1000000 ! 64484791 ! 33554496 ! 134217748 ? 15770753 ? 234878457 ! 112293486 ! 268426430 ? 168308817 ! 8389248 ? 251656191 ? 267991807 ? 151001904 ? 201325631 ? 218124361 ! 33556752 ! 67108864 ! 4 ! 265177583 ! 263691254 ! 206307327 ? 268304383 ? 268034047 ! 266253730 ? 6427266 ? 268435455 ? 1851...
output:
0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 1 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 1 ...
result:
ok Accepted.
Test #27:
score: 20
Accepted
time: 6123ms
memory: 73760kb
input:
28 1000000 ! 4202592 ? 262144 ? 134217728 ? 134217727 ! 268433915 ? 8667202 ! 266174462 ? 10487808 ! 266338303 ? 268435455 ! 267370495 ! 131072 ? 268434879 ! 248501679 ! 0 ? 268434935 ! 268429303 ? 125693919 ? 268432895 ? 1048704 ! 257912703 ! 72324 ? 268337150 ! 33619972 ? 67108866 ! 199097855 ? 26...
output:
0 0 1 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 ...
result:
ok Accepted.
Test #28:
score: 20
Accepted
time: 6154ms
memory: 73756kb
input:
28 1000000 ! 268435455 ? 268404569 ! 201285633 ! 268427264 ? 201310256 ! 126173184 ! 266326028 ? 268420376 ? 134207050 ! 268288000 ? 267898882 ? 268433315 ! 87539712 ? 267370496 ! 257802240 ? 266289152 ! 134135808 ! 268419072 ? 268421951 ? 268422248 ! 175866400 ! 268419072 ? 268419104 ? 201310208 ? ...
output:
0 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 1 1 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 1 1 ...
result:
ok Accepted.
Test #29:
score: 20
Accepted
time: 6129ms
memory: 73624kb
input:
28 1000000 ! 98304 ! 17301505 ! 246243328 ? 268427255 ! 103022880 ! 33554432 ? 268288300 ? 66974465 ? 268393616 ! 250662912 ! 148521024 ? 268148687 ? 260046591 ? 268427804 ? 268424330 ! 152322048 ! 268435071 ! 220708864 ! 186187776 ? 268422639 ? 268435287 ? 268421745 ! 249331729 ! 204685312 ! 244465...
output:
0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 1 1 ...
result:
ok Accepted.
Test #30:
score: 20
Accepted
time: 6098ms
memory: 73716kb
input:
28 1000000 ! 102051418 ? 2048 ? 213870324 ! 50323454 ! 16908290 ! 216060049 ! 268237299 ! 265797110 ? 266959613 ! 34131606 ! 215308128 ? 98433979 ! 251658239 ! 0 ! 268434427 ? 21560592 ! 250565469 ? 238864954 ? 3670016 ! 267384827 ! 126104535 ! 169446416 ! 139149481 ? 254782395 ! 1581056 ? 210929166...
output:
0 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0 0 ...
result:
ok Accepted.
Subtask #4:
score: 0
Runtime Error
Test #31:
score: 0
Runtime Error
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:
result:
Subtask #5:
score: 0
Runtime Error
Test #41:
score: 0
Runtime Error
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...