結果
| 問題 | No.2063 ±2^k operations (easy) |
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2023-05-05 18:33:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 814 bytes |
| コンパイル時間 | 861 ms |
| コンパイル使用メモリ | 108,052 KB |
| 最終ジャッジ日時 | 2025-02-12 17:17:53 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
using namespace std;
using ll = long long;
vector<pair<char, long long>> encoded;
void encode(string &S){
long long l = 0, r, N=S.size();
while(l != N){
r = l+1;
while(r<N && S[l] == S[r]) r++;
encoded.push_back(make_pair(S[l], r-l));
l = r;
}
}
int main(){
ll N=0, M=0;
string S;
cin >> S;
encode(S);
for (auto [c, x] : encoded){
if (c == '1'){
M++;
N += x;
}
}
if ((M == 2 && N == 2) || (M == 1 && N >= 2)) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
srjywrdnprkt