結果
問題 |
No.3234 Infinite Propagation
|
ユーザー |
|
提出日時 | 2025-08-16 12:41:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 838 bytes |
コンパイル時間 | 1,862 ms |
コンパイル使用メモリ | 194,872 KB |
実行使用メモリ | 11,460 KB |
最終ジャッジ日時 | 2025-08-16 12:41:58 |
合計ジャッジ時間 | 3,215 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; const int N = 2000086, MOD = 998244353, INF = 0x3f3f3f3f; ll res; int n, m, cnt, w[N]; string x[100010], y[100010]; void solve() { int t = 0; for (int i = 1; i < n + 1; i++) { if (x[i] == "a") t = max(t, (int)y[i].size()); if (x[i] == "a" && y[i].find('a') != -1) { puts("Yes"); return; } } for (int i = 1; i < n + 1; i++) if (x[i].find('a') == -1 && x[i].size() <= t) { puts("Yes"); return; } puts("No"); } int main() { ios::sync_with_stdio(false), cin.tie(0); int T; cin >> T; while (T--) { cin >> n; for (int i = 1; i < n + 1; i++) cin >> x[i] >> y[i]; solve(); } return 0; }