Rating changes for the last round are temporarily rolled back. They will be returned soon. ×

 
 
 
 
General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
116493520 Practice:
Ayhamalhettine
1430D - 8 GNU C++17 Accepted 46 ms 504 KB 2021-05-17 17:51:42 2021-05-17 17:51:42
 
 
→ Source
#include<iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int k;
		cin>>k;
		string s;
		cin>>s;
		int d=1,m=0;
		for(int i=1;i<k;i++){
			if(s[i]!=s[i-1]) d++;
			else m++;
			m=min(m,d);
		}
		m+=(d-m+1)/2;
		cout<<m<<endl;
	}
} 
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details