| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1190688 | alexander707070 | Tricolor Lights (JOI24_tricolor) | C++20 | 1857 ms | 3060 KiB |
#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;
unordered_map<string,int> mp;
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;
if(mp[u]>0)return mp[u];
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>105)break;
}
for(int f=pos;f<pos+L;f++)s[f]=u[f-pos];
mp[u]=pos+1;
return pos+1;
}
Compilation message (stderr)
| # | 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... | ||||
