結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | Carpenters-Cat |
提出日時 | 2022-10-15 00:13:16 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 955 ms / 3,000 ms |
コード長 | 1,642 bytes |
コンパイル時間 | 2,211 ms |
コンパイル使用メモリ | 210,604 KB |
実行使用メモリ | 20,500 KB |
最終ジャッジ日時 | 2024-06-26 18:18:27 |
合計ジャッジ時間 | 48,602 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
11,136 KB |
testcase_01 | AC | 69 ms
11,344 KB |
testcase_02 | AC | 465 ms
15,780 KB |
testcase_03 | AC | 533 ms
16,020 KB |
testcase_04 | AC | 471 ms
15,900 KB |
testcase_05 | AC | 377 ms
13,440 KB |
testcase_06 | AC | 499 ms
15,776 KB |
testcase_07 | AC | 494 ms
13,340 KB |
testcase_08 | AC | 230 ms
11,700 KB |
testcase_09 | AC | 469 ms
15,904 KB |
testcase_10 | AC | 276 ms
12,416 KB |
testcase_11 | AC | 220 ms
13,440 KB |
testcase_12 | AC | 373 ms
14,360 KB |
testcase_13 | AC | 580 ms
16,528 KB |
testcase_14 | AC | 406 ms
13,976 KB |
testcase_15 | AC | 555 ms
15,692 KB |
testcase_16 | AC | 716 ms
17,172 KB |
testcase_17 | AC | 360 ms
13,440 KB |
testcase_18 | AC | 529 ms
14,368 KB |
testcase_19 | AC | 323 ms
13,348 KB |
testcase_20 | AC | 633 ms
16,784 KB |
testcase_21 | AC | 355 ms
11,776 KB |
testcase_22 | AC | 764 ms
17,684 KB |
testcase_23 | AC | 776 ms
17,680 KB |
testcase_24 | AC | 786 ms
17,684 KB |
testcase_25 | AC | 773 ms
17,652 KB |
testcase_26 | AC | 777 ms
17,684 KB |
testcase_27 | AC | 773 ms
17,676 KB |
testcase_28 | AC | 777 ms
17,560 KB |
testcase_29 | AC | 759 ms
17,552 KB |
testcase_30 | AC | 764 ms
17,560 KB |
testcase_31 | AC | 759 ms
17,556 KB |
testcase_32 | AC | 773 ms
17,680 KB |
testcase_33 | AC | 790 ms
17,688 KB |
testcase_34 | AC | 760 ms
17,680 KB |
testcase_35 | AC | 783 ms
17,684 KB |
testcase_36 | AC | 759 ms
17,684 KB |
testcase_37 | AC | 763 ms
17,688 KB |
testcase_38 | AC | 765 ms
17,552 KB |
testcase_39 | AC | 783 ms
17,552 KB |
testcase_40 | AC | 770 ms
17,556 KB |
testcase_41 | AC | 776 ms
17,548 KB |
testcase_42 | AC | 617 ms
16,020 KB |
testcase_43 | AC | 598 ms
15,940 KB |
testcase_44 | AC | 597 ms
16,024 KB |
testcase_45 | AC | 595 ms
15,992 KB |
testcase_46 | AC | 609 ms
15,892 KB |
testcase_47 | AC | 500 ms
13,848 KB |
testcase_48 | AC | 503 ms
13,984 KB |
testcase_49 | AC | 523 ms
13,860 KB |
testcase_50 | AC | 507 ms
13,860 KB |
testcase_51 | AC | 497 ms
13,852 KB |
testcase_52 | AC | 900 ms
20,004 KB |
testcase_53 | AC | 914 ms
20,028 KB |
testcase_54 | AC | 910 ms
19,992 KB |
testcase_55 | AC | 927 ms
11,328 KB |
testcase_56 | AC | 932 ms
11,192 KB |
testcase_57 | AC | 922 ms
11,236 KB |
testcase_58 | AC | 915 ms
16,544 KB |
testcase_59 | AC | 824 ms
20,500 KB |
testcase_60 | AC | 241 ms
11,244 KB |
testcase_61 | AC | 932 ms
11,380 KB |
testcase_62 | AC | 87 ms
11,636 KB |
testcase_63 | AC | 249 ms
11,392 KB |
testcase_64 | AC | 245 ms
11,140 KB |
testcase_65 | AC | 242 ms
11,392 KB |
testcase_66 | AC | 955 ms
11,408 KB |
testcase_67 | AC | 431 ms
11,264 KB |
testcase_68 | AC | 942 ms
11,392 KB |
testcase_69 | AC | 440 ms
11,264 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; ull const h = (1ull << 61) - 1; ull b; ull Bs[1000010]; ull mpl(ull x, ull b) { ull ret = 0; while (b) { if (b & 1) { ret += x; ret = (ret >= h ? ret - h : ret); } x <<= 1; x = (x >= h ? x - h : x); b >>= 1; } return ret; } int main () { int N; cin >> N; random_device dev; mt19937 mm(dev()); uniform_int_distribution<ull> rd(998244353, (ull)1e15); b = rd(mm); Bs[0] = 1; for (int i = 1; i < 1000010; i ++) { Bs[i] = mpl(Bs[i - 1], b); } unordered_set<ull> st; ull hss[1000010]; for (int i = 0; i < N; i ++) { string s; cin >> s; bool ok = false; ull hs = 0; int n = s.size(); for (int i = 0; i < n; i ++) { hss[i] = mpl(s[i] + 100, Bs[n-i]); hs += hss[i]; hs = (hs >= h ? hs - h : hs); } if (st.find(hs) != st.end()) { cout << "Yes" << endl; continue; } ull hs2; for (int i = 0; i < n; i ++) { hs2 = hs + h - hss[i]; hs2 = (hs2 >= h ? hs2 - h : hs2); hs2 += h - hss[i + 1]; hs2 = (hs2 >= h ? hs2 - h : hs2); hs2 += mpl(s[i] + 100, Bs[n-i-1]); hs2 = (hs2 >= h ? hs2 - h : hs2); hs2 += mpl(s[i+1] + 100, Bs[n-i]); hs2 = (hs2 >= h ? hs2 - h : hs2); ok = ok || (st.find(hs2) != st.end()); } cout << (ok ? "Yes" : "No") << endl; st.emplace(hs); } }