QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#234793 | #7559. Bocchi the Rock | kkio | AC ✓ | 8452ms | 7832kb | C++17 | 6.6kb | 2023-11-01 22:31:13 | 2023-11-01 22:31:14 |
Judging History
answer
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize("Ofast","unroll-loops","inline")
#include <bits/stdc++.h>
using namespace std;
namespace Def{
#define fir first
#define sec second
#define lson (tr[i].ls)
#define rson (tr[i].rs)
#define FIO(file) freopen(file".in","r",stdin), freopen(file".out","w",stdout)
#define Untie sync_with_stdio(0), cin.tie(0),cout.tie(0)
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef __int128_t i128;
}
using namespace Def;
namespace FastIO {
struct IO {
char ibuf[(1 << 20) + 1], *iS, *iT, obuf[(1 << 20) + 1], *oS;
IO() : iS(ibuf), iT(ibuf), oS(obuf) {} ~IO() { fwrite(obuf, 1, oS - obuf, stdout); }
#if ONLINE_JUDGE
#define gh() (iS == iT ? iT = (iS = ibuf) + fread(ibuf, 1, (1 << 20) + 1, stdin), (iS == iT ? EOF : *iS++) : *iS++)
#else
#define gh() getchar()
#endif
inline bool eof (const char &ch) { return ch == ' ' || ch == '\n' || ch == '\r' || ch == 't' || ch == EOF; }
inline long long read() {
char ch = gh();
long long x = 0;
bool t = 0;
while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gh();
return t ? ~(x - 1) : x;
}
inline void read (char *s) {
char ch = gh(); int l = 0;
while (eof(ch)) ch = gh();
while (!eof(ch)) s[l++] = ch, ch = gh();
}
inline void read (double &x) {
char ch = gh(); bool t = 0;
while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = gh();
if (ch != '.') return t && (x = -x), void(); ch = gh();
for (double cf = 0.1; '0' <= ch && ch <= '9'; ch = gh(), cf *= 0.1) x += cf * (ch ^ 48);
t && (x = -x);
}
inline void pc (char ch) {
#ifdef ONLINE_JUDGE
if (oS == obuf + (1 << 20) + 1) fwrite(obuf, 1, oS - obuf, stdout), oS = obuf;
*oS++ = ch;
#else
putchar(ch);
#endif
}
inline void write (char *s)
{
int len = strlen(s);
for(int i = 0; i < len; i++)pc(s[i]);
}
template<typename _Tp>
inline void write (_Tp x) {
static char stk[64], *tp = stk;
if (x < 0) x = ~(x - 1), pc('-');
do *tp++ = x % 10, x /= 10;
while (x);
while (tp != stk) pc((*--tp) | 48);
}
inline void puts(const char *s){
int len = strlen(s);
for (int i = 0; i < len; i++)pc(s[i]);
}
} io;
inline long long read () { return io.read(); }
template<typename Tp>
inline void read (Tp &x) { io.read(x); }
template<typename _Tp>
inline void write (_Tp x) { io.write(x); }
}
using namespace FastIO;
namespace misc{
constexpr int infi = 1e9;
constexpr int minfi = 0x3f3f3f3f;
constexpr ll infl = 1e18;
constexpr ll minfl = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 998244353;
constexpr int inv2 = (mod+1)/2;
constexpr int inv3 = (mod+1)/3;
mt19937_64 rnd(0x3494393);
template<typename T,typename E>
inline T ksm(T b,E p){T ret=1;while(p){if(p&1)ret=1ll*ret*b%mod;b=1ll*b*b%mod;p>>=1;}return ret;}
template<typename T,typename E>
inline void cmax(T &a,E b){a<b?(a=b,1):0;}
template<typename T,typename E>
inline void cmin(T &a,E b){a>b?(a=b,1):0;}
template<typename T,typename E>
inline void cadd(T &a,E b){(a+=b)>mod?(a-=mod):0;}
template<typename T,typename E>
inline void cmul(T &a,E b){a=1ll*a*b%mod;}
template<typename T,typename E>
inline T inv(T v){return ksm(v,mod-2);}
template<typename T,typename E>
inline T madd(T a,E b){return a+b>=mod?a+b-mod:a+b;}
template<typename T,typename E>
inline T mmul(T a,E b){return 1ll*a*b%mod;}
template<typename T>
struct dseg{T *first,*last;dseg(T* _l,T* _r):first(_l),last(_r){}};
inline void debug(void){cerr<<'\n';}
template<typename T,typename... arg>
inline void debug(T x,arg... r){cerr<<x<<' ';debug(r...);}
template<typename T,typename... arg>
inline void debug(dseg<T> A,arg... v){cerr<<"[ ";for(T* i=A.first;i!=A.last;++i)cerr<<*i<<' ';cerr<<"] ";debug(v...);}
#define binom(n,m) (n<0||m<0||n<m?0:1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod)
template<typename T>
inline T randseg(T l,T r){return rnd()%(r-l+1)+l;}
#define likely(x) (__builtin_expect(!!(x),1))
#define unlikely(x) (__builtin_expect(!!(x),0))
}
using namespace misc;
const int maxn=1e5+10;
int n,f[2][maxn][2][2];
char s[maxn];
inline void trans(int o,int len,int cp,int ce)
{
cadd(f[o^1][len][0][ce],f[o][len][0][ce]);
cadd(f[o^1][len][1][ce],f[o][len][1][ce]);
cadd(f[o^1][len-1][!cp][ce],f[o][len][cp][!ce]);
cadd(f[o^1][len+1][cp][ce],f[o][len][!cp][!ce]);
}
int main()
{
n=read();n<<=1;
io.read(s);
if(s[0]!='Y')f[0][0][0][1]=1;
if(s[0]!='P')f[0][0][0][0]=1;
for(int i=1,o=0;i<n-1;i+=2)
{
if(likely(s[i]!='B'&&s[i+1]!='P'))cadd(f[o^1][0][0][0],f[o][0][0][0]),cadd(f[o^1][1][0][0],f[o][0][0][1]);
if(likely(s[i]!='B'&&s[i+1]!='Y'))cadd(f[o^1][0][0][1],f[o][0][0][1]),cadd(f[o^1][1][0][1],f[o][0][0][0]);
if(likely(s[i]!='R'&&s[i+1]!='P'))cadd(f[o^1][0][0][0],f[o][0][0][0]),cadd(f[o^1][1][1][0],f[o][0][0][1]);
if(likely(s[i]!='R'&&s[i+1]!='Y'))cadd(f[o^1][0][0][1],f[o][0][0][1]),cadd(f[o^1][1][1][1],f[o][0][0][0]);
for(int len=1;likely(len<=i/2);len++)
{
if(likely(s[i]!='B'&&s[i+1]!='P'))trans(o,len,0,0);
if(likely(s[i]!='B'&&s[i+1]!='Y'))trans(o,len,0,1);
if(likely(s[i]!='R'&&s[i+1]!='P'))trans(o,len,1,0);
if(likely(s[i]!='R'&&s[i+1]!='Y'))trans(o,len,1,1);
}
#pragma GCC unroll(2)
for(int e=0;e<=1;e++)
cadd(f[o^1][0][0][e],f[o^1][0][1][e]),f[o^1][0][1][e]=0;
for(int len=0;len<=i/2;len++)
#pragma GCC unroll(2)
for(int p=0;p<=1;p++)
#pragma GCC unroll(2)
for(int e=0;e<=1;e++)
f[o][len][p][e]=0;
o^=1;
}
int o=(n/2-1)&1;
int ans=f[o][0][0][0]+f[o][0][0][1];
if(s[n-1]=='?')ans*=2;
ans%=mod;
if(s[n-1]!='B')cadd(ans,f[o][1][0][0]),cadd(ans,f[o][1][0][1]);
if(s[n-1]!='R')cadd(ans,f[o][1][1][0]),cadd(ans,f[o][1][1][1]);
write(ans);
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5592kb
input:
2 ????
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 0ms
memory: 5716kb
input:
3 ??YR?B
output:
4
result:
ok 1 number(s): "4"
Test #3:
score: 0
Accepted
time: 0ms
memory: 5648kb
input:
5 YBYRPBYRYB
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 5788kb
input:
10 PRPBPRPRPRPBYB?R?BY?
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 0ms
memory: 5768kb
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: 5788kb
input:
10 YRPRYRY???P?YB?BYRY?
output:
32
result:
ok 1 number(s): "32"
Test #7:
score: 0
Accepted
time: 1ms
memory: 5600kb
input:
10 PBYBPRPBYRPBYRYBPRPB
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 1ms
memory: 5768kb
input:
10 PBPRPRYBYRYRYB?B?RYB
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 1ms
memory: 5596kb
input:
10 PRP?PBPRYR??Y?YRPB?R
output:
12
result:
ok 1 number(s): "12"
Test #10:
score: 0
Accepted
time: 0ms
memory: 5648kb
input:
10 ?RYB??P??B?B?B???RPR
output:
416
result:
ok 1 number(s): "416"
Test #11:
score: 0
Accepted
time: 2826ms
memory: 6644kb
input:
50000 YBPBYRPRPRPRPBPRPBPBPBYRPRPBPBYRPBPRYBYBPBPBPRPBPBYRYBYRPBYRYRPBYRYRYRPBYBYRPBPBYBYBPBYRPBPBYBYBYRPBPRYBPBYBPRPRYBPRPBYBPRPBYRPBYBPRYBPBPBYRYBYBYBPRYBYRPRPRPRPRYRYBPBPBPBPRPRYBYRYBPRPRPRPBYBPBPRYRPRPBYRPBYRYRPBYBYBPBYRYRPBPRYBPRYBPBPBYRPBPBYBYBPRPBYBYBYRYRPBPRPRPRPRPRYBPBPBPRYBYRPRPRYBYRPRPBYR...
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 2809ms
memory: 6820kb
input:
50000 YRPBPBYRYRYRYBYBYRPBPBPBPBPBYRYBPBPRYBPBYRYRPRYBYBYBYRPRPBPBPRYRPBYBYBPBYRYRPRPBPBPBPRYBYBYRYRPRPRYBPRPBYRPBPRYRPRYBPRYBYBYRYRYBYRYRYBYRPBPBPBYBPBPRPBPRYRPRYBYBPBPRPBPBPRPRPBYRYRPBPBPBYRPBYBYBYRPBPRPBPRYBPRPRYBPRPBPBYRYRYRYBYRPRPRYBYBYBPBPRPBPRYRYRPRPRPBPBPRPRPBYBYRPRPRPBYBYRPBYBPRPRPRPRPRPBPB...
output:
0
result:
ok 1 number(s): "0"
Test #13:
score: 0
Accepted
time: 2805ms
memory: 7368kb
input:
50000 PRPRYBPBYBYBPBYRPBYRYBPBPBPRPRPBYBYRPRPRPRPRPRYRYBYRPBPBPRYRPRPBPRPBPRPRPRPBYRYRYRPBYBYRYRPRPRPRPRYBYBYBYBPBPRPBPBPRYRPRYRPRPRYRPRPBPBYRYBPRPRYRPBPBYBYBPBYRPBPRYRPRYRYBPBPBPRPBPRPRPRYBPBPBYBYBPRYRPRYRPBYRYBYRYRPBYBPBPRPRYRPRYBYRPRPRYBYBYBPBYRYRYRYRYRYRPBYBYRYRYBYRPRYRPBPBYBYRYBPBYBPRYBPBYRYBPR...
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 2809ms
memory: 6460kb
input:
50000 YRPRPBPRYRYRPRYBPBYRPRPBYRYRYRPBPBYRPRYBYBYBPRYRPBPRPBPBYRPRPRPBPBYBYBPRPRPRYRYRYBYRPBYBPBPRYBPRYBYBYBPBYBYBPBPBPRYRPRPBYRYBYRPRYBYRPRYRPRPRYRPBYRYRYBYRYRPRYRYRPBPRPBYRYRPBYRPBPBPBPRPBYBYBPRYBPBPBYRYRYBYRPRPBPRYBPRPBYRPBYBYBPBPRPBYRYRPRPBPRPBPBYRPRPBYRPRPRYRYRPBYBYBPBPBYBPBYBYRYBYRPBPBPBPRYRPB...
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 2798ms
memory: 6492kb
input:
50000 YBPBYRPRYRPRPBPBYBYRPBYRPBPRPRPBPBPBYRYBYRPBYRYRPBYRPRPRYBPRYRYBYBPRPRYBYBPRPRPRYRPRYBPRPBYRPBYRPBYRPRPBPBPRPBPBYRYBPRPBPBPBPBYRYRPRPRYBYRPRYBYBYBYBYRYRPBPRYRYRPRYBPRPBPRPRPRPRPBPRPBYBPBPBPBYRPBYBPBPRPBYRPRPRYRYBYRPRPBPRYBYRPBPRPBPRYRPRYBYRYBYBPRPRPRPBYRPBPBYRYRPBPRYBPRYBPRYBPRYBYRPBYBPBPBYRPR...
output:
0
result:
ok 1 number(s): "0"
Test #16:
score: 0
Accepted
time: 44ms
memory: 5812kb
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: 43ms
memory: 5724kb
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: 44ms
memory: 5888kb
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: 44ms
memory: 5760kb
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: 39ms
memory: 5880kb
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: 28ms
memory: 5684kb
input:
5000 PRPBPRPRYRPRPBYBPBPBYRPBPBPBYRYRYBPBYRPRYBPBPRYBPBYRPRYBYRYRPBPBPBPBYRPBYRYBYRPRYBPBPBPRYBPRYBYBPRPBPBYRYBPRPBYRYRPRYBPRPRPBYRPBYRYRPRPRYRYRYBYBPBPBPBPRPRPBPRPRYRPBYRYRYRPBPRPRYRPRPBYBYBPBPRPRYRPBPRYBPRYBPRPRYRPRYRPBPRYBPRPRYBYRPBYRPRYBPRPRYBYRPRYRYBPRYBPRPBPRPRPRYBYRYRYRYRPBPRPBPRPBPRPBPRYRYBY...
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 28ms
memory: 5792kb
input:
5000 PRYRYBPBPRYRYRYRPBPBYBYRPBPBYRPRPRYBYRPRYRPBPRYBPBYRPRYRYRYBPBPBYBPBYBPBYRYRYRYRYBYRPRPBYRYBPRYBYBPRPRPBYRYRYRPBYBPBPRPRYRPRPBPRYBYBPBPBYBPBPBPRPBYRYRYRYRPRYBYBPBYBYBPBYBYRPRYRPRPRYBYRYBYRYRYBYBYRPBPRYRYRPRPRPRPRYRPRYRYRPBYBYRPBYBPBPRYBPBYBPBPRYRYRPBPRPRPBPRYRPRYBPBYRPRYBPBYRYBPRPRYRYBYBPRPBYBP...
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 28ms
memory: 5892kb
input:
5000 PBYRYRYBYBPBYBYBPBYBYRPRYBYRPRPBYRYBPRYBPRPRYRYRPBYRYRPRYRYBPBYBPBPRPBPRPBPBP?YRPBYBYBPRPRPBPRYRPRYBPRYRYBYRPRYBYBPBYRPBPBYBYRYBPRPBYRYBPBYBYRYRYRPRPRYBYBPRYRPRYBYBYBPRYBPBYRYBPBPRPRPBYBYRYBYRPRYBYBYBYBYBPBYRPRPRPRPRYBYRPRYRYRYBYRPBYRPBPRPRYBPBYBYRPRYBPRYBPRPRPRPBYRPRPBYRYBY?PRYRYRYBPRYRYBYRYBY...
output:
172032
result:
ok 1 number(s): "172032"
Test #24:
score: 0
Accepted
time: 54ms
memory: 5676kb
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: 84ms
memory: 5752kb
input:
5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
312356960
result:
ok 1 number(s): "312356960"
Test #26:
score: 0
Accepted
time: 4405ms
memory: 6964kb
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: 4391ms
memory: 7092kb
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: 4369ms
memory: 7248kb
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: 4365ms
memory: 6852kb
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: 4398ms
memory: 6668kb
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: 2842ms
memory: 7244kb
input:
50000 PBYRYRYBYRYBYRPBYRPBPBYBYRYBYBPRPBYRYRYBYRPBPRYBYRYRYRYBYRYRYRPRYBYRPRPRPRYRPBYRPRPBYRPBYRYRPBYRYBPRYRPRYBYBYRYBPRPBYBPRPRPRYRPRYRPRYRPBYBPRPRYRYRPRPRPBYRYRYRPRPBPRPRYRYRYBYRYRYRPBYBYRPBPBYRPRPBPRYBPRPBYBPBPBPBYRYRPRPBYRPBYRYBPRPBYRYBPBPRPRPBYBPRYRPBYBYBYRPRYBYBYBPBYBPBPRYRYRYRPRYBYBYBPBPBYBPR...
output:
0
result:
ok 1 number(s): "0"
Test #32:
score: 0
Accepted
time: 2769ms
memory: 7832kb
input:
50000 PRYRPBPRYRYBYRYBYRYRYRPRPBPRPRYBYBPBYRPRYRYRYRYRPBYBPRPRPRPRPRPRYBPRPBYBPBYBYBYRPRPBYBYBYBYBPRPBYBPBPRYRYBYBPBYRYBYRPBYRYRYRYBYBYRYBYRPRPBPBPBPBPBPRPRYBYRYRPBPRPRYBYRPRYRYRYRYRPRPRYRPBPRYRYRPBYBPRPBYRYRYBYRYBPRYBYRYRPRYBYBPRPBYRPBYBYRYRYRYBPBPRPBYBPBYRYBYRPBPBYBPRYBYRYBPBYRYRPBYBPBYBPRPBYBYRYB...
output:
0
result:
ok 1 number(s): "0"
Test #33:
score: 0
Accepted
time: 2833ms
memory: 7104kb
input:
50000 PBPRPBYRPRYBYBYRPBPBYRPBPRPBPBPBYRPBYBYRPRYBPRPRYRYBPBPBYRPRYRYRPBYRYRPBPBYRPBPBYRPBYRYBYRYBYBYRYBPRPBYRYRYRPBYRPBYBPRYRYBPRYBYBYRPBPRYRYRYBYRPBPBPBPBPRYBYRPBYBYRYRYBYRYRYBYRPRYRPBYRPBPRYBYRPBPBYRYRPRYRYRYBPBYRPRPRPBPRPRYRPBPBYBPBPBYBYBYBPBYBPRPBYBYRPRPBYBPRPBPRPBYRPBPRYRPRYRYRYBPRPRPRYRPBYBPR...
output:
0
result:
ok 1 number(s): "0"
Test #34:
score: 0
Accepted
time: 5283ms
memory: 7384kb
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: 8452ms
memory: 7336kb
input:
50000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
422064317
result:
ok 1 number(s): "422064317"