#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
pair<string,int> anna(int n,string s){
string t="";
char choice[3]={'R','G','B'};
for(int i=0;i<n;i++){
for(int j=0;j<3;j++){
if(choice[j]!=s[i]){
t+=choice[j];
break;
}
}
}
if(n<=130){
return {t,n};
}
int l=130;
for(int j=0;j<3;j++){
if(choice[j]!=s[l-2]&&choice[j]!=s[l-1]){
t[l-2]=choice[j],t[l-1]=choice[j];
break;
}
}
for(int i=l-3;i>=0;i--){
for(int j=0;j<3;j++){
if(choice[j]!=s[i]&&choice[j]!=t[i+1]){
t[i]=choice[j];
break;
}
}
}
for(int i=l;i<n;i++){
for(int j=0;j<3;j++){
if(choice[j]!=s[i]&&choice[j]!=t[i-1]){
t[i]=choice[j];
break;
}
}
}
return {t,l};
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
int n,l;
void init(int N,int L){
n=N,l=L;
}
int bruno(string u){
if(n<=130){
return 1;
}
for(int i=0;i+1<u.length();i++){
if(u[i]==u[i+1]){
return (l-1-i);
}
}
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |