Submission #626779

# Submission time Handle Problem Language Result Execution time Memory
626779 2022-08-11T18:49:38 Z MatBad Lamps (JOI19_lamps) C++14
4 / 100
19 ms 3356 KB
#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 time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 15 ms 3328 KB Output is correct
8 Correct 18 ms 3304 KB Output is correct
9 Correct 18 ms 3356 KB Output is correct
10 Correct 18 ms 3340 KB Output is correct
11 Correct 18 ms 3332 KB Output is correct
12 Correct 14 ms 3356 KB Output is correct
13 Correct 19 ms 3316 KB Output is correct
14 Correct 15 ms 3280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -