結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | SSRS |
提出日時 | 2022-10-14 22:33:15 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,425 ms / 3,000 ms |
コード長 | 1,736 bytes |
コンパイル時間 | 2,004 ms |
コンパイル使用メモリ | 176,912 KB |
実行使用メモリ | 57,228 KB |
最終ジャッジ日時 | 2024-06-26 15:57:54 |
合計ジャッジ時間 | 71,531 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 643 ms
24,832 KB |
testcase_03 | AC | 870 ms
33,960 KB |
testcase_04 | AC | 666 ms
24,448 KB |
testcase_05 | AC | 426 ms
14,956 KB |
testcase_06 | AC | 730 ms
25,856 KB |
testcase_07 | AC | 1,145 ms
47,232 KB |
testcase_08 | AC | 188 ms
7,384 KB |
testcase_09 | AC | 899 ms
37,632 KB |
testcase_10 | AC | 271 ms
11,136 KB |
testcase_11 | AC | 272 ms
15,488 KB |
testcase_12 | AC | 559 ms
22,868 KB |
testcase_13 | AC | 1,101 ms
42,876 KB |
testcase_14 | AC | 537 ms
19,456 KB |
testcase_15 | AC | 800 ms
27,392 KB |
testcase_16 | AC | 1,232 ms
43,136 KB |
testcase_17 | AC | 654 ms
31,616 KB |
testcase_18 | AC | 1,107 ms
46,080 KB |
testcase_19 | AC | 358 ms
15,588 KB |
testcase_20 | AC | 1,162 ms
45,696 KB |
testcase_21 | AC | 317 ms
9,908 KB |
testcase_22 | AC | 1,390 ms
49,024 KB |
testcase_23 | AC | 1,397 ms
49,152 KB |
testcase_24 | AC | 1,401 ms
49,152 KB |
testcase_25 | AC | 1,378 ms
49,152 KB |
testcase_26 | AC | 1,371 ms
49,244 KB |
testcase_27 | AC | 1,364 ms
49,152 KB |
testcase_28 | AC | 1,364 ms
49,016 KB |
testcase_29 | AC | 1,369 ms
49,044 KB |
testcase_30 | AC | 1,341 ms
49,152 KB |
testcase_31 | AC | 1,370 ms
49,020 KB |
testcase_32 | AC | 1,389 ms
49,152 KB |
testcase_33 | AC | 1,394 ms
49,296 KB |
testcase_34 | AC | 1,416 ms
49,052 KB |
testcase_35 | AC | 1,344 ms
49,152 KB |
testcase_36 | AC | 1,367 ms
49,160 KB |
testcase_37 | AC | 1,381 ms
49,248 KB |
testcase_38 | AC | 1,391 ms
49,152 KB |
testcase_39 | AC | 1,359 ms
49,260 KB |
testcase_40 | AC | 1,349 ms
49,152 KB |
testcase_41 | AC | 1,371 ms
49,024 KB |
testcase_42 | AC | 890 ms
20,480 KB |
testcase_43 | AC | 882 ms
20,480 KB |
testcase_44 | AC | 877 ms
20,352 KB |
testcase_45 | AC | 880 ms
20,420 KB |
testcase_46 | AC | 890 ms
20,352 KB |
testcase_47 | AC | 1,278 ms
52,224 KB |
testcase_48 | AC | 1,275 ms
52,224 KB |
testcase_49 | AC | 1,289 ms
52,224 KB |
testcase_50 | AC | 1,281 ms
52,224 KB |
testcase_51 | AC | 1,296 ms
52,224 KB |
testcase_52 | AC | 1,114 ms
57,212 KB |
testcase_53 | AC | 1,129 ms
57,072 KB |
testcase_54 | AC | 1,138 ms
57,228 KB |
testcase_55 | AC | 1,371 ms
50,176 KB |
testcase_56 | AC | 1,360 ms
50,176 KB |
testcase_57 | AC | 1,362 ms
50,176 KB |
testcase_58 | AC | 56 ms
8,352 KB |
testcase_59 | AC | 1,425 ms
53,052 KB |
testcase_60 | AC | 167 ms
6,656 KB |
testcase_61 | AC | 1,408 ms
50,432 KB |
testcase_62 | AC | 16 ms
5,376 KB |
testcase_63 | AC | 205 ms
7,424 KB |
testcase_64 | AC | 187 ms
7,296 KB |
testcase_65 | AC | 232 ms
7,552 KB |
testcase_66 | AC | 1,383 ms
50,048 KB |
testcase_67 | AC | 330 ms
9,472 KB |
testcase_68 | AC | 72 ms
5,504 KB |
testcase_69 | AC | 323 ms
9,600 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long BASE = 100000000; const unsigned long long M30 = ((unsigned long long) 1 << 30) - 1; const unsigned long long M31 = ((unsigned long long) 1 << 31) - 1; const unsigned long long MOD = ((unsigned long long) 1 << 61) - 1; unsigned long long modulo(unsigned long long x){ unsigned long long xu = x >> 61; unsigned long long xd = x & MOD; unsigned long long res = xu + xd; if (res >= MOD){ res -= MOD; } return res; } unsigned long long mul(unsigned long long a, unsigned long long b){ unsigned long long au = a >> 31; unsigned long long ad = a & M31; unsigned long long bu = b >> 31; unsigned long long bd = b & M31; unsigned long long mid = au * bd + ad * bu; unsigned long long midu = mid >> 30; unsigned long long midd = mid & M30; return modulo(au * bu * 2 + midu + (midd << 31) + ad * bd); } int main(){ int N; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++){ cin >> S[i]; } set<unsigned long long> st; for (int i = 0; i < N; i++){ int L = S[i].size(); vector<long long> POW(L); POW[0] = 1; for (int j = 1; j < L; j++){ POW[j] = mul(POW[j - 1], BASE); } unsigned long long sum = 0; for (int j = 0; j < L; j++){ sum = modulo(sum + mul(S[i][j], POW[j])); } if (st.count(sum) == 1){ cout << "Yes" << endl; } else { cout << "No" << endl; } st.insert(sum); for (int j = 0; j < L - 1; j++){ unsigned long long sum2 = sum; sum2 += MOD - mul(S[i][j], POW[j]); sum2 += MOD - mul(S[i][j + 1], POW[j + 1]); sum2 += mul(S[i][j], POW[j + 1]); sum2 += mul(S[i][j + 1], POW[j]); st.insert(modulo(sum2)); } } }