結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | 👑 Nachia |
提出日時 | 2022-10-15 02:59:16 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,766 bytes |
コンパイル時間 | 2,094 ms |
コンパイル使用メモリ | 124,648 KB |
実行使用メモリ | 74,988 KB |
最終ジャッジ日時 | 2023-09-09 02:03:14 |
合計ジャッジ時間 | 27,823 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
26,308 KB |
testcase_01 | AC | 15 ms
26,408 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | AC | 278 ms
34,536 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | AC | 179 ms
31,832 KB |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | AC | 511 ms
68,316 KB |
testcase_43 | AC | 528 ms
68,336 KB |
testcase_44 | AC | 506 ms
68,368 KB |
testcase_45 | AC | 506 ms
68,304 KB |
testcase_46 | AC | 519 ms
68,316 KB |
testcase_47 | AC | 596 ms
71,528 KB |
testcase_48 | AC | 588 ms
71,524 KB |
testcase_49 | AC | 574 ms
71,528 KB |
testcase_50 | AC | 560 ms
71,448 KB |
testcase_51 | AC | 576 ms
71,568 KB |
testcase_52 | AC | 647 ms
74,764 KB |
testcase_53 | AC | 657 ms
74,760 KB |
testcase_54 | AC | 649 ms
74,816 KB |
testcase_55 | AC | 614 ms
74,988 KB |
testcase_56 | AC | 586 ms
74,864 KB |
testcase_57 | AC | 606 ms
74,968 KB |
testcase_58 | AC | 168 ms
60,828 KB |
testcase_59 | AC | 577 ms
64,316 KB |
testcase_60 | RE | - |
testcase_61 | AC | 595 ms
74,892 KB |
testcase_62 | AC | 24 ms
27,976 KB |
testcase_63 | AC | 332 ms
71,856 KB |
testcase_64 | AC | 330 ms
69,840 KB |
testcase_65 | AC | 356 ms
71,420 KB |
testcase_66 | AC | 686 ms
71,540 KB |
testcase_67 | AC | 106 ms
54,444 KB |
testcase_68 | AC | 381 ms
61,044 KB |
testcase_69 | AC | 107 ms
54,572 KB |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <utility> #include <map> #include <set> #include <atcoder/dsu> #include <atcoder/string> using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using u128 = __uint128_t; #define rep(i,n) for(int i=0; i<(int)(n); i++) int main(){ int N; cin >> N; vector<string> S(N); rep(i,N) cin >> S[i]; vector<vector<int>> I(1000001); rep(i,N) I[S[i].size()].push_back(i); vector<int> ans(N, 0); rep(L,I.size()) if(L>=2) if(!I[L].empty()){ string s; for(auto& i : I[L]){ s += S[i].substr(2); s += S[i].substr(0, L-2); } auto sa = atcoder::suffix_array(s); auto lcp = atcoder::lcp_array(s, sa); map<pair<int, int>, int> Q; rep(i,sa.size()){ if(i != 0) if(lcp[i-1] < L-2) Q.clear(); int c = sa[i] / (L*2-4), p = sa[i] % (L*2-4); if(p >= L-1) continue; int si = I[L][c]; int c1 = S[si][p], c2 = S[si][p+1]; pair<int, int> key = { p, max(c1,c2)*1000+min(c1,c2) }; if(Q.count(key)){ int& v = Q[key]; ans[max(v, si)] = 1; v = min(v, si); } else Q.insert({ key, si }); } } rep(L,I.size()) if(L==1){ map<string, int> Q; for(int i : I[L]) /* I[L] sorted */ { if(Q.count(S[i])) ans[i] = 1; else Q[S[i]] = i; } } vector<int> vis(N); rep(i,N){ cout << (ans[i] ? "Yes\n" : "No\n"); } return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;