結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | kwm_t |
提出日時 | 2022-10-15 16:57:48 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,260 bytes |
コンパイル時間 | 2,105 ms |
コンパイル使用メモリ | 210,808 KB |
実行使用メモリ | 24,832 KB |
最終ジャッジ日時 | 2024-06-26 19:59:52 |
合計ジャッジ時間 | 26,883 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
6,812 KB |
testcase_01 | AC | 6 ms
6,940 KB |
testcase_02 | AC | 252 ms
14,720 KB |
testcase_03 | AC | 323 ms
17,280 KB |
testcase_04 | AC | 263 ms
14,592 KB |
testcase_05 | AC | 149 ms
10,752 KB |
testcase_06 | AC | 279 ms
15,104 KB |
testcase_07 | AC | 193 ms
11,264 KB |
testcase_08 | AC | 38 ms
6,948 KB |
testcase_09 | AC | 269 ms
16,128 KB |
testcase_10 | AC | 95 ms
9,472 KB |
testcase_11 | AC | 85 ms
10,624 KB |
testcase_12 | AC | 199 ms
14,080 KB |
testcase_13 | AC | 380 ms
18,304 KB |
testcase_14 | AC | 198 ms
12,800 KB |
testcase_15 | AC | 327 ms
15,488 KB |
testcase_16 | AC | 467 ms
20,480 KB |
testcase_17 | AC | 121 ms
10,368 KB |
testcase_18 | AC | 251 ms
13,952 KB |
testcase_19 | AC | 130 ms
11,392 KB |
testcase_20 | AC | 411 ms
19,200 KB |
testcase_21 | AC | 69 ms
7,424 KB |
testcase_22 | AC | 545 ms
21,888 KB |
testcase_23 | AC | 560 ms
21,760 KB |
testcase_24 | AC | 559 ms
21,888 KB |
testcase_25 | AC | 553 ms
21,888 KB |
testcase_26 | AC | 537 ms
21,888 KB |
testcase_27 | AC | 549 ms
21,888 KB |
testcase_28 | AC | 551 ms
22,016 KB |
testcase_29 | AC | 556 ms
21,888 KB |
testcase_30 | AC | 559 ms
21,888 KB |
testcase_31 | AC | 538 ms
21,888 KB |
testcase_32 | AC | 530 ms
21,888 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | AC | 591 ms
21,888 KB |
testcase_37 | AC | 530 ms
21,760 KB |
testcase_38 | AC | 537 ms
21,760 KB |
testcase_39 | AC | 547 ms
21,888 KB |
testcase_40 | AC | 571 ms
21,888 KB |
testcase_41 | WA | - |
testcase_42 | AC | 373 ms
16,640 KB |
testcase_43 | AC | 368 ms
16,768 KB |
testcase_44 | AC | 373 ms
16,768 KB |
testcase_45 | AC | 367 ms
16,768 KB |
testcase_46 | AC | 360 ms
16,768 KB |
testcase_47 | AC | 230 ms
12,800 KB |
testcase_48 | AC | 239 ms
12,672 KB |
testcase_49 | AC | 232 ms
12,672 KB |
testcase_50 | AC | 240 ms
12,672 KB |
testcase_51 | AC | 231 ms
12,544 KB |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | RE | - |
testcase_55 | AC | 67 ms
6,944 KB |
testcase_56 | AC | 67 ms
6,940 KB |
testcase_57 | AC | 75 ms
6,944 KB |
testcase_58 | RE | - |
testcase_59 | AC | 632 ms
24,832 KB |
testcase_60 | AC | 22 ms
6,940 KB |
testcase_61 | AC | 67 ms
6,944 KB |
testcase_62 | AC | 12 ms
6,944 KB |
testcase_63 | AC | 61 ms
6,944 KB |
testcase_64 | AC | 78 ms
6,944 KB |
testcase_65 | AC | 150 ms
6,944 KB |
testcase_66 | AC | 66 ms
6,944 KB |
testcase_67 | AC | 44 ms
6,940 KB |
testcase_68 | AC | 25 ms
6,944 KB |
testcase_69 | AC | 40 ms
6,944 KB |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define endl "\n" #define P pair<int,int> template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; long long mod1 = 1000000007; long long mod2 = 998244353; int kind = 100; vector<long long>table1(200005), table2(200005); table1[0] = 1, table2[0] = 1; rep2(i, 1, table1.size()) { table1[i] = (table1[i - 1] * kind) % mod1; table2[i] = (table2[i - 1] * kind) % mod2; } set<long long>st1, st2; rep(i, n) { string s; cin >> s; long long base1 = 0; long long base2 = 0; rep(j, s.size()) { base1 += table1[j] * (s[j] - 'a' + 1); base1 %= mod1; base2 += table2[j] * (s[j] - 'a' + 1); base2 %= mod2; } bool chk = false; if (st1.count(base1) && st2.count(base2))chk = true; rep(j, s.size() - 1) { long long val1 = base1; val1 += mod1 - table1[j + 0] * (s[j + 0] - 'a' + 1) % mod1; val1 += mod1 - table1[j + 1] * (s[j + 1] - 'a' + 1) % mod1; val1 += table1[j + 0] * (s[j + 1] - 'a' + 1); val1 += table1[j + 1] * (s[j + 0] - 'a' + 1); val1 %= mod1; long long val2 = base2; val2 += mod2 - table2[j + 0] * (s[j + 0] - 'a' + 1) % mod2; val2 += mod2 - table2[j + 1] * (s[j + 1] - 'a' + 1) % mod2; val2 += table2[j + 0] * (s[j + 1] - 'a' + 1); val2 += table2[j + 1] * (s[j + 0] - 'a' + 1); val2 %= mod2;\ if (st1.count(val1) && st2.count(val2))chk = true; } if (chk)cout << "Yes" << endl; else cout << "No" << endl; st1.insert(base1); st2.insert(base2); } return 0; }