結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー kwm_tkwm_t
提出日時 2022-10-15 17:22:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 606 ms / 3,000 ms
コード長 1,995 bytes
コンパイル時間 2,470 ms
コンパイル使用メモリ 209,356 KB
実行使用メモリ 28,268 KB
最終ジャッジ日時 2023-09-09 02:54:37
合計ジャッジ時間 31,987 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
19,056 KB
testcase_01 AC 27 ms
19,248 KB
testcase_02 AC 270 ms
23,312 KB
testcase_03 AC 355 ms
24,440 KB
testcase_04 AC 277 ms
23,104 KB
testcase_05 AC 174 ms
21,228 KB
testcase_06 AC 303 ms
23,512 KB
testcase_07 AC 314 ms
21,496 KB
testcase_08 AC 65 ms
19,384 KB
testcase_09 AC 326 ms
23,772 KB
testcase_10 AC 122 ms
20,540 KB
testcase_11 AC 121 ms
21,456 KB
testcase_12 AC 229 ms
22,744 KB
testcase_13 AC 423 ms
25,200 KB
testcase_14 AC 222 ms
22,220 KB
testcase_15 AC 334 ms
23,616 KB
testcase_16 AC 503 ms
26,056 KB
testcase_17 AC 211 ms
21,148 KB
testcase_18 AC 357 ms
23,040 KB
testcase_19 AC 159 ms
21,508 KB
testcase_20 AC 447 ms
25,436 KB
testcase_21 AC 97 ms
19,544 KB
testcase_22 AC 564 ms
26,756 KB
testcase_23 AC 567 ms
27,004 KB
testcase_24 AC 578 ms
26,736 KB
testcase_25 AC 604 ms
26,792 KB
testcase_26 AC 584 ms
26,764 KB
testcase_27 AC 592 ms
26,912 KB
testcase_28 AC 584 ms
26,736 KB
testcase_29 AC 577 ms
26,740 KB
testcase_30 AC 570 ms
26,744 KB
testcase_31 AC 577 ms
26,744 KB
testcase_32 AC 575 ms
26,828 KB
testcase_33 AC 568 ms
26,820 KB
testcase_34 AC 573 ms
27,012 KB
testcase_35 AC 578 ms
26,736 KB
testcase_36 AC 596 ms
26,740 KB
testcase_37 AC 589 ms
26,764 KB
testcase_38 AC 601 ms
26,784 KB
testcase_39 AC 578 ms
26,760 KB
testcase_40 AC 583 ms
26,800 KB
testcase_41 AC 587 ms
26,740 KB
testcase_42 AC 470 ms
24,192 KB
testcase_43 AC 462 ms
24,184 KB
testcase_44 AC 460 ms
24,200 KB
testcase_45 AC 463 ms
24,284 KB
testcase_46 AC 452 ms
24,468 KB
testcase_47 AC 380 ms
22,116 KB
testcase_48 AC 374 ms
22,168 KB
testcase_49 AC 375 ms
22,112 KB
testcase_50 AC 371 ms
22,260 KB
testcase_51 AC 386 ms
22,104 KB
testcase_52 AC 145 ms
19,728 KB
testcase_53 AC 145 ms
19,688 KB
testcase_54 AC 145 ms
19,672 KB
testcase_55 AC 201 ms
19,052 KB
testcase_56 AC 201 ms
19,068 KB
testcase_57 AC 199 ms
19,224 KB
testcase_58 AC 146 ms
19,860 KB
testcase_59 AC 606 ms
28,268 KB
testcase_60 AC 66 ms
18,996 KB
testcase_61 AC 201 ms
19,120 KB
testcase_62 AC 36 ms
19,240 KB
testcase_63 AC 195 ms
19,184 KB
testcase_64 AC 200 ms
19,032 KB
testcase_65 AC 241 ms
19,044 KB
testcase_66 AC 202 ms
19,224 KB
testcase_67 AC 160 ms
18,996 KB
testcase_68 AC 150 ms
19,056 KB
testcase_69 AC 157 ms
18,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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; }
long long table[2][1000006];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n; cin >> n;
	vector<long long>mod;
	mod.push_back(1000000007);
	mod.push_back(1000000009);
	int sz = mod.size();
	int base = 998244353;
	rep(i, sz)table[i][0] = 1;
	rep2(i, 1, 1000006) {
		rep(j, sz) table[j][i] = (table[j][i - 1] * base) % mod[j];
	}
	set<P>st;
	rep(i, n) {
		string s; cin >> s;
		vector<long long>val(sz);
		rep(j, s.size()) {
			rep(k, sz) {
				val[k] += table[k][j] * (s[j] - 'a' + 1);
				val[k] %= mod[k];
			}
		}
		bool chk = false;
		if (st.count({ val[0],val[1] }))chk = true;
		rep(j, s.size() - 1) {
			vector<long long>subval(sz);
			rep(k, sz) {
				subval[k] = val[k];
				subval[k] += mod[k] - table[k][j + 0] * (s[j + 0] - 'a' + 1) % mod[k];
				subval[k] += mod[k] - table[k][j + 1] * (s[j + 1] - 'a' + 1) % mod[k];
				subval[k] += table[k][j + 0] * (s[j + 1] - 'a' + 1);
				subval[k] += table[k][j + 1] * (s[j + 0] - 'a' + 1);
				subval[k] %= mod[k];
			}
			if (st.count({ subval[0],subval[1] }))chk = true;
		}
		if (chk)cout << "Yes" << endl;
		else cout << "No" << endl;
		st.insert({ val[0],val[1] });
	}
	return 0;
}
0