結果
| 問題 | 
                            No.2102 [Cherry Alpha *] Conditional Reflection
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-10-15 00:05:47 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,521 bytes | 
| コンパイル時間 | 2,457 ms | 
| コンパイル使用メモリ | 205,724 KB | 
| 最終ジャッジ日時 | 2025-02-08 05:16:15 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 WA * 48 | 
ソースコード
#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;
}