結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | kwm_t |
提出日時 | 2022-10-15 17:07:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 856 ms / 3,000 ms |
コード長 | 2,789 bytes |
コンパイル時間 | 2,276 ms |
コンパイル使用メモリ | 206,168 KB |
実行使用メモリ | 54,756 KB |
最終ジャッジ日時 | 2023-09-09 02:49:36 |
合計ジャッジ時間 | 36,576 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
26,800 KB |
testcase_01 | AC | 13 ms
26,868 KB |
testcase_02 | AC | 403 ms
39,600 KB |
testcase_03 | AC | 521 ms
43,196 KB |
testcase_04 | AC | 436 ms
39,196 KB |
testcase_05 | AC | 264 ms
33,508 KB |
testcase_06 | AC | 471 ms
39,932 KB |
testcase_07 | AC | 299 ms
34,084 KB |
testcase_08 | AC | 59 ms
27,524 KB |
testcase_09 | AC | 412 ms
41,448 KB |
testcase_10 | AC | 154 ms
31,684 KB |
testcase_11 | AC | 129 ms
33,268 KB |
testcase_12 | AC | 328 ms
38,108 KB |
testcase_13 | AC | 562 ms
44,952 KB |
testcase_14 | AC | 330 ms
36,408 KB |
testcase_15 | AC | 534 ms
40,740 KB |
testcase_16 | AC | 757 ms
48,256 KB |
testcase_17 | AC | 205 ms
32,724 KB |
testcase_18 | AC | 431 ms
38,396 KB |
testcase_19 | AC | 217 ms
34,420 KB |
testcase_20 | AC | 611 ms
46,252 KB |
testcase_21 | AC | 105 ms
28,336 KB |
testcase_22 | AC | 824 ms
50,288 KB |
testcase_23 | AC | 824 ms
50,104 KB |
testcase_24 | AC | 833 ms
50,068 KB |
testcase_25 | AC | 846 ms
50,256 KB |
testcase_26 | AC | 856 ms
50,100 KB |
testcase_27 | AC | 848 ms
50,244 KB |
testcase_28 | AC | 810 ms
50,136 KB |
testcase_29 | AC | 856 ms
50,096 KB |
testcase_30 | AC | 820 ms
50,224 KB |
testcase_31 | AC | 838 ms
50,116 KB |
testcase_32 | AC | 783 ms
50,100 KB |
testcase_33 | AC | 797 ms
50,092 KB |
testcase_34 | AC | 810 ms
50,116 KB |
testcase_35 | AC | 788 ms
50,312 KB |
testcase_36 | AC | 809 ms
50,104 KB |
testcase_37 | AC | 787 ms
50,380 KB |
testcase_38 | AC | 760 ms
50,164 KB |
testcase_39 | AC | 730 ms
50,324 KB |
testcase_40 | AC | 717 ms
50,088 KB |
testcase_41 | AC | 720 ms
50,108 KB |
testcase_42 | AC | 478 ms
42,560 KB |
testcase_43 | AC | 476 ms
42,572 KB |
testcase_44 | AC | 478 ms
42,612 KB |
testcase_45 | AC | 494 ms
42,440 KB |
testcase_46 | AC | 494 ms
42,608 KB |
testcase_47 | AC | 351 ms
36,172 KB |
testcase_48 | AC | 355 ms
36,176 KB |
testcase_49 | AC | 347 ms
36,240 KB |
testcase_50 | AC | 378 ms
36,176 KB |
testcase_51 | AC | 400 ms
36,184 KB |
testcase_52 | AC | 28 ms
27,504 KB |
testcase_53 | AC | 28 ms
27,684 KB |
testcase_54 | AC | 28 ms
27,508 KB |
testcase_55 | AC | 85 ms
26,976 KB |
testcase_56 | AC | 84 ms
27,024 KB |
testcase_57 | AC | 84 ms
27,044 KB |
testcase_58 | AC | 27 ms
27,564 KB |
testcase_59 | AC | 761 ms
54,756 KB |
testcase_60 | AC | 35 ms
26,800 KB |
testcase_61 | AC | 85 ms
27,056 KB |
testcase_62 | AC | 24 ms
27,652 KB |
testcase_63 | AC | 87 ms
26,828 KB |
testcase_64 | AC | 114 ms
26,880 KB |
testcase_65 | AC | 239 ms
27,028 KB |
testcase_66 | AC | 84 ms
27,036 KB |
testcase_67 | AC | 69 ms
26,884 KB |
testcase_68 | AC | 35 ms
27,044 KB |
testcase_69 | AC | 62 ms
26,984 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]; long long table3[1000006]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; long long mod1 = 1000000007; long long mod2 = 998244353; long long mod3 = 1000000009; int kind = 27; table1[0] = 1, table2[0] = 1, table3[0] = 1; rep2(i, 1, 1000006) { table1[i] = (table1[i - 1] * kind) % mod1; table2[i] = (table2[i - 1] * kind) % mod2; table3[i] = (table3[i - 1] * kind) % mod3; } set<long long>st1, st2, st3; rep(i, n) { string s; cin >> s; long long base1 = 0; long long base2 = 0; long long base3 = 0; rep(j, s.size()) { base1 += table1[j] * (s[j] - 'a' + 1); base1 %= mod1; base2 += table2[j] * (s[j] - 'a' + 1); base2 %= mod2; base3 += table3[j] * (s[j] - 'a' + 1); base3 %= mod3; } bool chk = false; if (st1.count(base1) && st2.count(base2) && st3.count(base3))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; long long val3 = base3; val3 += mod3 - table3[j + 0] * (s[j + 0] - 'a' + 1) % mod3; val3 += mod3 - table3[j + 1] * (s[j + 1] - 'a' + 1) % mod3; val3 += table3[j + 0] * (s[j + 1] - 'a' + 1); val3 += table3[j + 1] * (s[j + 0] - 'a' + 1); val3 %= mod3; if (st1.count(val1) && st2.count(val2) && st3.count(val3))chk = true; } if (chk)cout << "Yes" << endl; else cout << "No" << endl; st1.insert(base1); st2.insert(base2); st3.insert(base3); } return 0; }