結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | kwm_t |
提出日時 | 2022-10-15 17:04:15 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,308 bytes |
コンパイル時間 | 2,162 ms |
コンパイル使用メモリ | 209,048 KB |
実行使用メモリ | 37,660 KB |
最終ジャッジ日時 | 2024-06-26 20:02:13 |
合計ジャッジ時間 | 25,168 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
18,940 KB |
testcase_01 | AC | 11 ms
18,972 KB |
testcase_02 | AC | 245 ms
27,292 KB |
testcase_03 | AC | 297 ms
29,860 KB |
testcase_04 | AC | 252 ms
27,164 KB |
testcase_05 | AC | 158 ms
23,332 KB |
testcase_06 | AC | 270 ms
27,680 KB |
testcase_07 | AC | 205 ms
24,004 KB |
testcase_08 | AC | 44 ms
19,472 KB |
testcase_09 | AC | 247 ms
28,528 KB |
testcase_10 | AC | 104 ms
22,188 KB |
testcase_11 | AC | 85 ms
23,332 KB |
testcase_12 | AC | 191 ms
26,488 KB |
testcase_13 | AC | 331 ms
31,120 KB |
testcase_14 | AC | 194 ms
25,456 KB |
testcase_15 | AC | 295 ms
28,372 KB |
testcase_16 | AC | 437 ms
33,236 KB |
testcase_17 | AC | 136 ms
22,972 KB |
testcase_18 | AC | 252 ms
26,780 KB |
testcase_19 | AC | 135 ms
24,092 KB |
testcase_20 | AC | 361 ms
31,868 KB |
testcase_21 | AC | 78 ms
20,104 KB |
testcase_22 | AC | 468 ms
34,480 KB |
testcase_23 | AC | 466 ms
34,616 KB |
testcase_24 | AC | 463 ms
34,628 KB |
testcase_25 | AC | 494 ms
34,584 KB |
testcase_26 | AC | 473 ms
34,656 KB |
testcase_27 | AC | 497 ms
34,596 KB |
testcase_28 | AC | 471 ms
34,616 KB |
testcase_29 | WA | - |
testcase_30 | AC | 489 ms
34,528 KB |
testcase_31 | AC | 499 ms
34,492 KB |
testcase_32 | AC | 521 ms
34,632 KB |
testcase_33 | AC | 515 ms
34,596 KB |
testcase_34 | AC | 503 ms
34,532 KB |
testcase_35 | AC | 504 ms
34,640 KB |
testcase_36 | AC | 493 ms
34,520 KB |
testcase_37 | WA | - |
testcase_38 | AC | 482 ms
34,596 KB |
testcase_39 | AC | 476 ms
34,652 KB |
testcase_40 | AC | 497 ms
34,480 KB |
testcase_41 | AC | 451 ms
34,564 KB |
testcase_42 | AC | 320 ms
29,396 KB |
testcase_43 | AC | 319 ms
29,468 KB |
testcase_44 | AC | 315 ms
29,420 KB |
testcase_45 | AC | 336 ms
29,384 KB |
testcase_46 | AC | 327 ms
29,536 KB |
testcase_47 | AC | 247 ms
25,264 KB |
testcase_48 | AC | 254 ms
25,340 KB |
testcase_49 | AC | 256 ms
25,188 KB |
testcase_50 | AC | 256 ms
25,336 KB |
testcase_51 | AC | 252 ms
25,272 KB |
testcase_52 | AC | 24 ms
19,936 KB |
testcase_53 | AC | 25 ms
19,936 KB |
testcase_54 | AC | 25 ms
19,932 KB |
testcase_55 | AC | 81 ms
19,132 KB |
testcase_56 | AC | 82 ms
19,176 KB |
testcase_57 | AC | 82 ms
19,180 KB |
testcase_58 | AC | 26 ms
19,804 KB |
testcase_59 | AC | 534 ms
37,660 KB |
testcase_60 | AC | 29 ms
18,960 KB |
testcase_61 | AC | 82 ms
19,132 KB |
testcase_62 | AC | 18 ms
19,552 KB |
testcase_63 | AC | 77 ms
19,084 KB |
testcase_64 | AC | 89 ms
19,088 KB |
testcase_65 | AC | 164 ms
19,224 KB |
testcase_66 | AC | 80 ms
19,188 KB |
testcase_67 | AC | 54 ms
19,076 KB |
testcase_68 | AC | 31 ms
19,100 KB |
testcase_69 | AC | 49 ms
18,948 KB |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define endl "\n" #define P pair<int,int> template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } long long table1[1000006]; long long table2[1000006]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; long long mod1 = 1000000007; long long mod2 = 998244353; int kind = 27; //vector<long long>table1(1000006), table2(100006); table1[0] = 1, table2[0] = 1; rep2(i, 1, 1000006) { table1[i] = (table1[i - 1] * kind) % mod1; table2[i] = (table2[i - 1] * kind) % mod2; } set<long long>st1, st2; rep(i, n) { string s; cin >> s; long long base1 = 0; long long base2 = 0; rep(j, s.size()) { base1 += table1[j] * (s[j] - 'a' + 1); base1 %= mod1; base2 += table2[j] * (s[j] - 'a' + 1); base2 %= mod2; } bool chk = false; if (st1.count(base1) && st2.count(base2))chk = true; rep(j, s.size() - 1) { long long val1 = base1; val1 += mod1 - table1[j + 0] * (s[j + 0] - 'a' + 1) % mod1; val1 += mod1 - table1[j + 1] * (s[j + 1] - 'a' + 1) % mod1; val1 += table1[j + 0] * (s[j + 1] - 'a' + 1); val1 += table1[j + 1] * (s[j + 0] - 'a' + 1); val1 %= mod1; long long val2 = base2; val2 += mod2 - table2[j + 0] * (s[j + 0] - 'a' + 1) % mod2; val2 += mod2 - table2[j + 1] * (s[j + 1] - 'a' + 1) % mod2; val2 += table2[j + 0] * (s[j + 1] - 'a' + 1); val2 += table2[j + 1] * (s[j + 0] - 'a' + 1); val2 %= mod2; if (st1.count(val1) && st2.count(val2))chk = true; } if (chk)cout << "Yes" << endl; else cout << "No" << endl; st1.insert(base1); st2.insert(base2); } return 0; }