結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | momoyuu |
提出日時 | 2022-10-15 00:58:43 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,387 bytes |
コンパイル時間 | 3,649 ms |
コンパイル使用メモリ | 254,704 KB |
実行使用メモリ | 21,072 KB |
最終ジャッジ日時 | 2024-06-26 18:52:48 |
合計ジャッジ時間 | 37,835 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 343 ms
6,944 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 180 ms
6,940 KB |
testcase_09 | WA | - |
testcase_10 | AC | 231 ms
6,944 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 310 ms
6,944 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 | 520 ms
8,576 KB |
testcase_43 | AC | 530 ms
8,576 KB |
testcase_44 | AC | 516 ms
8,704 KB |
testcase_45 | AC | 509 ms
8,704 KB |
testcase_46 | AC | 517 ms
8,704 KB |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | AC | 76 ms
20,984 KB |
testcase_53 | AC | 76 ms
21,072 KB |
testcase_54 | AC | 76 ms
21,052 KB |
testcase_55 | AC | 124 ms
6,940 KB |
testcase_56 | AC | 121 ms
6,940 KB |
testcase_57 | AC | 125 ms
6,940 KB |
testcase_58 | AC | 78 ms
12,496 KB |
testcase_59 | AC | 798 ms
12,672 KB |
testcase_60 | AC | 172 ms
6,940 KB |
testcase_61 | AC | 125 ms
6,940 KB |
testcase_62 | AC | 15 ms
6,944 KB |
testcase_63 | AC | 137 ms
6,944 KB |
testcase_64 | AC | 138 ms
6,944 KB |
testcase_65 | AC | 145 ms
6,944 KB |
testcase_66 | WA | - |
testcase_67 | AC | 346 ms
6,944 KB |
testcase_68 | AC | 77 ms
6,940 KB |
testcase_69 | AC | 342 ms
6,944 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; template<class t> using vc = vector<t>; template<class t> using vvc = vc<vc<t>>; using pi = pair<int,int>; using pl = pair<ll,ll>; using vi = vc<int>; using vvi = vvc<int>; using vl = vc<ll>; using vvl = vvc<ll>; #define rep(i,a,b) for (int i = (int)(a); i < (int)(b); i++) #define irep(i,a,b) for (int i = (int)(a); i > (int)(b); i--) #define all(a) a.begin(),a.end() #define print(n) cout << n << '\n' #define pritn(n) print(n) #define printv(n,a) {copy(all(n),ostream_iterator<a>(cout," ")); cout<<"\n";} #define printvv(n,a) {for(auto itr:n) printv(itr,a);} #define rup(a,b) (a+b-1)/b #define input(A,N) rep(i,0,N) cin>>A[i] #define chmax(a,b) a = max(a,b) #define chmin(a,b) a = min(a,b) const ll m2 = 1000000007; const ll b2 = 1009; const ll m3 = 1000000009; const ll b3 = 2009; const ll m4 = 2147483587; const ll b4 = 2147483583; //https://gist.github.com/privet-kitty/295ac9202b7abb3039b493f8238bf40f#file-modulus-random-base-pair64-txt struct rhash{ int n; ll mod,B; vc<ll> sum; vc<ll> powb; string s; rhash(string &s,ll mod,ll B):mod(mod),B(B),s(s){ n = s.size(); sum = vc<ll>(n+1,0); powb = vc<ll>(n+1,1); for(int i = 0;i<n;i++){ sum[i+1] = (sum[i]*B%mod+(s[i]))%mod; powb[i+1] = (powb[i]*B)%mod; } } ll get(int l,int r){ ll tmp = sum[r] - sum[l]*powb[r-l]%mod; if(tmp<0) tmp += mod; return tmp; } ll inv(int i){ ll tmp = sum[n]; tmp -= powb[n-i-1]*(s[i]) + powb[n-i-2]*(s[i+1]); tmp += powb[n-i-2]*(s[i]) + powb[n-i-1]*(s[i+1]); tmp %= mod; if(tmp<0) tmp += mod; return tmp; } }; int main(){ cout << fixed << setprecision(15); int n; cin>>n; // unordered_set<string> d; set<ll> d; rep(i,0,n){ string now; cin>>now; rhash hash(now,m2,b2); bool p =false; if(d.find(hash.get(0,now.size()))!=d.end()) p = true; rep(i,0,now.size()-1){ ll nn = hash.inv(i); if(d.find(nn)!=d.end())p = true; if(p) break; } d.insert(hash.get(0,now.size())); if(p) print("Yes"); else print("No"); } //system("pause"); return 0; }