結果
| 問題 |
No.2343 (l+r)/2
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2023-06-09 21:17:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,210 bytes |
| コンパイル時間 | 3,643 ms |
| コンパイル使用メモリ | 279,008 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 02:03:41 |
| 合計ジャッジ時間 | 4,035 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
namespace std {
template <class T1, class T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
return is >> p.first >> p.second;
}
template <class... Ts>
istream& operator>>(istream& is, tuple<Ts...>& t) {
return apply([&is](auto&... xs) -> istream& { return (is >> ... >> xs); }, t);
}
template <class... Ts>
istream& operator>>(istream& is, tuple<Ts&...>&& t) {
return is >> t;
}
template <class R, enable_if_t<!is_convertible_v<R, string>>* = nullptr>
auto operator>>(istream& is, R&& r) -> decltype(is >> *begin(r)) {
for (auto&& e : r) {
is >> e;
}
return is;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
return os << p.first << ' ' << p.second;
}
template <class... Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
auto f = [&os](const auto&... xs) -> ostream& {
[[maybe_unused]] auto sep = "";
((os << exchange(sep, " ") << xs), ...);
return os;
};
return apply(f, t);
}
template <class R, enable_if_t<!is_convertible_v<R, string_view>>* = nullptr>
auto operator<<(ostream& os, R&& r) -> decltype(os << *begin(r)) {
auto sep = "";
for (auto&& e : r) {
os << exchange(sep, " ") << e;
}
return os;
}
} // namespace std
// end library
#define show(...) static_cast<void>(0)
namespace std::ranges::views {
namespace {
void solve() {
int n;
cin >> n;
vector<int> a(n);
cin >> a;
int f = 1 << a[0];
for (int e : a | drop(1)) {
int nf = 0;
if (e) {
if (f & 1) {
nf |= 8;
}
if (f & 2) {
nf |= 2;
}
if (f & 4) {
nf |= 2;
}
if (f & 8) {
nf |= 2;
nf |= 8;
}
} else {
if (f & 1) {
nf |= 1;
}
if (f & 2) {
nf |= 4;
}
if (f & 4) {
nf |= 1;
nf |= 4;
}
if (f & 8) {
nf |= 1;
}
}
f = nf;
show(f);
}
cout << (f & 12 ? "Yes\n" : "No\n");
}
} // namespace
} // namespace std::ranges::views
using views::solve;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
solve();
}
}
risujiroh