結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー kwm_tkwm_t
提出日時 2022-10-15 16:54:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,193 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 208,200 KB
実行使用メモリ 24,684 KB
最終ジャッジ日時 2023-09-09 02:46:06
合計ジャッジ時間 24,107 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,144 KB
testcase_01 AC 5 ms
6,208 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 149 ms
10,904 KB
testcase_06 WA -
testcase_07 AC 157 ms
11,084 KB
testcase_08 AC 40 ms
6,780 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 107 ms
10,220 KB
testcase_18 AC 230 ms
14,072 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 75 ms
7,372 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 321 ms
16,708 KB
testcase_43 AC 332 ms
16,512 KB
testcase_44 AC 314 ms
16,460 KB
testcase_45 AC 317 ms
16,452 KB
testcase_46 AC 353 ms
16,564 KB
testcase_47 AC 192 ms
12,708 KB
testcase_48 AC 198 ms
12,784 KB
testcase_49 AC 190 ms
12,492 KB
testcase_50 AC 201 ms
12,672 KB
testcase_51 AC 206 ms
12,612 KB
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 42 ms
6,336 KB
testcase_56 AC 41 ms
6,220 KB
testcase_57 AC 41 ms
6,144 KB
testcase_58 RE -
testcase_59 WA -
testcase_60 AC 24 ms
6,200 KB
testcase_61 AC 42 ms
6,188 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 AC 45 ms
6,096 KB
testcase_68 WA -
testcase_69 AC 40 ms
6,332 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; }

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;
}
0