QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214875#5474. Incredibly Cute Penguin ChickswxhtzdyAC ✓891ms349812kbC++202.8kb2023-10-15 00:49:492023-10-15 00:49:49

Judging History

你现在查看的是最新测评结果

  • [2023-10-15 00:49:49]
  • 评测
  • 测评结果:AC
  • 用时:891ms
  • 内存:349812kb
  • [2023-10-15 00:49:49]
  • 提交

answer

#include<bits/stdc++.h>

#define pb push_back
#define fi first
#define se second
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;

template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int cys=998244353;

int mod(int x){return x%cys;}

int n,a[1000005],pref[4][1000005][2],dp[1000005],g[4][1000005],v[4][1000005],len[4][1000005];
char s[1000005];
vector<int> fenw[4][1000005];

void set_size(int x,int y,int k){
	fenw[x][y].resize(k+2);
	len[x][y]=k;
}

void change(int x,int y,int p,int v){
	for(p++;p<=len[x][y];p+=p&-p) fenw[x][y][p]=mod(fenw[x][y][p]+v);
}

int ask(int x,int y,int p){
	int ret=0;
	for(p++;p>0;p-=p&-p) ret=mod(ret+fenw[x][y][p]);
	return ret;
}

/* struct f{
	vector<int> fnw;
	int n;
	f(){n=0;fnw.clear();}
	void set_size(int x){
		n=x; fnw.resize(x+1);
	}
	void change(int p,int v){
		for(++p;p<=n;p+=p&-p) fnw[p]=mod(fnw[p]+v);
	}
	int query(int p){
		int ret=0;
		for(p++;p>0;p-=p&-p) ret=mod(ret+fnw[p]);
		return ret;
	}
}fenw[4][1000005]; */

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++) a[i]=(s[i]=='C'?1:(s[i]=='I'?2:3));
	for(int mx=1;mx<=3;mx++){
		int x,y;
		if(mx==1) x=2,y=3;
		if(mx==2) x=3,y=1;
		if(mx==3) x=1,y=2;
		for(int i=1;i<=n;i++){
			pref[mx][i][0]=pref[mx][i-1][0];
			if(a[i]==x) pref[mx][i][0]++;
			if(a[i]==y) pref[mx][i][0]--;
		}
		vector<int> xs;
		for(int i=0;i<=n;i++) xs.pb(pref[mx][i][0]);
		sort(xs.begin(),xs.end());
		xs.erase(unique(xs.begin(),xs.end()),xs.end());
		for(int i=0;i<=n;i++) 
			g[mx][i]=(int)(lower_bound(xs.begin(),xs.end(),pref[mx][i][0])-xs.begin());
		for(int i=1;i<=n;i++){
			pref[mx][i][1]=pref[mx][i-1][1];
			if(a[i]==mx) pref[mx][i][1]+=2;
			if(a[i]!=mx) pref[mx][i][1]-=1;
		}
		map<int,vector<int>> ids;
		for(int i=0;i<=n;i++){
			ids[pref[mx][i][0]].pb(i);
		}
		for(auto&p:ids){
			xs.clear();
			xs.pb(-3000000);
			for(int i:p.se) xs.pb(pref[mx][i][1]);
			sort(xs.begin(),xs.end());
			xs.erase(unique(xs.begin(),xs.end()),xs.end());
			for(int i:p.se)
				v[mx][i]=(int)(lower_bound(xs.begin(),xs.end(),pref[mx][i][1])-xs.begin());
			assert(!p.se.empty());
			set_size(mx,g[mx][p.se[0]],xs.size());
		}
	}
	dp[0]=1;
	for(int i=0;i<=n;i++){
		for(int mx=1;mx<=3;mx++){
			int val=ask(mx,g[mx][i],v[mx][i]-1);
			dp[i]=mod(dp[i]+val);
		}
		for(int mx=1;mx<=3;mx++){
			change(mx,g[mx][i],v[mx][i],dp[i]);
		}
	}
	printf("%d\n",dp[n]);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 104540kb

input:

ICPC

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 11ms
memory: 105952kb

input:

CCCIIIPPP

output:

69

result:

ok single line: '69'

Test #3:

score: 0
Accepted
time: 8ms
memory: 97700kb

input:

PICCICCIPPI

output:

24

result:

ok single line: '24'

Test #4:

score: 0
Accepted
time: 492ms
memory: 169012kb

input:

PCPPCCICPICPCPCPCCPPIPPPIICCCICPICCPPPIPCCCCICCIICPCCICCCPCICIPPIPIPIPPCCPCIPPCCPPCCIPPPIPPCIICIIIPPCIPPICPPICCPIICCCCCCCICPCCPPIPIPICPCIICPCCIPICCCPPCPIIICPCPPPIIIIICCCPCICCPPCPPCICIIIPIPICPCPPPPICPCPIPIIICCICPCIPPICCICPIIPPCCCIICPCPCCICCPICPPPPPPICCCIPCCICICIPICIIICCICPCIPIICPIPIIICCPCCIIPCCCCPIPI...

output:

216523282

result:

ok single line: '216523282'

Test #5:

score: 0
Accepted
time: 471ms
memory: 174140kb

input:

ICIPCICCIPIPIIPPCPCICICPCPCPIIICICPPICCICPIPCPCIIPPIPCCIPIPIPIICCICICCCIPPIIPCPPCIIICCICCCCCCPIPICCIPIICIICPIPCCICPPCCIPIPIICCCPCCIPCPPCCIIIIIPCIPIIPICIIIPIICCCIPPPIPICIIIICIIIPICIICPIPCCICIPCCIPICCCPPIPIIPICPPCPICIPIPPPPPCIPCCIPPICIPCICPCCCCPPIIIPCPICCICIPIIPICPIIIIPPPCPIIIPCCPPIIPPICPIIICCCPICPPIC...

output:

977504498

result:

ok single line: '977504498'

Test #6:

score: 0
Accepted
time: 465ms
memory: 173760kb

input:

PPCCCICCIPPICCPCCCCIPPPIICPIPIPPPPIPPPPPPCPIPICCPCCPICPIPPPIIPIPIIPPCCPIICPPIIIPPCCCIIPCCIPCCCCCCIIIPIPCICCIICIIICCCCPCCICPPCCPCCIPICCPPIIPIIPIPCIIPIIPPPCCIPCPCCICCIPICPPPCIPPIPCCPCPCCIPIICCIPCCIPPCPCIPICIICPPICIIICIPIIIIIPCCCPPIPPPCIICIIIPPCIPCIPCIICCCCPIPCPICICPIPCPPIPIPICCPCCCCPCIPCPPCCIPCCCCCPII...

output:

785880133

result:

ok single line: '785880133'

Test #7:

score: 0
Accepted
time: 477ms
memory: 175212kb

input:

ICIPCPIPCCCCCCCPCCPCCIPCPCPIPPCPIPCICPPIPPPPICPIIPPIICPICPICPPICICICCCIIPCPPCCICCCCPIICPPPIPIPCICPIPPPPCCPICPCPICICPPIIIICIICPPIPIIICCCCPIPIIPICCCIPCCPPCPPPPIIIIICIPCPCCPIIICICIPPCCPIPPCIIPCCCIIICPCIPCIIIIPCIIPCIICCCIPPIPPCIIPCICIPIIPICCICCPCPIICCCIPIICCCPIPPCCIIIICPPIICPCPCIPPPCPCICPPIPIPCCPIPPPIPI...

output:

687587235

result:

ok single line: '687587235'

Test #8:

score: 0
Accepted
time: 472ms
memory: 173848kb

input:

IICCCIPIIIIIPICIICPCPCIICCIIICCCIIPICICCCPCPCPPPIIPIPPICIICICIPIICCICCIIIPCIICCPPIPICIPPCPCPCPIICCIIICIPPICCICPPIPPPPICPCPIPCCCPCPCPPPPIICPCIIIIIIIPIPIICICCPPIIPPCICPCPCIPCPICPPPICCICIICPPIPPPIPIPIPPCIPPCIPPCPPPIICICCCPICIPPIPCCPIIPPCIPPICCIIIPPPPPIIPPICPCPCIPPCCPCIIIPPICCCIIIIICIPPIIICPCIIICPPCPCPP...

output:

698376687

result:

ok single line: '698376687'

Test #9:

score: 0
Accepted
time: 491ms
memory: 175336kb

input:

IIPICCCCIPPCCPICCIIPPPCIPCCPPIPIICICPCCIIPPCCCICICPPICCICPPIICIIPICPICIPPPPCPCCPIICCPPIPPCIIIIPICICICCIIPPCICCCCCPICPIPCPPCCPPICPICCCICCIPICCICPIICCPIPIPICCPPCCPCPCCPICCPICCCCCCIPIICPIPICICCPIIPIPICIICIPPPIPCICIPIPPICPICICPPICICCIPCIPPPCIPIIPPPIICICPPPIICCCPIIICIPIPPICICIPPPCCPCCIIPCCCPPPCPICPICPPCP...

output:

850857669

result:

ok single line: '850857669'

Test #10:

score: 0
Accepted
time: 886ms
memory: 349812kb

input:

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

709758735

result:

ok single line: '709758735'

Test #11:

score: 0
Accepted
time: 872ms
memory: 342400kb

input:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

854001544

result:

ok single line: '854001544'

Test #12:

score: 0
Accepted
time: 891ms
memory: 347680kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

427000772

result:

ok single line: '427000772'

Test #13:

score: 0
Accepted
time: 150ms
memory: 174200kb

input:

IPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPC...

output:

717926203

result:

ok single line: '717926203'

Test #14:

score: 0
Accepted
time: 152ms
memory: 171584kb

input:

PCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCI...

output:

939976909

result:

ok single line: '939976909'

Test #15:

score: 0
Accepted
time: 142ms
memory: 171008kb

input:

CIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIPCIP...

output:

687951732

result:

ok single line: '687951732'

Test #16:

score: 0
Accepted
time: 689ms
memory: 297048kb

input:

IIIIIIIIICIIIIPIIIIIIIIPIIIPIIPIIIIIIIIIIIIPIIIIICIIIICIIIIIIIPCIIIIIIIIIPIIIIIIPIIIIICIIIIIIIIIIIIICIIIIIIICICIIIICIIIIIIPIIIIIIIIPIIIIIIICIIIIIPIIIIIIIIIIPCIPIICIPIIIICIIIIIIIIIIPICIIIIIPIIIIIIIIIIIIIIIPIIIIIIIIIIIIIIIIPIPPPCIPIIIICIIIIIIIIIIIIIIIIIIIICIIIIIIICIPIIIIPIIIIIIIIIIIIPIIIPICIIPIIIIIIII...

output:

955489074

result:

ok single line: '955489074'

Test #17:

score: 0
Accepted
time: 710ms
memory: 291568kb

input:

PPPPPPCPIPICPPPPPIPPPPPPPPPPCPPCPPPPPPPPPPPIPPPPPPPCPPPPPPPCIPICPIIPPPIPPPCCPPPPPPPPPPPPPPCPPPPPIPPCPPPPPPPPPPPPPPPCPPPPPPPIPPIPPPPPPPPPPPICIPPPPPPIIPCPPPCPPPCPPPPPPPPPPPPPICPPPPIPCPPPPPPCPIPPPPPPPPIPPPPPPPPPPPIIIPIPCPPPPPPPPPPPPPPIPPPPPPPPPPIPPPPCPPPPPPPPPPCPPIIPPPPPPPPPPPPPPPIPPPPPPPPPPPICPPPPPPPP...

output:

375091010

result:

ok single line: '375091010'

Test #18:

score: 0
Accepted
time: 694ms
memory: 296748kb

input:

CCCCCCCCCCCCCCCCPIPCCCCCCICCCCCCCCCCCCCICCCCCIPPCCCCCCCCCCICCCICCCCCCCCCCCCCCCCCPCCCCPCCPCCCCCCCCPCICCCCCPCICCPCCCCPCPCCCCCCCCCCCCICPCCPCPPCCCCCCCICICPCCCCCCCCCICICCCICCPPPPPCCCCPPCCICPCCCCCCCIICCPCICCCCCCCCICCCCCCCCICCICCCICCCCCCCCICCCCCCCCCCCCCCCCCIPCCCCCCCCCCICPCCCPICCCCPCCCCCCCCCCCCCCPCICICCICCC...

output:

270555678

result:

ok single line: '270555678'

Test #19:

score: 0
Accepted
time: 673ms
memory: 296388kb

input:

IIPIIIIIICIIPIICIIIIIIIIIIIIIPIIIPIIIIIIIIIIIIIIIIIIIIIIIIIIICIIIIIIPPIIIIIIPIIICCICIIPIICCIIPIIIPIIIIIIPIIIIIIIICIIIIIIIIIIICIIIPIIIIIICIICIIICIIIIPIICIIIPIIIIIIIPIIIIIPICIIIICICIIICIIIIIIIIIIIPICIIIIIIIIIIPPIIIICIIIIIIIIPIIIIIPIICIIIIIIICCIIPIIIICIIPIIIIIIIIIIIICIIIIIPIIPCIIIIIICICIIIIIIPIIIIIIIII...

output:

178987433

result:

ok single line: '178987433'

Test #20:

score: 0
Accepted
time: 687ms
memory: 291316kb

input:

PPPPPPPCIPPPPPPPCPPPPCIPPPCPPPPCPPIPPPPPPPPPPPPPCPPPPPPPPPPPIPPPPPIPPPIPPPPPPPPCCPPPPPPPPCPPPCPPPIPPPPPPPPIPPPPPPPPPPPPPPPPPPPPPPPIPPPPPPCPPIPPPPPPICPPPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPCPPCPPPPPPPPPIPCPPCPPPPPPPCPIPPPPPIPPPPPPPPPPPPPCPPCIPPPCPPPPPPPPPPPPPPPPCPPPPPPPPPCPPPPPPIIPPPPPIPCPCIIPPPPPPPPPCPPPIP...

output:

328261068

result:

ok single line: '328261068'

Test #21:

score: 0
Accepted
time: 662ms
memory: 296644kb

input:

CCICCCCIPCCCCICCCCPCCCCCICCCCCCCCCCCCCCCICCCCPCCCCCCCCCCCCCCCICCCICCCCCCICCCCCCCCPCCCCCPPICCCCCCCICCCCCICCIIPPICCCICCCCCCCCCCICCCCCPCCCCICCCCCCICCIPCCPCIPCCCCPICPCCCCCICICCCCCCCCICPCCCPCCCPCCCPCCCCCCCCCPCPCCICPCCCCCICCPCCICCCPCCCCCCCCCCICCCCPCCCCCPCCCCCPCCCPCCCCCCCCCCCCCCCCCCCCPCICCCIICPCICPIICCCCCC...

output:

424185045

result:

ok single line: '424185045'

Test #22:

score: 0
Accepted
time: 685ms
memory: 296304kb

input:

IIIIIIIIIIPIIIIIIIIIIIIIIIIIICIIIIPPCIICICIPIIIIIPIIICPIIICIIPIPIIIIIIIIIIPIIIIIIIIPIPIIIPICIIIIIIPIIIIIPIIIIIIIIIIIIICIIIIPIIIIICIICICIIIIIIIIIIIIIIIIIIIIIIIIIICIPCIIIIIIPIIIIIIIIIIIIIICIIIIIIIIIIIIIIIIIIIIIIICIIIIIICIIIIIIIICCIIIIIIIIPIIIIIIIIPIIIPIIIIIICIIIIIIIIIIIIIICIIIICIIIIIIIIIPIIIIIIIIIIPII...

output:

595831650

result:

ok single line: '595831650'

Test #23:

score: 0
Accepted
time: 678ms
memory: 291132kb

input:

PCCPPPPCPPIPPPPCIPPPCIPCPPIPIPPPPPPIPPPIIPPPPCPPPPPPIPPPIPPPPCPPPIPPPPPPPPIPPPPIPCPPPPPPPPPIPPPPPPIIIPPPPPIPPCPPPPPIPPPPPPIPPPPPIPPPIPPPPPPCPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPIIPICPPCPPPPPCPPPPPPCPPPPPIPPPPPCCPPPPPPPIPPPPPPPPPIPPPPPICPPPPPIPPPPPIPCPPPPPPCPPPIPPPPPPPPPPCPPPPPPPPPIPPCPPPCCIIPPIIPPPPIPPPPP...

output:

354896912

result:

ok single line: '354896912'

Test #24:

score: 0
Accepted
time: 685ms
memory: 293968kb

input:

CPCCCCCCPPICICCPCCCCCCCCCPCCCCCCCCPPIPPCCCPCCCCCCPCICCCCCCCIPCCICICCCCCCCCCCCCCCCCCCIPCCCPCCCIPCPCCPCCPCCCCCPCCCCCCPCCCCICPCCCCCCCCCCCCCIICCCCCIPCIIICCCCCCCCPCCCCCCIICCCCCCCICPCCCCCCCCCCCICCCCIPCCCCCCCCCCPCCCICCCCPCCCCCCCCCCCCCCCPPCPCCCCICCCCCCCCCCCCCPCCCCICCCCCCCCCCIIICCCCCCCCCCCCCCCCICCCCCPCICIPIC...

output:

423510008

result:

ok single line: '423510008'

Test #25:

score: 0
Accepted
time: 624ms
memory: 259248kb

input:

IPCIIIIPCIIIIIICPIICPIIIIIIIICPIIIIPCICPPCPCIIIIIPCIIIIIICPIIIPCIIPCIIIIIICPIIIIIIIIIPCCPICPCPIIIIIIIIIIICPIPCIICPIIIIIIIIIIPCIIIICPIIIIIIIIIICPCPIIIIIIIIIIIIIIIIIPCIIIIIIPCIIIPCIIICPIIPCIIIPCCPPCIIIIIIIIIICPIIIIICPICPIIIIIIICPIICPIICPIIIIIIIIICPIIIIIIICPIICPIIIIIPCIIPCIIIIIIIIIIIPCIIIIIIIPCICPPCIII...

output:

803254087

result:

ok single line: '803254087'

Test #26:

score: 0
Accepted
time: 600ms
memory: 259048kb

input:

PPPPPPPPPPPPPPPPPPPPPPPICICPPPPPPPICPPPPCIPPPPPPICICPPPCIPPPPPCIPCIPPPCIPPICPPPPPPPCIPPPICPICPPPPPPPPPPPPPPPPPPPPICCIPPPCIPPPPPPPICCIPPPPPPPCIPPPCIPPPPPPPPPPPPICPPPPPPICPPPICPCIPPPPPPPPPPPPICCICIPPPPPPICPPPPPPPICCIPPCIPICPPPPCIPPCIPPPPPPPPPICCIPPPPPPPPPPPPCIPPPPPPPCIICPPPCIPPPCIPPCIPPICPPPPPCIPPPPCI...

output:

422010091

result:

ok single line: '422010091'

Test #27:

score: 0
Accepted
time: 613ms
memory: 261260kb

input:

CCPICCCCCCIPCCCCCCIPPICCCCPICCCCCCCCCCCCCCCCCCCCCIPPICCCCCCCCIPCCCCCCCCCPICCCCCCCPICCCCCCIPCIPCCCCCCCCCIPCCCCCCCCCCCPICCCCCCCCPICCIPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPICCPICCCPICCCPICCCCCCIPCIPCPICCCCCCCCIPCCCCCIPCCCCCCCCCCCCCPICCCCCCCCCCCCCIPCCCCCCPICCCCCCCCCCCCIPPICCCCPICCPICCCPICCCPICCPICIPCPICCCCCCC...

output:

81666193

result:

ok single line: '81666193'

Test #28:

score: 0
Accepted
time: 627ms
memory: 261448kb

input:

CPIIIIIICPIIIIICPPCIIPCCPIIIIIIICPPCIIIIIIIIIIIIIICPIIIIIIIIIIPCIIIIIIIIPCIIPCIPCIIPCIIIIIIIIIIICPIIICPPCIIIIIIIIIIIIICPIIIIIIIPCIIIIIIIIIIIIIIIIIIIIIIIIIPCIIIIIICPICPPCIIIIIIICPIIIPCICPIIIIICPCPICPIIIIIICPPCIIIIICPIIIIIIIICPIIPCIIIIIIIIIIIICPICPIIICPIIIIPCIICPIIPCIIPCIICPIIIIIIICPCPIIIIPCCPIIIIIPCC...

output:

739418046

result:

ok single line: '739418046'

Test #29:

score: 0
Accepted
time: 610ms
memory: 259756kb

input:

PCIPPPPPICPPPCIPPPPPCIPPPPPPPICPPPPPICPPPPPPPPCIICPPPPPICCIPPCIPPPPPPPICPPPPPPPPPPPPICCIPPPPPPCIPPPPPPPPPPPPPICPCIPPPPCIPPPICPICPPPPCIPPICPPPPPPPCIPPCIPCIPPPPPPPICPCIPICPPPICCIPPPPICPCIPPPPPPICPPPCIPPCIPPPPPPPPPPPPPPICICCIPPICPICPPPPCIPPPPICPPPPPPPPPPPPPPPPPPPPPPPICICPPPPPPPPPCIPCIPPPPPCIPPPCIICPICP...

output:

429005526

result:

ok single line: '429005526'

Test #30:

score: 0
Accepted
time: 639ms
memory: 259284kb

input:

PICIPCIPCCCCIPCCCIPCCIPCIPCCCCCCIPCCCCCCCCCCCCCCCCCIPPICCCCIPCCCCCCCCCIPCPICCCCCPICCCPIPICPICCCCCCIPCCPICIPCCIPCCCCCPICCCCCCCIPCCCIPCCCCCCPICCCCCCCPICCCCCCCCCCCIPCCCCCCCCCCCPICCCCCCCIPCIPCCPIPICCCIPCCCCCCCCCCCCCCCCCIPCCCCPICCIPCIPCCCCCCCIPCIPCCIPPICCCPICCPICCCCCCCPICCPICIPCCCCCPICCCCCPICCCCCCCPICCCC...

output:

346033550

result:

ok single line: '346033550'

Test #31:

score: 0
Accepted
time: 391ms
memory: 176704kb

input:

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

876361609

result:

ok single line: '876361609'

Test #32:

score: 0
Accepted
time: 370ms
memory: 178968kb

input:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

51133400

result:

ok single line: '51133400'

Test #33:

score: 0
Accepted
time: 400ms
memory: 176412kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

881510334

result:

ok single line: '881510334'

Test #34:

score: 0
Accepted
time: 411ms
memory: 176608kb

input:

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

703358165

result:

ok single line: '703358165'

Test #35:

score: 0
Accepted
time: 415ms
memory: 178908kb

input:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

8597778

result:

ok single line: '8597778'

Test #36:

score: 0
Accepted
time: 412ms
memory: 176736kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

875167427

result:

ok single line: '875167427'

Test #37:

score: 0
Accepted
time: 331ms
memory: 171200kb

input:

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

339337501

result:

ok single line: '339337501'

Test #38:

score: 0
Accepted
time: 322ms
memory: 170372kb

input:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

321201785

result:

ok single line: '321201785'

Test #39:

score: 0
Accepted
time: 321ms
memory: 172244kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

654943659

result:

ok single line: '654943659'

Test #40:

score: 0
Accepted
time: 854ms
memory: 244996kb

input:

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

995448234

result:

ok single line: '995448234'

Test #41:

score: 0
Accepted
time: 849ms
memory: 245488kb

input:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

442950961

result:

ok single line: '442950961'

Test #42:

score: 0
Accepted
time: 855ms
memory: 241492kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

221475480

result:

ok single line: '221475480'

Test #43:

score: 0
Accepted
time: 608ms
memory: 215436kb

input:

IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

828731448

result:

ok single line: '828731448'

Test #44:

score: 0
Accepted
time: 603ms
memory: 211732kb

input:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

967126854

result:

ok single line: '967126854'

Test #45:

score: 0
Accepted
time: 625ms
memory: 213700kb

input:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

898792666

result:

ok single line: '898792666'

Test #46:

score: 0
Accepted
time: 15ms
memory: 121424kb

input:

I

output:

1

result:

ok single line: '1'

Test #47:

score: 0
Accepted
time: 8ms
memory: 122116kb

input:

P

output:

1

result:

ok single line: '1'

Test #48:

score: 0
Accepted
time: 13ms
memory: 120684kb

input:

C

output:

1

result:

ok single line: '1'

Test #49:

score: 0
Accepted
time: 7ms
memory: 120284kb

input:

IP

output:

1

result:

ok single line: '1'

Test #50:

score: 0
Accepted
time: 15ms
memory: 120720kb

input:

PP

output:

2

result:

ok single line: '2'

Test #51:

score: 0
Accepted
time: 11ms
memory: 121236kb

input:

CP

output:

1

result:

ok single line: '1'

Test #52:

score: 0
Accepted
time: 11ms
memory: 120244kb

input:

IP

output:

1

result:

ok single line: '1'

Test #53:

score: 0
Accepted
time: 17ms
memory: 121844kb

input:

PP

output:

2

result:

ok single line: '2'

Test #54:

score: 0
Accepted
time: 15ms
memory: 121228kb

input:

CP

output:

1

result:

ok single line: '1'

Test #55:

score: 0
Accepted
time: 8ms
memory: 121888kb

input:

IP

output:

1

result:

ok single line: '1'

Test #56:

score: 0
Accepted
time: 7ms
memory: 120696kb

input:

PP

output:

2

result:

ok single line: '2'

Test #57:

score: 0
Accepted
time: 23ms
memory: 122104kb

input:

CC

output:

2

result:

ok single line: '2'

Test #58:

score: 0
Accepted
time: 566ms
memory: 211000kb

input:

CICCCPPIICCCIPPPCPCCCPPICCIPPIPPCICPCCPPCCICPPPPPIIPPPCIPPPCCPPCPPPIPCPICPPPCPPPPPCIPIPCPPCCCCCCICPICPCPPPICIPPCPCPIPCCPPCPCPPCCCCIPPIICPPIICPPCPPIIPCICPPPCIICPCCCCPPPCCCCICCICIPCIPCPPPPCCCIPCCICPCCCCPCPICCCCCCPCPCPPCCPCPCPCCPIPPICPPIPPCCCPPICCCPPPPPCCPCICCPPCCCIIPPPIICCPCCPPCCIPCCCICCPPPICPCCPPICIC...

output:

382266009

result:

ok single line: '382266009'

Test #59:

score: 0
Accepted
time: 596ms
memory: 212552kb

input:

PICCPIIICICPICIIIPICPICCIPPIPPPCCCIIPIIPCIPCCIIIICPIIPPIPICCPIPCPIPPPPPICIICIICIICICICIPCIIICCIPCICIPCICPICCPCCICICCCIICPIPICPPPPICIPCCIIIIIIPCCICIIPCPICCCCPCICPIIIIPCCCCPICICCCICIPIIICICPIPCIPPIIPCIPIICICPICCIICICCCPCPCICCPICICIIICCCIPICCIIPIIPIICCICIPIPCCCCCIICPIIICIPIICICPIICICIPPPCIIICCCCPICICCC...

output:

510412653

result:

ok single line: '510412653'

Test #60:

score: 0
Accepted
time: 569ms
memory: 212772kb

input:

ICPCCIPPIPCIPCICPCCCIPCPPPPPPICPCPIPIIIPPCIIPIIPIPCCIIIIIIIIPICIIIPIPIIICIPICIIIIIICIIPICCCPIPIPCCPPCCPIPCICCIIPCPPIIIPPIICPIPIPPPPCIPIPIIPIIIICCPICIPCPCPCPPCICIPPICIIIPPPPPPCCIPIPICPCCICCCPICIPPIPPIPPPICPIPPCPCIIIPIPCPIICIIPIIIPCPPPICPICPIPIIIIIIICICIIPIIIPPIPIPICPPIIIIPCICICICCIIPPIIPIPCCCIPIPCCII...

output:

130104659

result:

ok single line: '130104659'

Test #61:

score: 0
Accepted
time: 587ms
memory: 230940kb

input:

CPIPCCPPCPCCPCPIIPCCPPCPCCPPCPCCPCPPCCPCPPCCPPCCPPCPCICPPCPCCPCPCPPCPCIIPCCPCPCPCPPCICPPCPCPCIPCPCPCCPPCCPCPCPPCCPIPCICPPCCPPCCPIPCPCPCCPPCPCCPIIPCICPPCCPPCIPCPCICPPCPCPCIICPPCPCPCPCCPCPPCPCPCICPIIPCIPCPCCPCPPCCPICPICPPCCPCPIPCICPCPPCPCICPPCCPCPCPCPPCCPPCCPPCPCPCCPCPCPICPPCPCCPICPPCPCCPCPCPIPCPCPCCP...

output:

892362548

result:

ok single line: '892362548'

Test #62:

score: 0
Accepted
time: 572ms
memory: 229044kb

input:

CIICPPICICPICCIICPICCIPCICICIPICICICPCIPCICICICICIICPICICICICICCICIICCICICIICICICCIPCIPCIPCIICCIPPICPICPCICIICPICCIICCIICCICIICCIICICCIPCICICIICCIICCICIICCICICIICPPICCIICICCIICPCIPCIICCICICIICICICICICCIPICICCIPPCIICCIICPCIICICCICIICCIICICICICICPICICICICICICCICIPCICICICIPCIICICCICICICIICICPCICICIICCI...

output:

249936867

result:

ok single line: '249936867'

Test #63:

score: 0
Accepted
time: 569ms
memory: 233176kb

input:

PIIPCIPCPIPICIPIPPIIPIPIPIPPICCIPIPPIIPIPPICCIPCIPPIIPCIPIPPIPIPIIPPIIPPIPICIPPIPIPIPICIPCIPIPPIPIIPIPPIPIIPPIPIPIIPPIIPPIPIPIPIIPCPIIPPICIPIPIPCIPCIPPIPIPICCPIPICIPIPPIPICCIPPIIPPIPICCIPPIPIPIIPIPIPCIPPIIPPIPICPICCPIPIIPPIPIIPCIPPIIPPIIPIPIPIPIPPICCCCIPIPIPIPCPIIPCIPPIIPCIPPICIPCIPCPIPIPIIPCIPPIPIP...

output:

278587043

result:

ok single line: '278587043'