Please sign in first.
Submission #39292065
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
namespace Fread { const int SIZE = (1 << 18); char buf[SIZE], *p1 = buf, *p2 = buf; inline char getchar() {return (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, SIZE, stdin), p1 == p2) ? EOF : *p1++);} }
namespace Fwrite { const int SIZE = (1 << 18); char buf[SIZE], *S = buf, *T = buf+SIZE; inline void flush(){ fwrite(buf, 1, S-buf, stdout), S = buf; } struct NTR{ ~NTR() { flush(); } }ztr;inline void putchar(char c){ *S++ = c; if(S == T) flush(); } }
#ifdef ONLINE_JUDGE
#define getchar Fread::getchar
#define putchar Fwrite::putchar
#endif
namespace Fastio{
struct Reader{ template <typename T> Reader & operator >> (T & x) {char c = getchar(); bool f = false;while (c < '0' or c > '9') { if (c == '-') f = true;c = getchar();} x = 0;while(c >= '0' and c <= '9'){x = (x<<1)+(x<<3)+(c^48);c = getchar();} if (f) x = -x;return *this;}Reader&operator>>(char&c){ c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){ int len=0;char c=getchar(); while(c=='\n'||c==' '||c=='\r')c=getchar(); while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar(); str[len]='\0'; return *this;}Reader(){}}cin;
struct Writer{ template <typename T> Writer & operator << (T x) {if(x == 0) return putchar('0'), *this;if(x < 0) putchar('-'), x = -x;static int sta[45], top = 0; while (x) sta[++top] = x %10, x /= 10; while (top) putchar(sta[top] + '0'), --top; return *this;} Writer&operator<<(char c){putchar(c);return*this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer(){}}cout;
} const char endl = '\n';
#define cin Fastio :: cin
#define cout Fastio :: cout
#define inline __attribute__((__gnu_inline__, __always_inline__, __artificial__)) inline
template<typename T1, typename T2> T1 max(T1 a, T2 b) { return a > b ? a : b; }
template<typename T1, typename T2> T1 min(T1 a, T2 b) { return a < b ? a : b; }
using ll = long long;
#define multi int T; cin >> T; while ( T -- )
#define timer cerr << 1. * clock() / CLOCKS_PER_SEC << '\n';
#define iot ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define rep(i,s,t) for (register int i = (s), i##_ = (t) + 1; i < i##_; ++ i)
#define pre(i,s,t) for (register int i = (s), i##_ = (t) - 1; i > i##_; -- i)
#define eb emplace_back
#define pb pop_back
const int N = 1e6 + 10, B = 10000;
const int inf = 0x3f3f3f3f;
int n, X, Y, Z;
ll m;
bitset<B> a, b;
bool f[31][2];
inline int calc(ll v) {
if (m <= B) {
a.reset(); a.set(0);
for (int i = 1; i <= n; i <<= 1) if (n & i) {
b.reset(); rep(j,0,m - 1) if (a[j]) b.flip(j), b.flip((i + j) % m), b.flip((j - i % m + m) % m); a = b;
} return a[v % m];
} else {
int ret = 0; v = (v + n) % m;
for (; v <= (n << 1); v += m) {
rep(i,0,30) f[i][0] = f[i][1] = 0;
f[30][v >> 30 & 1] = 1;
pre(i,29,0) {
int now = n >> i & 1;
rep(j,0,now) rep(k,0,now - j)
f[i][(v >> i & 1) ^ k] ^= f[i + 1][(now - j - k) | ((v >> i & 1) < k)];
} ret ^= f[0][0];
} return ret;
}
}
signed main() {
multi {
cin >> n >> X >> Y >> Z; m = 1ll * X + Y + Z + 3;
cout << (calc(X + 1) ^ calc(Y + 1) ^ calc(Z + 1) ^ 1) << '\n';
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | F - Again ABC String |
| User | joke3579 |
| Language | C++ (GCC 9.2.1) |
| Score | 1100 |
| Code Size | 3470 Byte |
| Status | AC |
| Exec Time | 267 ms |
| Memory | 3640 KiB |
Compile Error
./Main.cpp: In function ‘int calc(ll)’:
./Main.cpp:38:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
38 | b.reset(); rep(j,0,m - 1) if (a[j]) b.flip(j), b.flip((i + j) % m), b.flip((j - i % m + m) % m); a = b;
| ^
./Main.cpp:23:38: note: in definition of macro ‘rep’
23 | #define rep(i,s,t) for (register int i = (s), i##_ = (t) + 1; i < i##_; ++ i)
| ^
./Main.cpp:38:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
38 | b.reset(); rep(j,0,m - 1) if (a[j]) b.flip(j), b.flip((i + j) % m), b.flip((j - i % m + m) % m); a = b;
| ^
./Main.cpp:23:47: note: in definition of macro ‘rep’
23 | #define rep(i,s,t) for (register int i = (s), i##_ = (t) + 1; i < i##_; ++ i)
| ^
./Main.cpp:43:17: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
43 | rep(i,0,30) f[i][0] = f[i][1] = 0;
| ^
./Main.cpp:23:38: note: in definition of macro ‘rep’
23 | #define rep(i,s,t) for (register int i = (s), i##_ = (t) + 1; i < i##_; ++ i)
| ^
./Main.cpp:43:17: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
43 | rep(i,0,30) f[i][0] = f[i][1] = 0;
| ^
./Main.cpp:23:47: note: in definition of macro ‘rep’
23 | #define rep(i,s,t) for (register int i = (s), i##_ = (t) + 1; i < i##_; ++ i)
| ^
./Main.cpp:45:17: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
45 | pre(i,29,0) {
| ^
./Main.cpp:24:38: note: in definition of macro ‘pre’
24 | #define pre(i,s,t) for (register int i = (s), i##_ = (t) - 1; i > i##_; -- i)
| ...
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 1100 / 1100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_100.txt, test_101.txt, test_102.txt, test_103.txt, test_104.txt, test_105.txt, test_106.txt, test_107.txt, test_108.txt, test_109.txt, test_11.txt, test_110.txt, test_111.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt, test_71.txt, test_72.txt, test_73.txt, test_74.txt, test_75.txt, test_76.txt, test_77.txt, test_78.txt, test_79.txt, test_80.txt, test_81.txt, test_82.txt, test_83.txt, test_84.txt, test_85.txt, test_86.txt, test_87.txt, test_88.txt, test_89.txt, test_90.txt, test_91.txt, test_92.txt, test_93.txt, test_94.txt, test_95.txt, test_96.txt, test_97.txt, test_98.txt, test_99.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 8 ms | 3524 KiB |
| example_01.txt | AC | 2 ms | 3452 KiB |
| test_00.txt | AC | 3 ms | 3540 KiB |
| test_01.txt | AC | 2 ms | 3444 KiB |
| test_02.txt | AC | 2 ms | 3632 KiB |
| test_03.txt | AC | 2 ms | 3444 KiB |
| test_04.txt | AC | 2 ms | 3544 KiB |
| test_05.txt | AC | 2 ms | 3452 KiB |
| test_06.txt | AC | 1 ms | 3612 KiB |
| test_07.txt | AC | 3 ms | 3560 KiB |
| test_08.txt | AC | 2 ms | 3460 KiB |
| test_09.txt | AC | 2 ms | 3384 KiB |
| test_10.txt | AC | 261 ms | 3440 KiB |
| test_100.txt | AC | 4 ms | 3608 KiB |
| test_101.txt | AC | 6 ms | 3408 KiB |
| test_102.txt | AC | 5 ms | 3408 KiB |
| test_103.txt | AC | 5 ms | 3628 KiB |
| test_104.txt | AC | 8 ms | 3440 KiB |
| test_105.txt | AC | 9 ms | 3444 KiB |
| test_106.txt | AC | 2 ms | 3624 KiB |
| test_107.txt | AC | 2 ms | 3632 KiB |
| test_108.txt | AC | 2 ms | 3464 KiB |
| test_109.txt | AC | 2 ms | 3564 KiB |
| test_11.txt | AC | 262 ms | 3544 KiB |
| test_110.txt | AC | 2 ms | 3612 KiB |
| test_111.txt | AC | 4 ms | 3388 KiB |
| test_12.txt | AC | 259 ms | 3404 KiB |
| test_13.txt | AC | 256 ms | 3388 KiB |
| test_14.txt | AC | 263 ms | 3560 KiB |
| test_15.txt | AC | 265 ms | 3464 KiB |
| test_16.txt | AC | 259 ms | 3484 KiB |
| test_17.txt | AC | 267 ms | 3560 KiB |
| test_18.txt | AC | 254 ms | 3628 KiB |
| test_19.txt | AC | 256 ms | 3488 KiB |
| test_20.txt | AC | 2 ms | 3560 KiB |
| test_21.txt | AC | 2 ms | 3484 KiB |
| test_22.txt | AC | 2 ms | 3628 KiB |
| test_23.txt | AC | 2 ms | 3572 KiB |
| test_24.txt | AC | 2 ms | 3384 KiB |
| test_25.txt | AC | 2 ms | 3560 KiB |
| test_26.txt | AC | 5 ms | 3440 KiB |
| test_27.txt | AC | 2 ms | 3532 KiB |
| test_28.txt | AC | 4 ms | 3452 KiB |
| test_29.txt | AC | 2 ms | 3404 KiB |
| test_30.txt | AC | 71 ms | 3608 KiB |
| test_31.txt | AC | 62 ms | 3532 KiB |
| test_32.txt | AC | 67 ms | 3608 KiB |
| test_33.txt | AC | 72 ms | 3628 KiB |
| test_34.txt | AC | 66 ms | 3608 KiB |
| test_35.txt | AC | 67 ms | 3440 KiB |
| test_36.txt | AC | 75 ms | 3388 KiB |
| test_37.txt | AC | 98 ms | 3480 KiB |
| test_38.txt | AC | 79 ms | 3632 KiB |
| test_39.txt | AC | 70 ms | 3576 KiB |
| test_40.txt | AC | 5 ms | 3448 KiB |
| test_41.txt | AC | 2 ms | 3612 KiB |
| test_42.txt | AC | 2 ms | 3408 KiB |
| test_43.txt | AC | 2 ms | 3540 KiB |
| test_44.txt | AC | 2 ms | 3560 KiB |
| test_45.txt | AC | 2 ms | 3460 KiB |
| test_46.txt | AC | 3 ms | 3560 KiB |
| test_47.txt | AC | 2 ms | 3612 KiB |
| test_48.txt | AC | 2 ms | 3444 KiB |
| test_49.txt | AC | 2 ms | 3612 KiB |
| test_50.txt | AC | 2 ms | 3384 KiB |
| test_51.txt | AC | 2 ms | 3408 KiB |
| test_52.txt | AC | 2 ms | 3560 KiB |
| test_53.txt | AC | 2 ms | 3484 KiB |
| test_54.txt | AC | 2 ms | 3524 KiB |
| test_55.txt | AC | 3 ms | 3612 KiB |
| test_56.txt | AC | 2 ms | 3544 KiB |
| test_57.txt | AC | 2 ms | 3556 KiB |
| test_58.txt | AC | 3 ms | 3484 KiB |
| test_59.txt | AC | 3 ms | 3540 KiB |
| test_60.txt | AC | 2 ms | 3460 KiB |
| test_61.txt | AC | 2 ms | 3404 KiB |
| test_62.txt | AC | 2 ms | 3632 KiB |
| test_63.txt | AC | 2 ms | 3452 KiB |
| test_64.txt | AC | 2 ms | 3452 KiB |
| test_65.txt | AC | 3 ms | 3484 KiB |
| test_66.txt | AC | 3 ms | 3536 KiB |
| test_67.txt | AC | 2 ms | 3640 KiB |
| test_68.txt | AC | 3 ms | 3572 KiB |
| test_69.txt | AC | 2 ms | 3444 KiB |
| test_70.txt | AC | 4 ms | 3560 KiB |
| test_71.txt | AC | 3 ms | 3480 KiB |
| test_72.txt | AC | 2 ms | 3404 KiB |
| test_73.txt | AC | 5 ms | 3544 KiB |
| test_74.txt | AC | 2 ms | 3612 KiB |
| test_75.txt | AC | 2 ms | 3564 KiB |
| test_76.txt | AC | 2 ms | 3632 KiB |
| test_77.txt | AC | 2 ms | 3608 KiB |
| test_78.txt | AC | 2 ms | 3540 KiB |
| test_79.txt | AC | 2 ms | 3556 KiB |
| test_80.txt | AC | 3 ms | 3460 KiB |
| test_81.txt | AC | 2 ms | 3540 KiB |
| test_82.txt | AC | 2 ms | 3452 KiB |
| test_83.txt | AC | 1 ms | 3636 KiB |
| test_84.txt | AC | 2 ms | 3556 KiB |
| test_85.txt | AC | 2 ms | 3632 KiB |
| test_86.txt | AC | 2 ms | 3560 KiB |
| test_87.txt | AC | 2 ms | 3480 KiB |
| test_88.txt | AC | 2 ms | 3540 KiB |
| test_89.txt | AC | 1 ms | 3560 KiB |
| test_90.txt | AC | 2 ms | 3460 KiB |
| test_91.txt | AC | 3 ms | 3544 KiB |
| test_92.txt | AC | 2 ms | 3612 KiB |
| test_93.txt | AC | 2 ms | 3564 KiB |
| test_94.txt | AC | 2 ms | 3564 KiB |
| test_95.txt | AC | 3 ms | 3392 KiB |
| test_96.txt | AC | 2 ms | 3628 KiB |
| test_97.txt | AC | 4 ms | 3528 KiB |
| test_98.txt | AC | 2 ms | 3556 KiB |
| test_99.txt | AC | 2 ms | 3556 KiB |