Submission #626779

#TimeUsernameProblemLanguageResultExecution timeMemory
626779MatBadLamps (JOI19_lamps)C++14
4 / 100
19 ms3356 KiB
#include<bits/stdc++.h> //#pragma GCC optimize ("O2,unroll-loops") #pragma GCC optimize("no-stack-protector,fast-math") using namespace std; #define F first #define S second #define pb push_back #define ppb pop_back #define lb lower_bound #define ub upper_bound #define pc __builtin_popcount #define cl __builtin_clz #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORR(i,a,b) for(int i=a;i>=b;i--) #define debug(x) cerr<<#x<<" : &"<<x<<"&\n" #define wall() cerr<<'\n'<<"-------------------------------\n" typedef long long ll; typedef long double ld; typedef pair<int , int> pii; typedef pair<bool , pii> piii; const int MX=2e5+5, M=600, MOD = 1e9+7, inf = 1e9+20, //infl = 1e16, LOG = 18, A = 27, del = 10067; int n; int main(){ ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); string s; cin>>n; cin>>s; s.clear(); FOR(i, 1, n){ char c; cin>>c; if(!s.empty() and c==s.back()) continue; s.pb(c); } if(s.back()=='0') s.ppb(); cout<<((int)s.size()+1)/2<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...