QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#440398#5014. 复读程度Kevin53076 1769ms171624kbC++2312.1kb2024-06-13 17:39:052024-06-13 17:39:07

Judging History

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

  • [2024-06-13 17:39:07]
  • 评测
  • 测评结果:6
  • 用时:1769ms
  • 内存:171624kb
  • [2024-06-13 17:39:05]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
class SuffixAutomaton
{
	#define MAXN 200000+5
	#define MAXLG 20
	public:
		SuffixAutomaton():last(1),tot(1){}
		int trans[MAXN][26],fail[MAXN],len[MAXN],occ[MAXN],last,tot,dfn,in[MAXN],out[MAXN],id[MAXN],rep[MAXN];
		int anc[MAXLG][MAXN];
		ull weight[MAXN];
		vector<int> G[MAXN];
		int extend(int x,ull w=0,int pos=0)
		{
			int p=last;
			int np=++tot;
			len[np]=len[p]+1;
			while(p&&!trans[p][x])
			{
				trans[p][x]=np;
				p=fail[p];
			}
			if(!p)
				fail[np]=1;
			else
			{
				int q=trans[p][x];
				if(len[p]+1==len[q])
					fail[np]=q;
				else
				{
					int nq=++tot;
					memcpy(trans[nq],trans[q],sizeof(int)*26);
					len[nq]=len[p]+1;
					fail[nq]=fail[q];
					fail[q]=fail[np]=nq;
					while(p&&trans[p][x]==q)
					{
						trans[p][x]=nq;
						p=fail[p];
					}
				}
			}
			last=np;
			occ[last]++;
			weight[last]+=w;
			rep[last]=pos;
			return last;
		}
		void dfs(int u)
		{
			in[u]=++dfn;
			id[dfn]=u;
			for(auto v:G[u])
			{
				dfs(v);
				occ[u]+=occ[v];
				weight[u]+=weight[v];
				rep[u]=max(rep[u],rep[v]);
			}
			out[u]=dfn;
		}
		void init()
		{
			for(int i=1;i<=tot;i++)
				if(fail[i])
					G[fail[i]].pb(i);
			dfs(1);
			for(int i=1;i<=tot;i++)
				anc[0][i]=fail[i];
			for(int i=1;i<20;i++)
				for(int j=1;j<=tot;j++)
					anc[i][j]=anc[i-1][anc[i-1][j]];
		}
		int locate(int node,int length)
		{
			for(int i=MAXLG-1;i>=0;i--)
				if(len[anc[i][node]]>=length)
					node=anc[i][node];
			return node;
		}
	#undef MAXN
	#undef MAXLG
};
class BasicSubstringStructure
{
	#define MAXN 100000+5
	public:
		BasicSubstringStructure(string _s):s(_s){build();}
		BasicSubstringStructure(){}
		string s;
		SuffixAutomaton S1,S2;
		int node1[MAXN],node2[MAXN],n;
		ull wl[MAXN],wr[MAXN];
		void build()
		{
			n=sz(s);
			for(int i=1;i<=n;i++)
				node1[i]=S1.extend(s[i-1]-'a',wr[i],i);
			for(int i=n;i>=1;i--)
				node2[i]=S2.extend(s[i-1]-'a',wl[i],i);
			S1.init();
			S2.init();
		}
		int locate1(pii str)
		{
			int nd1=S1.locate(node1[str.second],str.second-str.first+1);
			return nd1;
		}
		int locate2(pii str)
		{
			int nd2=S2.locate(node2[str.first],str.second-str.first+1);
			return nd2;
		}
		pii rep(pii str)
		{
			int nd1=S1.locate(node1[str.second],str.second-str.first+1);
			str=mp(str.second-S1.len[nd1]+1,str.second);
			int nd2=S2.locate(node2[str.first],str.second-str.first+1);
			str=mp(str.first,str.first+S2.len[nd2]-1);
			int pos=S1.rep[locate1(str)];
			str.first+=pos-str.second;
			str.second=pos;
			return str;
		}
		int occ(pii str)
		{
			int nd1=S1.locate(node1[str.second],str.second-str.first+1);
			return S1.occ[nd1];
		}
		ull weight(pii str)
		{
			int nd1=S1.locate(node1[str.second],str.second-str.first+1);
			int nd2=S2.locate(node2[str.first],str.second-str.first+1);
			return S1.weight[nd1]*S2.weight[nd2];
		}
		vector<int> order1()
		{
			int s1=S1.tot;
			vector<pair<pii,pii>> vec;
			for(int i=2;i<=s1;i++)
			{
				pii pos(S1.rep[i]-S1.len[i]+1,S1.rep[i]);
				vec.pb(rep(pos),pii(S1.len[i]-S1.len[S1.fail[i]],i));
			}
			srt(vec);
			vector<int> ret;
			for(int i=0;i<sz(vec);i++)
				ret.pb(vec[i].second.second);
			return ret;
		}
		vector<int> order2()
		{
			int s2=S2.tot;
			vector<pair<pii,pii>> vec;
			for(int i=2;i<=s2;i++)
			{
				pii pos(S2.rep[i],S2.rep[i]+S2.len[i]-1);
				vec.pb(rep(pos),pii(S2.len[i]-S2.len[S2.fail[i]],i));
			}
			srt(vec);
			vector<int> ret;
			for(int i=0;i<sz(vec);i++)
				ret.pb(vec[i].second.second);
			return ret;
		}
	#undef MAXN
}BSS;
int n,q;
string s;
ull wl[100100],wr[100100];
ull ans[400400];
int ql[400400],qr[400400];
int l1[100100],r1[100100],l2[100100],r2[100100],nd1[100100],nd2[100100];
const int B1=630,B2=450;
int qx[400400],qly[400400],qry[400400];
int qy[400400],qlx[400400],qrx[400400];
ull ans1[400400],ans2[400400];
vector<int> vqx[400400],vqy[400400];
int s1,s2;
int label1[200200],label2[200200];
ull tag[200200/B2+5],rval[200200];
ull W[200200];
ull res[100100];
vector<pii> pool;
struct query
{
	int pos,ind,ql,qr;
	ull coef;
	friend bool operator <(const query &a,const query &b){return a.pos<b.pos;}
};
vector<query> vq1[200200],vq2[200200];
vector<int> vnode1[200200],vnode2[200200];
namespace BIT
{
	#define MAXN 200200
	ull bit[MAXN];
	void update(int p,ull v)
	{
		while(p<MAXN)
		{
			bit[p]+=v;
			p+=(p&(-p));
		}
	}
	ull query(int p)
	{
		ull ret=0;
		while(p)
		{
			ret+=bit[p];
			p-=(p&(-p));
		}
		return ret;
	}
	void clear()
	{
		memset(bit,0,sizeof(bit));
	}
	#undef MAXN
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>q>>s;
	for(int i=1;i<=n;i++)
		cin>>wl[i];
	for(int i=1;i<=n;i++)
		cin>>wr[i];
	BSS.s=s;
	for(int i=1;i<=n;i++)
		BSS.wl[i]=wl[i];
	for(int i=1;i<=n;i++)
		BSS.wr[i]=wr[i];
	BSS.build();
	for(int i=2;i<=BSS.S1.tot;i++)
	{
		pii str(BSS.S1.rep[i]-BSS.S1.len[i]+1,BSS.S1.rep[i]);
		pool.pb(BSS.rep(str));
	}
	srt(pool);
	uni(pool);
	for(int i=1;i<=q;i++)
	{
		cin>>l2[i]>>r2[i]>>l1[i]>>r1[i];
		nd1[i]=BSS.locate1({l1[i],r1[i]});
		nd2[i]=BSS.locate2({l2[i],r2[i]});
		if(BSS.rep({l1[i],r1[i]})==BSS.rep({l2[i],r2[i]}))
		{
			pii rep=BSS.rep({l1[i],r1[i]});
			int len=BSS.S1.len[nd1[i]]+BSS.S2.len[nd2[i]]-(rep.second-rep.first+1);
			if(len<min(r1[i]-l1[i]+1,r2[i]-l2[i]+1))
			{
				int d1=BSS.S2.len[nd2[i]]-(rep.second-rep.first+1);
				int d2=BSS.S1.len[nd1[i]]-(rep.second-rep.first+1);
				rep.first-=d1;
				rep.second+=d2;
				if(rep.second>=rep.first&&BSS.rep(rep)==BSS.rep({l1[i],r1[i]}))
					res[i]-=BSS.occ(rep)*BSS.S2.weight[BSS.locate2(rep)]*BSS.S1.weight[BSS.locate1(rep)];
				else
					cout<<"henghengheng "<<i<<endl;
			}
			else if(s[0]!='a')
				cout<<"hahaha "<<i<<endl;
		}
		else
		{
			int len=max(r1[i]-l1[i]+1,r2[i]-l2[i]+1);
			int block1=ub(pool,BSS.rep({BSS.S1.rep[nd1[i]]-BSS.S1.len[nd1[i]]+1,BSS.S1.rep[nd1[i]]}));
			int block2=ub(pool,BSS.rep({BSS.S2.rep[nd2[i]],BSS.S2.rep[nd2[i]]+BSS.S2.len[nd2[i]]-1}));
			query q1{BSS.S1.len[nd1[i]]-BSS.S1.len[BSS.S1.fail[nd1[i]]],i,BSS.S2.in[nd2[i]],BSS.S2.out[nd2[i]],-BSS.S1.weight[nd1[i]]};
			query q2{max(BSS.S1.len[nd1[i]]-max(len-1,BSS.S1.len[BSS.S1.fail[nd1[i]]]),0),i,BSS.S2.in[nd2[i]],BSS.S2.out[nd2[i]],BSS.S1.weight[nd1[i]]};
			query q3{BSS.S2.len[nd2[i]]-BSS.S2.len[BSS.S2.fail[nd2[i]]],i,BSS.S1.in[nd1[i]],BSS.S1.out[nd1[i]],-BSS.S2.weight[nd2[i]]};
			query q4{max(BSS.S2.len[nd2[i]]-max(len-1,BSS.S2.len[BSS.S2.fail[nd2[i]]]),0),i,BSS.S1.in[nd1[i]],BSS.S1.out[nd1[i]],BSS.S2.weight[nd2[i]]};
			vq1[block1].pb(q1);
			vq1[block1].pb(q2);
			vq2[block2].pb(q3);
			vq2[block2].pb(q4);
		}
		ql[i*4-3]=BSS.S1.in[nd1[i]]-1;
		qr[i*4-3]=BSS.S2.in[nd2[i]]-1;
		ql[i*4-2]=BSS.S1.out[nd1[i]];
		qr[i*4-2]=BSS.S2.in[nd2[i]]-1;
		ql[i*4-1]=BSS.S1.in[nd1[i]]-1;
		qr[i*4-1]=BSS.S2.out[nd2[i]];
		ql[i*4-0]=BSS.S1.out[nd1[i]];
		qr[i*4-0]=BSS.S2.out[nd2[i]];
	}
	vector<pii> vn1,vn2;
	for(int i=2;i<=BSS.S1.tot;i++)
		vn1.pb(BSS.S1.rep[i],i);
	for(int i=2;i<=BSS.S2.tot;i++)
		vn2.pb(BSS.S2.rep[i],i);
	rsrt(vn1);
	srt(vn2);
	for(auto pr:vn1)
	{
		int nd=pr.second;
		int block=ub(pool,BSS.rep({BSS.S1.rep[nd]-BSS.S1.len[nd]+1,BSS.S1.rep[nd]}));
		vnode1[block].pb(nd);
	}
	for(auto pr:vn2)
	{
		int nd=pr.second;
		int block=ub(pool,BSS.rep({BSS.S2.rep[nd],BSS.S2.rep[nd]+BSS.S2.len[nd]-1}));
		vnode2[block].pb(nd);
	}
	for(int i=1;i<=sz(pool);i++)
	{
		srt(vq1[i]);
		int p=0;
		while(p<sz(vq1[i])&&vq1[i][p].pos==0) p++;
		for(int j=1;j<=sz(vnode2[i]);j++)
		{
			int nd=vnode2[i][j-1];
			BIT::update(BSS.S2.in[nd],BSS.S2.occ[nd]*BSS.S2.weight[nd]);
			while(p<sz(vq1[i])&&vq1[i][p].pos==j)
			{
				res[vq1[i][p].ind]+=vq1[i][p].coef*(BIT::query(vq1[i][p].qr)-BIT::query(vq1[i][p].ql-1));
				p++;
			}
		}
		for(int j=1;j<=sz(vnode2[i]);j++)
		{
			int nd=vnode2[i][j-1];
			BIT::update(BSS.S2.in[nd],(ull)-BSS.S2.occ[nd]*BSS.S2.weight[nd]);
		}
	}
	for(int i=1;i<=sz(pool);i++)
	{
		srt(vq2[i]);
		int p=0;
		while(p<sz(vq2[i])&&vq2[i][p].pos==0) p++;
		for(int j=1;j<=sz(vnode1[i]);j++)
		{
			int nd=vnode1[i][j-1];
			BIT::update(BSS.S1.in[nd],BSS.S1.occ[nd]*BSS.S1.weight[nd]);
			while(p<sz(vq2[i])&&vq2[i][p].pos==j)
			{
				res[vq2[i][p].ind]+=vq2[i][p].coef*(BIT::query(vq2[i][p].qr)-BIT::query(vq2[i][p].ql-1));
				p++;
			}
		}
		for(int j=1;j<=sz(vnode1[i]);j++)
		{
			int nd=vnode1[i][j-1];
			BIT::update(BSS.S1.in[nd],(ull)-BSS.S1.occ[nd]*BSS.S1.weight[nd]);
		}
	}
	vector<int> vq;
	for(int i=1;i<=q*4;i++)
		vq.pb(i);
	sort(ALL(vq),[&](int u,int v)
	{
		if(ql[u]/B1==ql[v]/B1) return qr[u]<qr[v];
		return ql[u]<ql[v];
	});
	int cl=1,cr=1;
	for(int i=1;i<=q*4;i++)
	{
		int ind=vq[i-1];
		int l=ql[ind],r=qr[ind];
		if(cl<=l)
		{
			qy[i]=cr;
			qlx[i]=cl+1;
			qrx[i]=l;
			cl=l;
		}
		else
		{
			qy[i]=cr;
			qlx[i]=l+1;
			qrx[i]=cl;
			cl=l;
		}
		if(cr<=r)
		{
			qx[i]=cl;
			qly[i]=cr+1;
			qry[i]=r;
			cr=r;
		}
		else
		{
			qx[i]=cl;
			qly[i]=r+1;
			qry[i]=cr;
			cr=r;
		}
	}
	for(int i=1;i<=q*4;i++)
	{
		vqx[qx[i]].pb(i);
		vqy[qy[i]].pb(i);
	}
	s1=BSS.S1.tot;
	s2=BSS.S2.tot;
	vector<int> order1=BSS.order1(),order2=BSS.order2();
	for(int i=1;i<=sz(order1);i++)
		label1[order1[i-1]]=i;
	for(int i=1;i<=sz(order2);i++)
		label2[order2[i-1]]=i;
	for(int i=1;i<=s2;i++)
		W[label2[i]]=BSS.S2.weight[i];
	for(int i=2;i<=s1;i++)
	{
		int node=BSS.S1.id[i];
		int pos=BSS.S1.rep[node];
		int ndl=BSS.locate2(pii(pos-BSS.S1.len[BSS.S1.fail[node]],pos));
		int ndr=BSS.locate2(pii(pos-BSS.S1.len[node]+1,pos));
		int cl=label2[ndl],cr=label2[ndr];
		int lb=cl/B2,rb=cr/B2;
		ull val=BSS.S1.weight[node]*BSS.S1.occ[node];
		for(int i=lb+1;i<rb;i++)
			tag[i]+=val;
		if(lb<rb)
		{
			for(int i=cl;i/B2==lb;i++)
				rval[i]+=val*W[i];
			for(int i=cr;i/B2==rb;i--)
				rval[i]+=val*W[i];
		}
		else
		{
			for(int i=cl;i<=cr;i++)
				rval[i]+=val*W[i];
		}
		for(auto qind:vqx[i])
			for(int ydfn=qly[qind];ydfn<=qry[qind];ydfn++)
			{
				int yind=label2[BSS.S2.id[ydfn]];
				ans1[qind]+=tag[yind/B2]*W[yind]+rval[yind];
			}
	}
	memset(tag,0,sizeof(tag));
	memset(rval,0,sizeof(rval));
	for(int i=1;i<=s1;i++)
		W[label1[i]]=BSS.S1.weight[i];
	for(int i=2;i<=s2;i++)
	{
		int node=BSS.S2.id[i];
		int pos=BSS.S2.rep[node];
		int ndl=BSS.locate1(pii(pos,pos+BSS.S2.len[BSS.S2.fail[node]]));
		int ndr=BSS.locate1(pii(pos,pos+BSS.S2.len[node]-1));
		int cl=label1[ndl],cr=label1[ndr];
		int lb=cl/B2,rb=cr/B2;
		ull val=BSS.S2.weight[node]*BSS.S2.occ[node];
		for(int i=lb+1;i<rb;i++)
			tag[i]+=val;
		if(lb<rb)
		{
			for(int i=cl;i/B2==lb;i++)
				rval[i]+=val*W[i];
			for(int i=cr;i/B2==rb;i--)
				rval[i]+=val*W[i];
		}
		else
		{
			for(int i=cl;i<=cr;i++)
				rval[i]+=val*W[i];
		}
		for(auto qind:vqy[i])
			for(int xdfn=qlx[qind];xdfn<=qrx[qind];xdfn++)
			{
				int xind=label1[BSS.S1.id[xdfn]];
				ans2[qind]+=tag[xind/B2]*W[xind]+rval[xind];
			}
	}
	cl=1;
	cr=1;
	ull tot=0;
	for(int i=1;i<=q*4;i++)
	{
		int ind=vq[i-1];
		int l=ql[ind],r=qr[ind];
		if(cl<=l)
		{
			tot+=ans2[i];
			cl=l;
		}
		else
		{
			tot-=ans2[i];
			cl=l;
		}
		if(cr<=r)
		{
			tot+=ans1[i];
			cr=r;
		}
		else
		{
			tot-=ans1[i];
			cr=r;
		}
		ans[ind]=tot;
	}
	for(int i=1;i<=q;i++)
		res[i]+=ans[i*4-0]-ans[i*4-1]-ans[i*4-2]+ans[i*4-3];
	for(int i=1;i<=q;i++)
		cout<<res[i]<<endl;
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 7
Accepted
time: 8ms
memory: 17728kb

input:

500 500
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

15720454042420499810
4058077030882532408
14651762045124606089
4030024243931986061
18033423360813892607
9470601111824364484
3883374861354698625
16650831689368240202
8339028189650687576
2683289915379600554
13133811958066776394
14181220923901262251
18173739360450512256
13142314545999179754
148925491596...

result:

ok 500 lines

Test #2:

score: 0
Wrong Answer
time: 8ms
memory: 17748kb

input:

500 500
zszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszz...

output:

hahaha 7
hahaha 29
hahaha 58
hahaha 99
hahaha 103
hahaha 145
hahaha 155
hahaha 185
hahaha 193
hahaha 244
hahaha 252
hahaha 259
hahaha 266
hahaha 290
hahaha 292
hahaha 298
hahaha 299
hahaha 303
hahaha 313
hahaha 323
hahaha 345
hahaha 354
hahaha 380
hahaha 388
hahaha 391
hahaha 409
hahaha 410
hahaha 4...

result:

wrong answer 1st lines differ - expected: '4843650749197240262', found: 'hahaha 7'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 6
Accepted

Test #22:

score: 6
Accepted
time: 1626ms
memory: 170324kb

input:

100000 100000
zbbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaabab...

output:

16102224067619618967
2409962914769200003
427496158535942638
17668679206267169316
9612725428377010375
16283030984784184667
14966758574838045581
8108029333542434517
5821899279772898061
7354415533246368927
15016230232022193055
9072126619623269970
5490256818353051548
432088324301719512
13681741566473101...

result:

ok 100000 lines

Test #23:

score: 6
Accepted
time: 1416ms
memory: 162188kb

input:

100000 100000
zsyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysysyysyysysyysyysysyysysyysyysysyysy...

output:

4559870725517531243
7294838067589907718
11611591353940805930
6570123277626119382
7422995984298182834
5907659314847245750
16910510485299347733
4264602948914788684
13190214217087942183
6600183534290302450
18342681242733610030
11565497126186922166
17128453730139037795
1670830382187028213
18164994643596...

result:

ok 100000 lines

Test #24:

score: 6
Accepted
time: 1769ms
memory: 171624kb

input:

100000 100000
zoooooooollexlwockjmmpcsmrmxbcsxiopbhrsgmuffubpextcneqsmtouhuovwmosufyvtciwaiqfgxdjgebcnwbeyyyascjixpskyeyoecigpydkqrssvcwcuirkwyxxbcfgjdorrrgdghdooooooooofnkxriqwewxjgitnhfrykdhcrpbgmcnqujvlugcougvywjyjknbcfqdohyxidpswedsqodaqavibkmrykeiqfmoyavdcctpjvqomwmhjysbynqskjvprebydvglxmnqsvxy...

output:

812998614822431625
1250302312590066903
0
17068288240276554944
8822011249064016718
5154878686056167322
16634251694703169315
7627132526351165031
17489820411768677459
1612901206518396247
9557606214238964493
8125053178366415794
6923591044772654970
16010694286126551160
0
11810757301219826743
180907391938...

result:

ok 100000 lines

Subtask #5:

score: 0
Wrong Answer

Dependency #4:

100%
Accepted

Test #25:

score: 16
Accepted
time: 852ms
memory: 146792kb

input:

100000 100000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

15893638524428831028
10131593916133042820
10131593916133042820
1813611689029665142
15893638524428831028
10131593916133042820
1813611689029665142
10131593916133042820
9834492063345021236
9834492063345021236
15893638524428831028
9834492063345021236
9834492063345021236
10131593916133042820
158936385244...

result:

ok 100000 lines

Test #26:

score: 0
Wrong Answer
time: 1654ms
memory: 137116kb

input:

100000 100000
zszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzszszzszzszszzszzszszzszszzszzszszzsz...

output:

hahaha 86
hahaha 97
hahaha 98
hahaha 152
hahaha 164
hahaha 234
hahaha 249
hahaha 414
hahaha 439
hahaha 453
hahaha 502
hahaha 507
hahaha 556
hahaha 580
hahaha 685
hahaha 714
hahaha 788
hahaha 833
hahaha 848
hahaha 881
hahaha 1019
hahaha 1058
hahaha 1192
hahaha 1206
hahaha 1338
hahaha 1339
hahaha 1437...

result:

wrong answer 1st lines differ - expected: '14439422629921813482', found: 'hahaha 86'

Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #3:

0%