結果
| 問題 |
No.3234 Infinite Propagation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-12 11:10:08 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 1,311 bytes |
| コンパイル時間 | 13,998 ms |
| コンパイル使用メモリ | 323,028 KB |
| 実行使用メモリ | 8,680 KB |
| 最終ジャッジ日時 | 2025-09-12 11:10:27 |
| 合計ジャッジ時間 | 16,008 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
const ll MOD = 998244353;
#include<atcoder/all>
using namespace atcoder;
using mint = modint998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll t;cin>>t;
while(t--){
ll n;cin>>n;
ll mb=0;
bool f=false;
vector<vector<ll>> S;
while(n--){
string x,y;cin>>x>>y;
ll cxa=0,cxb=0,cya=0,cyb=0;
rep(i,x.size()){
if (x[i]=='a')cxa++;
else cxb++;
}
rep(i,y.size()){
if(y[i]=='a')cya++;
else cyb++;
}
if(cxa==1 && cxb==0){
if(cya>0 &&cya+cyb>1){
f=true;
}else{
mb=max(mb,cyb);
}
}else if(cxa==0){
S.push_back({cxb,cya,cyb});
}
}
for(auto I:S){
if(I[0]>mb)continue;
if(I[0]<mb &&I[1]>0){
f=true;
break;
}
if(I[0]<=mb && I[0]<I[1]+I[2]){
f=true;
break;
}
if (I[0]==mb && I[1]>0 && I[1]+I[2]>1){
f=true;
break;
}
}
if(f) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}