#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
}
pair<string, int> anna(int N, string S) {
string res;
if(N<=130){
for(int i=0;i<N;i++){
if(S[i]=='R')res.insert(res.end(),'B');
else if(S[i]=='B')res.insert(res.end(),'G');
else if(S[i]=='G')res.insert(res.end(),'R');
}
return {res,N};
}
for(int i=0;i<N;i++)res.insert(res.end(),'$');
{
vector<bool> present(3);
if(S[125]=='R')present[0]=true;
else if(S[125]=='G')present[1]=true;
else if(S[125]=='B')present[2]=true;
if(S[126]=='R')present[0]=true;
else if(S[126]=='G')present[1]=true;
else if(S[126]=='B')present[2]=true;
if(!present[0])res[125]=res[126]='R';
else if(!present[1])res[125]=res[126]='G';
else if(!present[2])res[125]=res[126]='B';
}
for(int i=124;i>=0;i--){
vector<bool> present(3);
if(S[i]=='R')present[0]=true;
else if(S[i]=='G')present[1]=true;
else if(S[i]=='B')present[2]=true;
if(res[i+1]=='R')present[0]=true;
else if(res[i+1]=='G')present[1]=true;
else if(res[i+1]=='B')present[2]=true;
if(!present[0])res[i]='R';
else if(!present[1])res[i]='G';
else if(!present[2])res[i]='B';
}
for(int i=126;i<N;i++){
vector<bool> present(3);
if(S[i]=='R')present[0]=true;
else if(S[i]=='G')present[1]=true;
else if(S[i]=='B')present[2]=true;
if(res[i-1]=='R')present[0]=true;
else if(res[i-1]=='G')present[1]=true;
else if(res[i-1]=='B')present[2]=true;
if(!present[0])res[i]='R';
else if(!present[1])res[i]='G';
else if(!present[2])res[i]='B';
}
return {res,130};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int N;
int l;
} // namespace
void init(int N, int l) {
::N = N;
::l = l;
}
int bruno(string u) {
if(N<=130)return 1;
int idxatsame = -1;
for(int i=1;i<l;i++)if(u[i]==u[i-1])idxatsame=i-1;
assert(idxatsame!=-1);
return 126-idxatsame;
}
Compilation message
Anna.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
7 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1328 KB |
Output is correct |
2 |
Correct |
47 ms |
1312 KB |
Output is correct |
3 |
Correct |
46 ms |
1372 KB |
Output is correct |
4 |
Correct |
25 ms |
1304 KB |
Output is correct |
5 |
Correct |
25 ms |
1372 KB |
Output is correct |
6 |
Correct |
35 ms |
1288 KB |
Output is correct |
7 |
Runtime error |
2 ms |
1548 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1328 KB |
Output is correct |
2 |
Correct |
47 ms |
1312 KB |
Output is correct |
3 |
Correct |
46 ms |
1372 KB |
Output is correct |
4 |
Correct |
25 ms |
1304 KB |
Output is correct |
5 |
Correct |
25 ms |
1372 KB |
Output is correct |
6 |
Correct |
35 ms |
1288 KB |
Output is correct |
7 |
Runtime error |
2 ms |
1548 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1328 KB |
Output is correct |
2 |
Correct |
47 ms |
1312 KB |
Output is correct |
3 |
Correct |
46 ms |
1372 KB |
Output is correct |
4 |
Correct |
25 ms |
1304 KB |
Output is correct |
5 |
Correct |
25 ms |
1372 KB |
Output is correct |
6 |
Correct |
35 ms |
1288 KB |
Output is correct |
7 |
Runtime error |
2 ms |
1548 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1328 KB |
Output is correct |
2 |
Correct |
47 ms |
1312 KB |
Output is correct |
3 |
Correct |
46 ms |
1372 KB |
Output is correct |
4 |
Correct |
25 ms |
1304 KB |
Output is correct |
5 |
Correct |
25 ms |
1372 KB |
Output is correct |
6 |
Correct |
35 ms |
1288 KB |
Output is correct |
7 |
Runtime error |
2 ms |
1548 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1288 KB |
Output is correct |
2 |
Correct |
23 ms |
1324 KB |
Output is correct |
3 |
Correct |
28 ms |
1376 KB |
Output is correct |
4 |
Correct |
47 ms |
1316 KB |
Output is correct |
5 |
Partially correct |
43 ms |
1384 KB |
Partially correct |
6 |
Partially correct |
45 ms |
1348 KB |
Partially correct |
7 |
Runtime error |
1 ms |
1288 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |