# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
626778 |
2022-08-11T18:46:16 Z |
MatBad |
Lamps (JOI19_lamps) |
C++14 |
|
1 ms |
212 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);
}
cout<<((int)s.size()+1)/2<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |