結果
| 問題 |
No.2063 ±2^k operations (easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-02 22:41:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 974 bytes |
| コンパイル時間 | 2,021 ms |
| コンパイル使用メモリ | 196,884 KB |
| 最終ジャッジ日時 | 2025-02-07 01:38:22 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
iostream::sync_with_stdio(0), cin.tie(0), cout.tie(0);
string n;
cin >> n;
vector<pair<int, int>> P;
for (char c: n) {
int i = c - '0';
if (P.empty() || P.back().first != i) {
P.push_back({i, 1});
} else {
P.back().second++;
}
}
bool ok = false;
int sz = (int)P.size();
if (sz == 1 || sz == 2) {
if (P.front().first == 1 && P.front().second > 1) {
ok = true;
}
} else if (sz == 3) {
if (P.front().first == 1 && P.front().second > 1 && P[1].first == 0 && P[1].second == 1) {
ok = true;
}
if (P.front().first == 1 && P.front().second == 1 && P.back().first == 1 && P.back().second == 1) {
ok = true;
}
} else if (sz == 4) {
int cnt = 0;
for (auto [i, c]: P) {
if (i == 1) {
cnt += c;
}
}
if (cnt == 2) {
ok = true;
}
}
cout << (ok ? "Yes" : "No") << '\n';
return 0;
}