結果
問題 |
No.2063 ±2^k operations (easy)
|
ユーザー |
![]() |
提出日時 | 2022-09-25 19:48:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,890 bytes |
コンパイル時間 | 4,090 ms |
コンパイル使用メモリ | 251,724 KB |
最終ジャッジ日時 | 2025-02-07 15:05:01 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:39: warning: ‘r’ may be used uninitialized [-Wmaybe-uninitialized] 16 | #define repi(i,a,b) for(int i=int(a);i<int(b);++i) | ^ main.cpp:14:39: note: in expansion of macro ‘repi’ 14 | #define _overload3(_1,_2,_3,name,...) name | ^~~~ main.cpp:17:18: note: in expansion of macro ‘_overload3’ 17 | #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) | ^~~~~~~~~~ main.cpp:67:5: note: in expansion of macro ‘rep’ 67 | rep(i,l,r+1){ | ^~~ main.cpp:59:11: note: ‘r’ was declared here 59 | int l,r; | ^ main.cpp:16:39: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized] 16 | #define repi(i,a,b) for(int i=int(a);i<int(b);++i) | ^ main.cpp:14:39: note: in expansion of macro ‘repi’ 14 | #define _overload3(_1,_2,_3,name,...) name | ^~~~ main.cpp:17:18: note: in expansion of macro ‘_overload3’ 17 | #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) | ^~~~~~~~~~ main.cpp:67:5: note: in expansion of macro ‘rep’ 67 | rep(i,l,r+1){ | ^~~ main.cpp:59:9: note: ‘l’ was declared here 59 | int l,r; | ^
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace atcoder; // using namespace __gnu_pbds; using ll=long long; #define int ll using ld = long double; #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define rrep(i,n) for(int i=int(n-1);i>=int(0);--i) #define fore(i,a) for(auto &i:a) #define all(x) x.begin(),x.end() #define sz(x) ((int)(x).size()) #define bp(x) (__builtin_popcount((long long)(x))) #define pb push_back #define eb emplace_back #define mpa make_pair #define bit(n) (1LL<<(n)) template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class T> using max_heap = priority_queue<T>; template <class T> using min_heap = priority_queue<T, vector<T>, greater<>>; #define P pair<int,int> #define TP tuple<int,int,int> #define F first #define S second template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const int INF = 1001001001; const ll INFL = 3e18; const int MAX = 2e6+1; int co(const string &s){ int res=0; rep(i,sz(s))res+=(s[i]-'0'); return res; } signed main() { string s;cin>>s; int n=sz(s); int t=co(s); if(t==1){ cout<<"No"<<endl; return 0; } else if(t==2||t==0){ cout<<"Yes"<<endl; return 0; } int l,r; rep(i,n){ if(s[i]=='1')r=i; } rrep(i,n){ if(s[i]=='1')l=i; } t=0; rep(i,l,r+1){ if(s[i]=='0')t++; } if(t<1){ cout<<"Yes"<<endl; return 0; } else{ cout<<"No"<<endl; return 0; } }