#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;
mt19937 rng(42069);
namespace Anna{
int L;
string s;
int n;
char letter(int x){
if(x==0)return 'R';
if(x==1)return 'G';
if(x==2)return 'B';
}
char diff(char x){
if(x=='R')return 'G';
if(x=='G')return 'B';
if(x=='B')return 'R';
}
void gen(){
for(int i=1;i<=n;i++){
s.push_back(letter(rng()%3));
}
}
};
pair<string, int> anna(int N, string S){
using namespace Anna;
n=N;
gen();
for(int i=0;i<n;i++){
if(s[i]==S[i]){
s[i]=diff(S[i]);
}
}
L=min(n,130);
return {s,L};
}
#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;
mt19937 rnd(42069);
namespace Bruno{
int L;
string s;
int n;
char letter(int x){
if(x==0)return 'R';
if(x==1)return 'G';
if(x==2)return 'B';
}
char diff(char x){
if(x=='R')return 'G';
if(x=='G')return 'B';
if(x=='B')return 'R';
}
void gen(){
for(int i=1;i<=n;i++){
s.push_back(letter(rnd()%3));
}
}
};
void init(int N, int l){
using namespace Bruno;
n=N; L=l;
gen();
}
int bruno(string u){
using namespace Bruno;
int best=0,pos=0,sbest=0;
for(int i=0;i<n-L+1;i++){
int cnt=0;
for(int f=i;f<i+L;f++){
if(u[f-i]==s[f])cnt++;
}
if(cnt>best){
sbest=best;
best=cnt;
pos=i;
}
if(best>85)break;
}
return pos+1;
}
Compilation message (stderr)
# 1번째 컴파일 단계
Anna.cpp: In function 'char Anna::letter(int)':
Anna.cpp:17:5: warning: control reaches end of non-void function [-Wreturn-type]
17 | }
| ^
Anna.cpp: In function 'char Anna::diff(char)':
Anna.cpp:23:5: warning: control reaches end of non-void function [-Wreturn-type]
23 | }
| ^
# 2번째 컴파일 단계
Bruno.cpp: In function 'char Bruno::letter(int)':
Bruno.cpp:17:5: warning: control reaches end of non-void function [-Wreturn-type]
17 | }
| ^
Bruno.cpp: In function 'char Bruno::diff(char)':
Bruno.cpp:23:5: warning: control reaches end of non-void function [-Wreturn-type]
23 | }
| ^
# | 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... |