結果
| 問題 | No.3234 Infinite Propagation |
| コンテスト | |
| ユーザー |
Iroha_3856
|
| 提出日時 | 2025-08-14 20:31:48 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| + 690µs | |
| コード長 | 993 bytes |
| 記録 | |
| コンパイル時間 | 2,641 ms |
| コンパイル使用メモリ | 336,840 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-07-14 00:44:26 |
| 合計ジャッジ時間 | 4,109 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/allocator.h:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/string:45,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bitset:54,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:54,
from main.cpp:1:
In member function 'void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = char]',
inlined from 'constexpr void std::allocator< <template-parameter-1-1> >::deallocate(_Tp*, std::size_t) [with _Tp = char]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/allocator.h:215:35,
inlined from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = char]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/alloc_traits.h:649:23,
inlined from 'constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_destroy(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/basic_string.h:305:34,
inlined from 'constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_dispose() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/basic_string.h:299:14,
inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/basic_string.h:896:19,
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
bool has_a(string x) {
for (char c : x) if (c == 'a') return true;
return false;
}
void solve() {
int N; cin >> N;
string X[N], Y[N];
for (int i = 0; i < N; i++) cin >> X[i] >> Y[i];
int max_len = 0;
for (int i = 0; i < N; i++) {
if (X[i] == "a") {
if (has_a(Y[i])) {
cout << "Yes" << endl;
return;
}
else {
max_len = max(max_len, (int)Y[i].size());
}
}
}
if (max_len == 0) {
cout << "No" << endl;
return;
}
int target = inf;
for (int i = 0; i < N; i++) {
if (has_a(X[i]) == false and has_a(Y[i]) == true) {
target = min(target, (int)X[i].size());
}
}
bool exist = false;
for (int i = 0; i < N; i++) {
if ((int)X[i].size() <= max_len and has_a(X[i]) == false and has_a(Y[i]) == false) {
exist = true;
}
}
bool ans = ((max_len >= target) or exist);
cout << (ans? "Yes" : "No") << endl;
}
int main() {
int T; cin >> T;
while(T--) solve();
}
Iroha_3856