結果
問題 | No.896 友達以上恋人未満 |
ユーザー | FF256grhy |
提出日時 | 2019-09-28 07:47:14 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,635 bytes |
コンパイル時間 | 1,773 ms |
コンパイル使用メモリ | 169,032 KB |
実行使用メモリ | 81,764 KB |
最終ジャッジ日時 | 2024-10-01 09:12:48 |
合計ジャッジ時間 | 8,878 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:54:44: warning: 'py' may be used uninitialized [-Wmaybe-uninitialized] 54 | LL Y = (i < m ? y[i] : (py * ym + ya) & (MOD - 1)); | ~~~^~~~ main.cpp:51:16: note: 'py' was declared here 51 | LL px, py; | ^~ main.cpp:53:44: warning: 'px' may be used uninitialized [-Wmaybe-uninitialized] 53 | LL X = (i < m ? x[i] : (px * xm + xa) & (MOD - 1)); | ~~~^~~~ main.cpp:51:12: note: 'px' was declared here 51 | LL px, py; | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(LL i = (l) ; i < (r); ++i) #define incII(i, l, r) for(LL i = (l) ; i <= (r); ++i) #define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i) #define decII(i, l, r) for(LL i = (r) ; i >= (l); --i) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() template<typename T> bool setmin (T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template<typename T> bool setmax (T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; } LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); } LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); } template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } #define bit(b, i) (((b) >> (i)) & 1) #define BC __builtin_popcountll #define SC static_cast #define SI(v) SC<int>(v.size()) #define SL(v) SC<LL >(v.size()) #define RF(e, v) for(auto & e: v) #define ef else if #define UR assert(false) // ---- ---- LL m, n, xm, xa, ym, ya, MOD, x[1000], y[1000], a[1000], b[1000], z[(1 << 24) + 1]; int main() { cin >> m >> n >> xm >> xa >> ym >> ya >> MOD; inc(i, m) { cin >> x[i]; } inc(i, m) { cin >> y[i]; } inc(i, m) { cin >> a[i]; } inc(i, m) { cin >> b[i]; } LL px, py; inc(i, n) { LL X = (i < m ? x[i] : (px * xm + xa) & (MOD - 1)); LL Y = (i < m ? y[i] : (py * ym + ya) & (MOD - 1)); z[X] += Y; px = X; py = Y; } inc1(i, MOD) { for(int j = 2 * i; j <= MOD; j += i) { z[i] += z[j]; } } LL sum = 0; inc(i, n) { LL A = (i < m ? a[i] : ((px * xm + xa + MOD - 1) & (MOD - 1)) + 1); LL B = (i < m ? b[i] : ((py * ym + ya + MOD - 1) & (MOD - 1)) + 1); LL ans = z[A] - z[A * B]; if(i < m) { cout << ans << "\n"; } sum ^= ans; px = A; py = B; } cout << sum << "\n"; return 0; }