QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#688414 | #9518. 观虫我 (旧版数据) | peaneval_kala | 0 | 3718ms | 127272kb | C++23 | 8.7kb | 2024-10-30 08:42:48 | 2024-10-30 08:42:48 |
Judging History
answer
#pragma GCC optimize(3, "unroll-loops", "no-stack-protector")
#define atsum(l, r) accumulate(l, r, 0)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int inf = 0x3f3f3f3f;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
inline void chkmin(T &x, T y) { x = min(x, y); }
template <typename T>
inline void chkmax(T &x, T y) { x = max(x, y); }
namespace FastIO
{
// ------------------------------
#define IN_HAS_NEG
#define OUT_HAS_NEG
#define CHK_EOF
#define DISABLE_MMAP
// ------------------------------
#if __cplusplus < 201400
#error Please use C++14 or higher.
#endif
#if __cplusplus > 201700
#define INLINE_V inline
#else
#define INLINE_V
#endif
#if ( defined(LOCAL) || defined (_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifndef DISABLE_MMAP
#include<sys/mman.h>
#endif
#ifdef LOCAL
inline char gc() { return getchar(); }
inline void pc(char c) { putchar(c); }
#else
#ifdef DISABLE_MMAP
INLINE_V constexpr int _READ_SIZE = 1 << 18;
INLINE_V static char _read_buffer[_READ_SIZE], *_read_ptr = nullptr, *_read_ptr_end = nullptr;
inline char gc()
{
if ( __builtin_expect(_read_ptr == _read_ptr_end, false) )
{
_read_ptr = _read_buffer;
_read_ptr_end = _read_buffer + fread(_read_buffer, 1, _READ_SIZE, stdin);
#ifdef CHK_EOF
if ( __builtin_expect(_read_ptr == _read_ptr_end, false) ) return EOF;
#endif
}
return *_read_ptr++;
}
#else
INLINE_V static const char *_read_ptr = (const char *)mmap(nullptr, INT_MAX, 1, 2, 0, 0);
inline char gc() { return *_read_ptr++; }
#endif
INLINE_V constexpr int _WRITE_SIZE = 1 << 18;
INLINE_V static char _write_buffer[_WRITE_SIZE], *_write_ptr = _write_buffer;
inline void pc(char c)
{
*_write_ptr++ = c;
if ( __builtin_expect(_write_buffer + _WRITE_SIZE == _write_ptr, false) )
{
fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout);
_write_ptr = _write_buffer;
}
}
INLINE_V struct _auto_flush
{
~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); }
} _auto_flush;
#endif
#ifdef CHK_EOF
inline bool _isdigit(char c) { return ( c & 16 ) && c != EOF; }
inline bool _isgraph(char c) { return c > 32 && c != EOF; }
#else
inline bool _isdigit(char c) { return c & 16; }
inline bool _isgraph(char c) { return c > 32; }
#endif
template < class T >
INLINE_V constexpr bool _is_integer = numeric_limits < T >::is_integer;
template < class T >
INLINE_V constexpr bool _is_signed = numeric_limits < T >::is_signed;
template < class T >
INLINE_V constexpr bool _is_unsigned = _is_integer < T > && !_is_signed < T >;
template <> INLINE_V constexpr bool _is_integer < __int128 > = true;
template <> INLINE_V constexpr bool _is_integer < __uint128_t > = true;
template <> INLINE_V constexpr bool _is_signed < __int128 > = true;
template <> INLINE_V constexpr bool _is_unsigned < __uint128_t > = true;
#undef INLINE_V
inline void read(char &c) { do c = gc(); while ( !_isgraph(c) ); }
inline void read_cstr(char *s)
{
char c = gc(); while ( !_isgraph(c) ) c = gc();
while ( _isgraph(c) ) *s++ = c, c = gc();
*s = 0;
}
inline void read(string &s)
{
char c = gc(); s.clear(); while ( !_isgraph(c) ) c = gc();
while ( _isgraph(c) ) s.push_back(c), c = gc();
}
#ifdef IN_HAS_NEG
template < class T, enable_if_t < _is_signed < T >, int > = 0 >
inline void read(T &x)
{
char c = gc(); bool f = true; x = 0;
while ( !_isdigit(c) ) { if ( c == 45 ) f = false; c = gc(); }
if ( f ) while ( _isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
else while ( _isdigit(c) ) x = x * 10 - ( c & 15 ), c = gc();
}
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
#else
template < class T, enable_if_t < _is_integer < T >, int > = 0 >
#endif
inline void read(T &x)
{
char c = gc(); while ( !_isdigit(c) ) c = gc();
x = 0; while ( _isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
}
inline void write(char c) { pc(c); }
inline void write_cstr(const char *s) { while ( *s ) pc(*s++); }
inline void write(const string &s) { for ( char c : s ) pc(c); }
#ifdef OUT_HAS_NEG
template < class T, enable_if_t < _is_signed < T >, int > = 0 >
inline void write(T x)
{
char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
if ( x >= 0 ) do buffer[digits++] = ( x % 10 ) | 48, x /= 10; while ( x );
else { pc(45); do buffer[digits++] = -( x % 10 ) | 48, x /= 10; while ( x ); }
while ( digits ) pc(buffer[--digits]);
}
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
#else
template < class T, enable_if_t < _is_integer < T >, int > = 0 >
#endif
inline void write(T x)
{
char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
do buffer[digits++] = ( x % 10 ) | 48, x /= 10; while ( x );
while ( digits ) pc(buffer[--digits]);
}
template < int N > struct _tuple_io_helper
{
template < class ...T >
static inline void _read(tuple < T... > &x)
{ _tuple_io_helper < N - 1 >::_read(x), read(get < N - 1 > (x)); }
template < class ...T >
static inline void _write(const tuple < T... > &x)
{ _tuple_io_helper < N - 1 >::_write(x), pc(32), write(get < N - 1 > (x)); }
};
template <> struct _tuple_io_helper < 1 >
{
template < class ...T >
static inline void _read(tuple < T... > &x) { read(get < 0 > (x)); }
template < class ...T >
static inline void _write(const tuple < T... > &x) { write(get < 0 > (x)); }
};
template < class ...T >
inline void read(tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_read(x); }
template < class ...T >
inline void write(const tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_write(x); }
template < class T1, class T2 >
inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
template < class T1, class T2 >
inline void write(const pair < T1, T2 > &x) { write(x.first), pc(32), write(x.second); }
template < class T1, class ...T2 >
inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
template < class ...T >
inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
template < class T1, class ...T2 >
inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
template < class ...T >
inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
template < class T >
inline void print(const T &x) { write(x); }
inline void print_cstr(const char *x) { write_cstr(x); }
template < class T1, class ...T2 >
inline void print(const T1 &x, const T2 &...y) { print(x), pc(32), print(y...); }
template < class ...T >
inline void print_cstr(const char *x, const T *...y) { print_cstr(x), pc(32), print_cstr(y...); }
inline void println() { pc(10); }
inline void println_cstr() { pc(10); }
template < class ...T >
inline void println(const T &...x) { print(x...), pc(10); }
template < class ...T >
inline void println_cstr(const T *...x) { print_cstr(x...), pc(10); }
}
using namespace FastIO;
template <typename T>
inline void clear(T &x) {
T y;
swap(x, y);
}
const int N = 1e6 + 10;
ull qwq[4][256][(N + 128) >> 6], cel[(N + 128) >> 6];
int n, q, cc = 0;
int main() {
read(n, q);
while (q--) {
char op;
read(op);
if (op == '!') {
unsigned u;
read(u);
int k = cc >> 6;
for (int p = 0; p < 4; p++)
for (int q = 0; q < 256; q++)
if ((((u >> (p << 3)) & 255) | q) == q) qwq[p][q][cc >> 6] |= 1ull << (cc & 63);
cc++;
} else {
unsigned u;
read(u);
for (int i = 0; i <= (cc >> 6); i++) cel[i] = ~0;
for (int p = 0; p < 4; p++) {
unsigned a = (u >> (p << 3)) & 255;
ull *t = qwq[p][a];
for (int c = 0; c <= (cc >> 6); c++) cel[c] &= t[c];
}
ull res = 0;
for (int i = 0; i <= (cc >> 6); i++) res ^= cel[i];
println(__builtin_parity(res));
}
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 3516ms
memory: 125284kb
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 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 ...
result:
wrong answer Wrong answer at operation #87: Incorrect answer.
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 3497ms
memory: 127272kb
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 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 1 1 1 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 ...
result:
wrong answer Wrong answer at operation #70: Incorrect answer.
Subtask #3:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 3510ms
memory: 127204kb
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 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 0 1 1 ...
result:
wrong answer Wrong answer at operation #67: Incorrect answer.
Subtask #4:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 3591ms
memory: 122488kb
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 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 1 1 0 1 0 0 ...
result:
wrong answer Wrong answer at operation #70: Incorrect answer.
Subtask #5:
score: 0
Wrong Answer
Test #41:
score: 0
Wrong Answer
time: 3718ms
memory: 125388kb
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 0 0 0 1 1 1 0 1 1 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 1 0 1 ...
result:
wrong answer Wrong answer at operation #81: Incorrect answer.