結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | kwm_t |
提出日時 | 2022-10-15 16:54:30 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,193 bytes |
コンパイル時間 | 2,168 ms |
コンパイル使用メモリ | 209,552 KB |
実行使用メモリ | 24,960 KB |
最終ジャッジ日時 | 2024-06-26 19:59:17 |
合計ジャッジ時間 | 25,492 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
6,812 KB |
testcase_01 | AC | 5 ms
6,812 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 147 ms
10,752 KB |
testcase_06 | WA | - |
testcase_07 | AC | 157 ms
11,264 KB |
testcase_08 | AC | 38 ms
6,944 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 103 ms
10,368 KB |
testcase_18 | AC | 229 ms
14,080 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 70 ms
7,296 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | AC | 346 ms
16,768 KB |
testcase_43 | AC | 334 ms
16,768 KB |
testcase_44 | AC | 354 ms
16,640 KB |
testcase_45 | AC | 347 ms
16,768 KB |
testcase_46 | AC | 327 ms
16,768 KB |
testcase_47 | AC | 207 ms
12,672 KB |
testcase_48 | AC | 206 ms
12,672 KB |
testcase_49 | AC | 204 ms
12,544 KB |
testcase_50 | AC | 209 ms
12,672 KB |
testcase_51 | AC | 213 ms
12,672 KB |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | RE | - |
testcase_55 | AC | 41 ms
6,944 KB |
testcase_56 | AC | 40 ms
6,944 KB |
testcase_57 | AC | 40 ms
6,944 KB |
testcase_58 | RE | - |
testcase_59 | WA | - |
testcase_60 | AC | 22 ms
6,940 KB |
testcase_61 | AC | 40 ms
6,940 KB |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | AC | 42 ms
6,944 KB |
testcase_68 | WA | - |
testcase_69 | AC | 37 ms
6,940 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 += (s[j] - 'a' + 1)*table1[j]; base1 %= mod1; base2 += (s[j] - 'a' + 1)*table2[j]; base2 %= mod2; //cout << base1 << " " << base2 << endl; } bool chk = false; if (st1.count(base1) && st2.count(base2))chk = true; rep(j, s.size() - 1) { long long val1 = base1; val1 -= (s[j + 0] - 'a' + 1)*table1[j + 0]; val1 -= (s[j + 1] - 'a' + 1)*table1[j + 1]; val1 += (s[j + 1] - 'a' + 1)*table1[j + 0]; val1 += (s[j + 0] - 'a' + 1)*table1[j + 1]; long long val2 = base2; val2 -= (s[j + 0] - 'a' + 1)*table2[j + 0]; val2 -= (s[j + 1] - 'a' + 1)*table2[j + 1]; val2 += (s[j + 1] - 'a' + 1)*table2[j + 0]; val2 += (s[j + 0] - 'a' + 1)*table2[j + 1]; 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; }