結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー kwm_tkwm_t
提出日時 2022-10-15 17:15:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,136 bytes
コンパイル時間 2,477 ms
コンパイル使用メモリ 210,984 KB
実行使用メモリ 38,236 KB
最終ジャッジ日時 2023-09-09 02:53:32
合計ジャッジ時間 47,802 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
19,780 KB
testcase_01 AC 28 ms
19,628 KB
testcase_02 AC 436 ms
28,036 KB
testcase_03 AC 606 ms
30,748 KB
testcase_04 AC 446 ms
27,956 KB
testcase_05 AC 260 ms
24,064 KB
testcase_06 AC 510 ms
28,428 KB
testcase_07 AC 524 ms
24,748 KB
testcase_08 AC 77 ms
20,196 KB
testcase_09 AC 551 ms
29,408 KB
testcase_10 AC 174 ms
22,884 KB
testcase_11 AC 189 ms
24,052 KB
testcase_12 AC 389 ms
27,232 KB
testcase_13 AC 704 ms
31,736 KB
testcase_14 AC 368 ms
26,252 KB
testcase_15 AC 520 ms
28,940 KB
testcase_16 AC 886 ms
33,792 KB
testcase_17 AC 339 ms
23,656 KB
testcase_18 AC 639 ms
27,592 KB
testcase_19 AC 246 ms
24,680 KB
testcase_20 AC 811 ms
32,680 KB
testcase_21 AC 122 ms
20,652 KB
testcase_22 AC 1,013 ms
35,152 KB
testcase_23 AC 991 ms
35,184 KB
testcase_24 AC 1,029 ms
35,240 KB
testcase_25 AC 1,015 ms
35,272 KB
testcase_26 AC 982 ms
35,392 KB
testcase_27 AC 1,014 ms
35,400 KB
testcase_28 AC 1,006 ms
35,264 KB
testcase_29 WA -
testcase_30 AC 1,061 ms
35,264 KB
testcase_31 AC 962 ms
35,396 KB
testcase_32 AC 979 ms
35,208 KB
testcase_33 AC 1,100 ms
35,168 KB
testcase_34 AC 1,071 ms
35,272 KB
testcase_35 AC 1,090 ms
35,436 KB
testcase_36 AC 1,059 ms
35,276 KB
testcase_37 AC 1,018 ms
35,180 KB
testcase_38 AC 1,033 ms
35,248 KB
testcase_39 AC 1,042 ms
35,332 KB
testcase_40 AC 1,004 ms
35,380 KB
testcase_41 AC 979 ms
35,180 KB
testcase_42 AC 766 ms
30,160 KB
testcase_43 AC 798 ms
30,228 KB
testcase_44 AC 826 ms
30,228 KB
testcase_45 AC 810 ms
30,148 KB
testcase_46 AC 773 ms
30,156 KB
testcase_47 AC 638 ms
26,076 KB
testcase_48 AC 634 ms
25,988 KB
testcase_49 AC 650 ms
25,884 KB
testcase_50 AC 655 ms
25,980 KB
testcase_51 AC 627 ms
26,028 KB
testcase_52 AC 146 ms
20,444 KB
testcase_53 AC 147 ms
20,364 KB
testcase_54 AC 146 ms
20,424 KB
testcase_55 AC 268 ms
19,860 KB
testcase_56 AC 267 ms
19,860 KB
testcase_57 AC 266 ms
19,984 KB
testcase_58 AC 147 ms
20,384 KB
testcase_59 AC 1,079 ms
38,236 KB
testcase_60 AC 69 ms
19,740 KB
testcase_61 AC 268 ms
19,924 KB
testcase_62 AC 41 ms
20,204 KB
testcase_63 AC 243 ms
19,728 KB
testcase_64 AC 241 ms
19,696 KB
testcase_65 AC 346 ms
19,776 KB
testcase_66 AC 267 ms
20,008 KB
testcase_67 AC 167 ms
19,784 KB
testcase_68 AC 164 ms
19,872 KB
testcase_69 AC 163 ms
19,756 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[3][1000006];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n; cin >> n;
	vector<long long>mod;
	//mod.push_back(998244353);
	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];
	}
	vector<set<long long>>st(sz);
	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;
		{
			int cnt = 0;
			rep(j, sz)if (st[j].count(val[j]))cnt++;
			if (cnt == sz)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];
			}
			int cnt = 0;
			rep(j, sz)if (st[j].count(subval[j]))cnt++;
			if (cnt == sz)chk = true;
		}
		if (chk)cout << "Yes" << endl;
		else cout << "No" << endl;
		rep(j, sz)st[j].insert(val[j]);
	}
	return 0;
}
0