結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | kwm_t |
提出日時 | 2022-10-15 17:15:45 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,138 bytes |
コンパイル時間 | 2,693 ms |
コンパイル使用メモリ | 208,240 KB |
実行使用メモリ | 20,840 KB |
最終ジャッジ日時 | 2023-09-09 02:52:37 |
合計ジャッジ時間 | 26,923 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
11,540 KB |
testcase_01 | AC | 10 ms
11,552 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 41 ms
11,792 KB |
testcase_09 | WA | - |
testcase_10 | AC | 88 ms
13,124 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 124 ms
14,068 KB |
testcase_20 | WA | - |
testcase_21 | AC | 69 ms
12,180 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | AC | 80 ms
12,500 KB |
testcase_53 | AC | 81 ms
12,260 KB |
testcase_54 | AC | 81 ms
12,248 KB |
testcase_55 | AC | 140 ms
11,756 KB |
testcase_56 | AC | 140 ms
11,696 KB |
testcase_57 | AC | 139 ms
11,624 KB |
testcase_58 | AC | 81 ms
12,292 KB |
testcase_59 | AC | 552 ms
20,840 KB |
testcase_60 | AC | 38 ms
11,572 KB |
testcase_61 | AC | 141 ms
11,680 KB |
testcase_62 | AC | 17 ms
11,780 KB |
testcase_63 | AC | 136 ms
11,620 KB |
testcase_64 | AC | 140 ms
11,556 KB |
testcase_65 | AC | 175 ms
11,880 KB |
testcase_66 | AC | 139 ms
11,648 KB |
testcase_67 | AC | 95 ms
11,592 KB |
testcase_68 | AC | 84 ms
11,640 KB |
testcase_69 | AC | 92 ms
11,636 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 table[3][1000006]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<long long>mod; //mod.push_back(998244353); //mod.push_back(1000000007); mod.push_back(1000000009); int sz = mod.size(); int base = 998244353; rep(i, sz)table[i][0] = 1; rep2(i, 1, 1000006) { rep(j, sz) table[j][i] = (table[j][i - 1] * base) % mod[j]; } vector<set<long long>>st(sz); rep(i, n) { string s; cin >> s; vector<long long>val(sz); rep(j, s.size()) { rep(k, sz) { val[k] += table[k][j] * (s[j] - 'a' + 1); val[k] %= mod[k]; } } bool chk = false; { int cnt = 0; rep(j, sz)if (st[j].count(val[j]))cnt++; if (cnt == sz)chk = true; } rep(j, s.size() - 1) { vector<long long>subval(sz); rep(k, sz) { subval[k] = val[k]; subval[k] += mod[k] - table[k][j + 0] * (s[j + 0] - 'a' + 1) % mod[k]; subval[k] += mod[k] - table[k][j + 1] * (s[j + 1] - 'a' + 1) % mod[k]; subval[k] += table[k][j + 0] * (s[j + 1] - 'a' + 1); subval[k] += table[k][j + 1] * (s[j + 0] - 'a' + 1); subval[k] %= mod[k]; } int cnt = 0; rep(j, sz)if (st[j].count(subval[j]))cnt++; if (cnt == sz)chk = true; } if (chk)cout << "Yes" << endl; else cout << "No" << endl; rep(j, sz)st[j].insert(val[j]); } return 0; }