#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, int> 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;
}
Compilation message
Anna.cpp: In function 'char sm(char, char)':
Anna.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type]
17 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1368 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1368 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1368 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1368 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
1368 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |