結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | ruthen |
提出日時 | 2022-10-15 00:02:49 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,738 bytes |
コンパイル時間 | 2,989 ms |
コンパイル使用メモリ | 213,544 KB |
実行使用メモリ | 19,700 KB |
最終ジャッジ日時 | 2023-09-09 00:59:50 |
合計ジャッジ時間 | 23,501 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,384 KB |
testcase_01 | AC | 1 ms
4,384 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 203 ms
5,828 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 130 ms
5,504 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
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 | AC | 358 ms
8,552 KB |
testcase_43 | AC | 390 ms
8,472 KB |
testcase_44 | AC | 305 ms
8,552 KB |
testcase_45 | AC | 296 ms
8,468 KB |
testcase_46 | AC | 302 ms
8,552 KB |
testcase_47 | AC | 240 ms
6,556 KB |
testcase_48 | AC | 241 ms
6,468 KB |
testcase_49 | AC | 241 ms
6,556 KB |
testcase_50 | AC | 245 ms
6,428 KB |
testcase_51 | AC | 244 ms
6,424 KB |
testcase_52 | AC | 37 ms
19,644 KB |
testcase_53 | AC | 38 ms
19,700 KB |
testcase_54 | AC | 38 ms
19,680 KB |
testcase_55 | AC | 94 ms
4,380 KB |
testcase_56 | AC | 92 ms
4,380 KB |
testcase_57 | AC | 93 ms
4,380 KB |
testcase_58 | AC | 40 ms
11,956 KB |
testcase_59 | AC | 436 ms
12,648 KB |
testcase_60 | WA | - |
testcase_61 | AC | 93 ms
4,380 KB |
testcase_62 | AC | 8 ms
4,380 KB |
testcase_63 | AC | 90 ms
4,384 KB |
testcase_64 | AC | 93 ms
4,380 KB |
testcase_65 | AC | 130 ms
4,380 KB |
testcase_66 | AC | 93 ms
4,380 KB |
testcase_67 | AC | 70 ms
4,380 KB |
testcase_68 | AC | 37 ms
4,384 KB |
testcase_69 | AC | 66 ms
4,380 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef _RUTHEN #include <debug.hpp> #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template <class T> using V = vector<T>; #include <atcoder/modint> using mint1 = atcoder::modint1000000007; using mint2 = atcoder::modint998244353; ostream &operator<<(ostream &os, const mint1 &p) { return os << p.val(); } ostream &operator<<(ostream &os, const mint2 &p) { return os << p.val(); } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; set<pair<unsigned int, unsigned int>> st; mint1 B1 = 100007; mint2 B2 = 100007; rep(i, N) { string S; cin >> S; int M = (int)S.size(); for (auto &c : S) c -= 'a'; V<mint1> h1(M + 1), p1(M + 1, 1); V<mint2> h2(M + 1), p2(M + 1, 1); rep(i, M) { h1[i + 1] = h1[i] * B1 + S[i]; h2[i + 1] = h2[i] * B2 + S[i]; p1[i + 1] = p1[i] * B1; p2[i + 1] = p2[i] * B2; } int seen = 0; if (st.find({h1[M].val(), h2[M].val()}) != st.end()) seen = 1; rep(i, M - 1) { mint1 ch1 = h1[M]; ch1 -= h1[i + 2] * p1[M - 2 - i]; ch1 += h1[i] * p1[M - i]; ch1 += S[i + 1] * p1[M - i - 1] + S[i] * p1[M - 2 - i]; mint2 ch2 = h2[M]; ch2 -= h2[i + 2] * p2[M - 2 - i]; ch2 += h2[i] * p2[M - i]; ch2 += S[i + 1] * p2[M - i - 1] + S[i] * p2[M - 2 - i]; if (st.find({ch1.val(), ch2.val()}) != st.end()) seen = 1; } cout << (seen ? "Yes" : "No") << '\n'; st.insert({h1[M].val(), h2[M].val()}); } return 0; }