QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#553097 | #7559. Bocchi the Rock | ucup-team1231# | AC ✓ | 1988ms | 19388kb | C++14 | 3.0kb | 2024-09-08 08:35:03 | 2024-09-08 08:35:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct state {
vector<int> vec[2][2];
state(int n = 1) {
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
vec[i][j].resize(n, 0);
}
state(char S[]) {
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
vec[i][j] = vector<int>{0, 0, 0};
for(int i = 0; i < 2; i ++) {
char ch = i == 0 ? 'R' : 'B';
if(S[1] == ch) continue;
if(S[0] != 'Y' && S[2] != 'Y') vec[0][0][1]++;
if(S[0] != 'Y' && S[2] != 'P') vec[0][1][1 + i]++;
if(S[0] != 'P' && S[2] != 'Y') vec[1][0][1 - i]++;
if(S[0] != 'P' && S[2] != 'P') vec[1][1][1]++;
}
}
};
typedef vector<int> vi;
typedef long long ll;
const int MOD=998244353;
#define sz(t) int((t).size())
vi operator + (const vi&A,const vi&B) {
vi C(max(sz(A),sz(B)));
for(int i=0;i<sz(A);++i) C[i]=A[i];
for(int i=0;i<sz(B);++i) (C[i]+=B[i])%=MOD;
return C;
}
int K;
ll qp(ll a,ll b) {
ll x=1; a%=MOD;
while(b) {
if(b&1) x=x*a%MOD;
a=a*a%MOD; b>>=1;
}
return x;
}
const int SZ = 1000005;
ll w[2][SZ];
void fftinit(int n) {
for(K=1;K<n;K<<=1);
ll ww=qp(3,(MOD-1)/K);
w[0][0]=1;
for(int i=1;i<=K;++i)
w[0][i]=w[0][i-1]*ww%MOD;
for(int i=0;i<=K;++i) w[1][i]=w[0][K-i];
}
void fft(int*a,int o) {
for(int i=0;i<K;++i) {
int br=i,s=0;
for(int j=1;j<K;j<<=1)
s=s*2+br%2,br/=2;
if(i<s) swap(a[i],a[s]);
}
for(int i=2;i<=K;i<<=1)
for(int l=0;l<K;l+=i)
for(int j=0;j<(i/2);++j) {
int &p=a[j+l],&q=a[l+j+(i/2)];
ll t=q*(ll)w[o][K/i*j]%MOD;
q=(p-t+MOD)%MOD;
p=(p+t)%MOD;
}
if(!o) return;
ll rk=qp(K,MOD-2);
for(int i=0;i<K;++i) a[i]=a[i]*(ll)rk%MOD;
}
vi operator * (const vi&A,const vi&B) {
if(A.empty()) return A;
if(B.empty()) return B;
int u=sz(A)+sz(B)-1;
vi C(u);
static int ta[SZ],tb[SZ];
fftinit(u);
for(int i=0;i<K;++i) ta[i]=(i<sz(A))?A[i]:0;
for(int i=0;i<K;++i) tb[i]=(i<sz(B))?B[i]:0;
fft(ta,0);fft(tb,0);
for(int i=0;i<K;++i) ta[i]=ta[i]*(ll)tb[i]%MOD;
fft(ta,1);
for(int i=0;i<u;++i) C[i]=ta[i];
return C;
}
state merge(const state& A, const state& B) {
state ret(A.vec[0][0].size() + B.vec[0][0].size() - 1);
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
for(int k = 0; k < 2; k++)
ret.vec[i][j] = ret.vec[i][j] + A.vec[i][k] * B.vec[k][j];
return ret;
}
int n;
char S[100005];
state calc(int l, int r) {
if(l == r) return state(S + l * 2);
int mid = (l + r) >> 1;
return merge(calc(l, mid), calc(mid + 1, r));
}
int main() {
scanf("%d%s", &n, S);
S[2 * n] = S[0];
state ret = calc(0, n - 1);
printf("%d\n", (ret.vec[0][0][n] + ret.vec[1][1][n]) % MOD);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 9900kb
input:
2 ????
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 1ms
memory: 10004kb
input:
3 ??YR?B
output:
4
result:
ok 1 number(s): "4"
Test #3:
score: 0
Accepted
time: 1ms
memory: 9952kb
input:
5 YBYRPBYRYB
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 1ms
memory: 9948kb
input:
10 PRPBPRPRPRPBYB?R?BY?
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 2ms
memory: 10256kb
input:
10 ?R?R?BYB?R?R?B?B?BYR
output:
96
result:
ok 1 number(s): "96"
Test #6:
score: 0
Accepted
time: 0ms
memory: 9968kb
input:
10 YRPRYRY???P?YB?BYRY?
output:
32
result:
ok 1 number(s): "32"
Test #7:
score: 0
Accepted
time: 0ms
memory: 9912kb
input:
10 PBYBPRPBYRPBYRYBPRPB
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 1ms
memory: 10268kb
input:
10 PBPRPRYBYRYRYB?B?RYB
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 1ms
memory: 10032kb
input:
10 PRP?PBPRYR??Y?YRPB?R
output:
12
result:
ok 1 number(s): "12"
Test #10:
score: 0
Accepted
time: 1ms
memory: 11968kb
input:
10 ?RYB??P??B?B?B???RPR
output:
416
result:
ok 1 number(s): "416"
Test #11:
score: 0
Accepted
time: 1945ms
memory: 19372kb
input:
50000 YBPBYRPRPRPRPBPRPBPBPBYRPRPBPBYRPBPRYBYBPBPBPRPBPBYRYBYRPBYRYRPBYRYRYRPBYBYRPBPBYBYBPBYRPBPBYBYBYRPBPRYBPBYBPRPRYBPRPBYBPRPBYRPBYBPRYBPBPBYRYBYBYBPRYBYRPRPRPRPRYRYBPBPBPBPRPRYBYRYBPRPRPRPBYBPBPRYRPRPBYRPBYRYRPBYBYBPBYRYRPBPRYBPRYBPBPBYRPBPBYBYBPRPBYBYBYRYRPBPRPRPRPRPRYBPBPBPRYBYRPRPRYBYRPRPBYR...
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 1951ms
memory: 17536kb
input:
50000 YRPBPBYRYRYRYBYBYRPBPBPBPBPBYRYBPBPRYBPBYRYRPRYBYBYBYRPRPBPBPRYRPBYBYBPBYRYRPRPBPBPBPRYBYBYRYRPRPRYBPRPBYRPBPRYRPRYBPRYBYBYRYRYBYRYRYBYRPBPBPBYBPBPRPBPRYRPRYBYBPBPRPBPBPRPRPBYRYRPBPBPBYRPBYBYBYRPBPRPBPRYBPRPRYBPRPBPBYRYRYRYBYRPRPRYBYBYBPBPRPBPRYRYRPRPRPBPBPRPRPBYBYRPRPRPBYBYRPBYBPRPRPRPRPRPBPB...
output:
0
result:
ok 1 number(s): "0"
Test #13:
score: 0
Accepted
time: 1952ms
memory: 17456kb
input:
50000 PRPRYBPBYBYBPBYRPBYRYBPBPBPRPRPBYBYRPRPRPRPRPRYRYBYRPBPBPRYRPRPBPRPBPRPRPRPBYRYRYRPBYBYRYRPRPRPRPRYBYBYBYBPBPRPBPBPRYRPRYRPRPRYRPRPBPBYRYBPRPRYRPBPBYBYBPBYRPBPRYRPRYRYBPBPBPRPBPRPRPRYBPBPBYBYBPRYRPRYRPBYRYBYRYRPBYBPBPRPRYRPRYBYRPRPRYBYBYBPBYRYRYRYRYRYRPBYBYRYRYBYRPRYRPBPBYBYRYBPBYBPRYBPBYRYBPR...
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 1988ms
memory: 18572kb
input:
50000 YRPRPBPRYRYRPRYBPBYRPRPBYRYRYRPBPBYRPRYBYBYBPRYRPBPRPBPBYRPRPRPBPBYBYBPRPRPRYRYRYBYRPBYBPBPRYBPRYBYBYBPBYBYBPBPBPRYRPRPBYRYBYRPRYBYRPRYRPRPRYRPBYRYRYBYRYRPRYRYRPBPRPBYRYRPBYRPBPBPBPRPBYBYBPRYBPBPBYRYRYBYRPRPBPRYBPRPBYRPBYBYBPBPRPBYRYRPRPBPRPBPBYRPRPBYRPRPRYRYRPBYBYBPBPBYBPBYBYRYBYRPBPBPBPRYRPB...
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 1964ms
memory: 17228kb
input:
50000 YBPBYRPRYRPRPBPBYBYRPBYRPBPRPRPBPBPBYRYBYRPBYRYRPBYRPRPRYBPRYRYBYBPRPRYBYBPRPRPRYRPRYBPRPBYRPBYRPBYRPRPBPBPRPBPBYRYBPRPBPBPBPBYRYRPRPRYBYRPRYBYBYBYBYRYRPBPRYRYRPRYBPRPBPRPRPRPRPBPRPBYBPBPBPBYRPBYBPBPRPBYRPRPRYRYBYRPRPBPRYBYRPBPRPBPRYRPRYBYRYBYBPRPRPRPBYRPBPBYRYRPBPRYBPRYBPRYBPRYBYRPBYBPBPBYRPR...
output:
0
result:
ok 1 number(s): "0"
Test #16:
score: 0
Accepted
time: 165ms
memory: 10604kb
input:
5000 PR?BPB?BY?PRY??RPB?R??YBY?P?YRPBYBPRP?YBYBYRPRPB?BPBPR?RYR??Y??RYR?BPRYR?RPRP?Y?PRY?Y?YB??PBYRYR?RPB?BPB?BY?P?Y?YBY??RPB?BPRPBY???PRP?YB?R?RP?PR?BPB???R?B?RP?PBYB?BPRYBP?P??B?RPRP???P???PRYB?RYRP?Y??RPR?BP?PR?BPBPRYR?B??PB??YBPB?B?BY?YB?RY?PR?RYB???BYBP?Y??RYRYB?RYBYBPBYRYBP?YBYR?RPBYBY?YRP??R?...
output:
101508706
result:
ok 1 number(s): "101508706"
Test #17:
score: 0
Accepted
time: 178ms
memory: 12412kb
input:
5000 Y?P?PBYBYBPBYB?RYBPRPB?B??YRY??RP?PB??P??BYR?B?BP??R?R?R?BYBP??BY?Y?PBY?Y?YR?RY?PRPR?R?RPR?RPR?BYR?B?B?RPRPR?RP?Y?YRP?Y??RYB????YRY?YR?BP?YB?B??Y??B?RPBYR?RP????B?RPR??????P?PRPR?RP?PR?????BP?P?YB?BYRP?PBP?YBYB?RPR?R?B?BYRYR?RPBPBY??BYBPRYRPBPB?R?RPR?BYBP?YRY?PR?BPR?RY????BYBYB?RYRP???Y???PBY?Y...
output:
748282195
result:
ok 1 number(s): "748282195"
Test #18:
score: 0
Accepted
time: 165ms
memory: 12324kb
input:
5000 P?PRPRPBP??RYB??YBPBYRYB?BP?YB?B?BY??R?BYRP??BPRY?YBYB?RY????B??????PB?RP?P??R?BPB?BY?PR?RPBPBPR?BY?YB?BYBYRYBYRYBY?Y??RP?YR?R?R?BY?PBY??RYBPBYBYBY?PBY?P?YB?RYR???RY?YBY?YRYRY?PBY?P?PBYRPRY?PBP???PBYRPRY?Y?P?P?Y?PR???B?B?RP???PBY?P?PR???BP?PR????P?YB??YR??YRYBYR?B?BP??BPB??P?Y?PRYRY?YB??YR?RY?Y...
output:
24097861
result:
ok 1 number(s): "24097861"
Test #19:
score: 0
Accepted
time: 168ms
memory: 10608kb
input:
5000 ??PBPRYBPR??PRP?PRYBY???P?YRPBYBY?YR?RYR??Y?P?YRPR?BPBY?PRPRYB?RYBY?P?????YBPBYBY?Y??BY?PB???BP?P?Y???YR??YBP???YRYB?BPBPRP???PRY??B???BPB???R?RP?PB???BYRP?YB?BP??RP?PBYRPRPR??P??RY????B?????RP?YBYBPRYBYB?RYRYBP??RPB??YRPBY?PBPBP?YRYBPR?BPRYBPB???BYR?RY?PB?RYRY??BYRP?Y?YRP?PRPR????Y?PRPRYBP?YBP...
output:
447561693
result:
ok 1 number(s): "447561693"
Test #20:
score: 0
Accepted
time: 169ms
memory: 12296kb
input:
5000 P?P?P??????BPR?RY?PR??Y?Y??BPR??PB?B??PRP?YB???RPRPRPBY??R??PRYBYR?RPR?BP??R?B?RYRPRP??B?BYRY??R?RP???P?PRP??RY??RY?YBY???????P?Y?PBPRYBPRYRY?P?PB?BPR??P?Y?Y?Y?PR?RPB??Y??BYRP?PRPRY??R?RYBPR??YBP??B?RPRYBPR?BP??BYBYBPRYRPBPRPRY?Y?YBYRPBP?PB??Y?P??????R?BPBYR???BPR?B?R???BYR?BP?P?Y?YRY?PR??YBYB?...
output:
987042679
result:
ok 1 number(s): "987042679"
Test #21:
score: 0
Accepted
time: 169ms
memory: 10364kb
input:
5000 PRPBPRPRYRPRPBYBPBPBYRPBPBPBYRYRYBPBYRPRYBPBPRYBPBYRPRYBYRYRPBPBPBPBYRPBYRYBYRPRYBPBPBPRYBPRYBYBPRPBPBYRYBPRPBYRYRPRYBPRPRPBYRPBYRYRPRPRYRYRYBYBPBPBPBPRPRPBPRPRYRPBYRYRYRPBPRPRYRPRPBYBYBPBPRPRYRPBPRYBPRYBPRPRYRPRYRPBPRYBPRPRYBYRPBYRPRYBPRPRYBYRPRYRYBPRYBPRPBPRPRPRYBYRYRYRYRPBPRPBPRPBPRPBPRYRYBY...
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 165ms
memory: 10564kb
input:
5000 PRYRYBPBPRYRYRYRPBPBYBYRPBPBYRPRPRYBYRPRYRPBPRYBPBYRPRYRYRYBPBPBYBPBYBPBYRYRYRYRYBYRPRPBYRYBPRYBYBPRPRPBYRYRYRPBYBPBPRPRYRPRPBPRYBYBPBPBYBPBPBPRPBYRYRYRYRPRYBYBPBYBYBPBYBYRPRYRPRPRYBYRYBYRYRYBYBYRPBPRYRYRPRPRPRPRYRPRYRYRPBYBYRPBYBPBPRYBPBYBPBPRYRYRPBPRPRPBPRYRPRYBPBYRPRYBPBYRYBPRPRYRYBYBPRPBYBP...
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 165ms
memory: 10380kb
input:
5000 PBYRYRYBYBPBYBYBPBYBYRPRYBYRPRPBYRYBPRYBPRPRYRYRPBYRYRPRYRYBPBYBPBPRPBPRPBPBP?YRPBYBYBPRPRPBPRYRPRYBPRYRYBYRPRYBYBPBYRPBPBYBYRYBPRPBYRYBPBYBYRYRYRPRPRYBYBPRYRPRYBYBYBPRYBPBYRYBPBPRPRPBYBYRYBYRPRYBYBYBYBYBPBYRPRPRPRPRYBYRPRYRYRYBYRPBYRPBPRPRYBPBYBYRPRYBPRYBPRPRPRPBYRPRPBYRYBY?PRYRYRYBPRYRYBYRYBY...
output:
172032
result:
ok 1 number(s): "172032"
Test #24:
score: 0
Accepted
time: 165ms
memory: 10600kb
input:
5000 ????YRPB??PB??Y?Y??R??P?PRY?P??B??PBPBP???PRP??RY??RP?YRYB?R?BY?P??B?B??Y??R?RYRYRP???P?YBPR?R????YBP???P????R?R?BPR??Y?Y?YBP?Y??RY???PR??????P?P?Y??B?R?????B??Y?Y??BY??B?B???RYR???R?RY??RP?PR?RY?PB??Y?P?P???P??B?R??YR?BYRY??????R??Y??RYRPBYR??Y?P?P??B?RP?Y??B?BPBP?P???Y??B?RY?YBYB?RYRYRYBYB???...
output:
589400951
result:
ok 1 number(s): "589400951"
Test #25:
score: 0
Accepted
time: 169ms
memory: 12220kb
input:
5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
312356960
result:
ok 1 number(s): "312356960"
Test #26:
score: 0
Accepted
time: 1963ms
memory: 19284kb
input:
50000 YR?BPR?BP??B??YBY?PRY?PRYB??PB?BPBY??R???RPR??Y?Y???PR???BPBPRPRY?Y?P?Y?P?YR??YR?RP?YRP??B?B???R??YR?BPR?B?R?R??Y?YBYRPR?BPBPRPRPB??YBPR??PR??Y??RYBY??RPRPB??YBPR??PBY?PBPBPRPRPRYRYB??YR?BYRP?P??RYR?R?R?RPBP?Y?YR??YBYR??YRYR???BPRPR???BP??B?BPBYBYBYR?B?RPRPBP?P?YBPB?R?BPBPR?BP?PRYRPB?BY?Y??B?B...
output:
61578469
result:
ok 1 number(s): "61578469"
Test #27:
score: 0
Accepted
time: 1959ms
memory: 17412kb
input:
50000 Y??RPRP?PBYR?BPRPBYB??YBP?PBPB?????B?BYRYBPBYBPRPRYBP?P?YB?B??PBY?PB?R?RPR?RYBY?Y?PBY????B??YBYRPRY??BYR??PRPBP?P?P?Y?YBPRPBYBPRP???Y?P??RPBYBPBY??BY?Y?YRPB??Y?PBYB??P?Y?PRYBY?YBY??R?B??PR???BYRYB?RPBPBPBPR?RP??BYRYB?BP?PRP?P?YBPRP?PBYR???R?RPBP?P?YB?RPR?RYRP??B?RYRYRYBP??B???BYRYRPB??YRPRYBPB...
output:
21239954
result:
ok 1 number(s): "21239954"
Test #28:
score: 0
Accepted
time: 1962ms
memory: 18824kb
input:
50000 YR??PB?BP???YRP??BYRPRP?P?PRPRPR?RPRPBYBPBY??B?B?RPRPBYRP??R?B??PR??P?PR?RYBPRPRY????R?R?RY??B?RYB?R?B?BYBPB??YRYRYBY?P?PR?B?RP??RP?YRPRYBPBYB?BYBP????RYRYR?BPRP?YRY?PB???BP??????BPR?RP?YBPB?RY?PBPBP??BYRP?YBYRP?YBYB?RPRYBYBP?YBY?YB?R??PBYBY?PB?R????P??BPRPRPRY???P???PBPRYRYB?RP?YBYRYRY????RP?...
output:
268137953
result:
ok 1 number(s): "268137953"
Test #29:
score: 0
Accepted
time: 1946ms
memory: 18524kb
input:
50000 P???PR?RYBPB?RPBYB??YR??PB??YBPBP?Y?P??R?RYBPRPBYB??YB?R????YR?RPRPB?RYB?RPRP???PBYBY?YB?BYR??PR?B???B?R?RPR?RPR??PR?BYBPR????P???P?YRPR??P?PRYRYB?BYBY???P?PB?R??P??RYBPB?R?RYB???B????PRPRYR???BYRYR?B??PBP???PRP?P?YR??YRP??B?BY?Y?PRPRPRYRYRYRPRY?Y??RPBY?YR?BPRPB?R?BYR?BY??BY?P?Y?YBYRYBYRY?P??R...
output:
903429393
result:
ok 1 number(s): "903429393"
Test #30:
score: 0
Accepted
time: 1955ms
memory: 18856kb
input:
50000 P??RPBYB?RP?Y??BPBPBPBYRPRPBYRP?YR??P?PBY?Y?????PRYBPBP?Y??BY??BPR?BYB???R?B??YBYRP??BP?YBPRP?YBP?P?Y?PR??YRPBYBPR?BPBY?PRY??RP???PRYBP?YRP?P??R??P?YBPR??P?PRYB?BPRYRYBP??BYB?RP??RPB??PR?R??YBPR?B??YBY?Y???P??BYRP????RYB?RYR?BP?YBP?P???P?PB??PR?RP?PR?R??P?YB?B??P?YRY?Y??RY?P?YBYBYRYRY?YRPBYBYB...
output:
360140728
result:
ok 1 number(s): "360140728"
Test #31:
score: 0
Accepted
time: 1956ms
memory: 17316kb
input:
50000 PBYRYRYBYRYBYRPBYRPBPBYBYRYBYBPRPBYRYRYBYRPBPRYBYRYRYRYBYRYRYRPRYBYRPRPRPRYRPBYRPRPBYRPBYRYRPBYRYBPRYRPRYBYBYRYBPRPBYBPRPRPRYRPRYRPRYRPBYBPRPRYRYRPRPRPBYRYRYRPRPBPRPRYRYRYBYRYRYRPBYBYRPBPBYRPRPBPRYBPRPBYBPBPBPBYRYRPRPBYRPBYRYBPRPBYRYBPBPRPRPBYBPRYRPBYBYBYRPRYBYBYBPBYBPBPRYRYRYRPRYBYBYBPBPBYBPR...
output:
0
result:
ok 1 number(s): "0"
Test #32:
score: 0
Accepted
time: 1967ms
memory: 17332kb
input:
50000 PRYRPBPRYRYBYRYBYRYRYRPRPBPRPRYBYBPBYRPRYRYRYRYRPBYBPRPRPRPRPRPRYBPRPBYBPBYBYBYRPRPBYBYBYBYBPRPBYBPBPRYRYBYBPBYRYBYRPBYRYRYRYBYBYRYBYRPRPBPBPBPBPBPRPRYBYRYRPBPRPRYBYRPRYRYRYRYRPRPRYRPBPRYRYRPBYBPRPBYRYRYBYRYBPRYBYRYRPRYBYBPRPBYRPBYBYRYRYRYBPBPRPBYBPBYRYBYRPBPBYBPRYBYRYBPBYRYRPBYBPBYBPRPBYBYRYB...
output:
0
result:
ok 1 number(s): "0"
Test #33:
score: 0
Accepted
time: 1972ms
memory: 19272kb
input:
50000 PBPRPBYRPRYBYBYRPBPBYRPBPRPBPBPBYRPBYBYRPRYBPRPRYRYBPBPBYRPRYRYRPBYRYRPBPBYRPBPBYRPBYRYBYRYBYBYRYBPRPBYRYRYRPBYRPBYBPRYRYBPRYBYBYRPBPRYRYRYBYRPBPBPBPBPRYBYRPBYBYRYRYBYRYRYBYRPRYRPBYRPBPRYBYRPBPBYRYRPRYRYRYBPBYRPRPRPBPRPRYRPBPBYBPBPBYBYBYBPBYBPRPBYBYRPRPBYBPRPBPRPBYRPBPRYRPRYRYRYBPRPRPRYRPBYBPR...
output:
0
result:
ok 1 number(s): "0"
Test #34:
score: 0
Accepted
time: 1970ms
memory: 19388kb
input:
50000 ?BY???P????RPB??P???YB?R?BY?YR????PR??P???????P?YRP?PRY?PB??Y?YR???B??Y?YR?BPRYR?B?B?BPRY?Y???PRY?PBYBPRP?Y?PBY?YRP?PR?R??PRYRY?Y?Y?Y?P?PBPB?RP?PRY?P???PRY???P???P???PB?B?B?B?B?BYBP?PR????P??BYRY??????R?B??P?????PBY??R?B??Y?YB??PBPB?B???R?BP??B?BPB?R????YR????YBP?P?YR????Y?PRPB??Y????R?R?RY??B...
output:
908700788
result:
ok 1 number(s): "908700788"
Test #35:
score: 0
Accepted
time: 1958ms
memory: 18520kb
input:
50000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
422064317
result:
ok 1 number(s): "422064317"