結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー ruthenruthen
提出日時 2022-10-15 00:05:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,521 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 214,456 KB
実行使用メモリ 19,988 KB
最終ジャッジ日時 2024-06-26 18:15:10
合計ジャッジ時間 19,456 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 107 ms
6,944 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 33 ms
6,944 KB
testcase_09 WA -
testcase_10 AC 66 ms
6,944 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 WA -
testcase_20 WA -
testcase_21 AC 60 ms
6,944 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 26 ms
19,860 KB
testcase_53 AC 27 ms
19,988 KB
testcase_54 AC 26 ms
19,988 KB
testcase_55 AC 69 ms
6,940 KB
testcase_56 WA -
testcase_57 AC 67 ms
6,940 KB
testcase_58 AC 30 ms
11,992 KB
testcase_59 AC 391 ms
12,800 KB
testcase_60 AC 27 ms
6,940 KB
testcase_61 WA -
testcase_62 AC 7 ms
6,944 KB
testcase_63 AC 67 ms
6,944 KB
testcase_64 AC 70 ms
6,940 KB
testcase_65 AC 102 ms
6,940 KB
testcase_66 AC 70 ms
6,944 KB
testcase_67 AC 51 ms
6,944 KB
testcase_68 AC 25 ms
6,940 KB
testcase_69 AC 49 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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<unsigned int> st;
    mint1 B1 = 100007;
    mint2 B2 = 10;
    rep(i, N) {
        string S;
        cin >> S;
        int M = (int)S.size();
        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;
        }
        show(h1, p1);
        int seen = 0;
        if (st.find(h1[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];
            show(ch1.val());
            if (st.find(ch1.val()) != st.end()) seen = 1;
        }
        cout << (seen ? "Yes" : "No") << '\n';
        st.insert(h1[M].val());
        show(st);
    }
    return 0;
}
0