# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034315 | Hectorungo_18 | Tricolor Lights (JOI24_tricolor) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
string abc = "abcdefghijklmnopqrstuvwxyz";
// #define int long long
vector<char> cc = {'R', 'G', 'B', 'R'};
char sm(char a, char b){
for(int i =0; i < 3; i++){
if(a == cc[i] || b == cc[i]) continue;
return cc[i];
}
}
pair<string, int> anna(int n, string s){
int sm = 0;
if(n%2 == 1) sm=1;
int cur = 0, cnt = 1;
string ans = s;
while(cur < n){
for(int i = 0; i < 130; i++){
if(2*cnt+i >= 130){
char c=s[cur];
char d=s[cur+1];
char f = sm(c, d);
ans[cur]=ans[cur]=f;
// cur+=2;
i++;
}
else{
if(s[cur] != s[cur+1]){
ans[cur]=s[cur+1];
ans[cur+1]=s[cur];
}
else{
int pos = 0;
for(int i = 0; i < 3; i++){
if(cc[i] == s[cur]){
pos = i;
break;
}
}
ans[cur]=ans[cur+1] = cc[pos+1];
}
}
cur+=2;
cnt++;
}
}
pair<string, ans> so = {ans, 130};
return so;
}
#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 s){
int st = -1, en = -1;
for(int i = 0; i < l-1; i++){
if(s[i] == s[i+1]){
st = i;
for(int j = i; j < l-1; j++){
if(s[j] == s[j+1]){
en = j+1;
}
break;
}
if(st > 0 && en < n-1) break;
}
}
int lg = en-st;
lg/=2;
int ans = l*lg;
ans+=(en%129);
return ans;
}