https://i1.wp.com/eblogarithm.com/wp-content/uploads/2017/07/Codeforces-Round-423-Div-2-rated-based-on-VK-Cup-Finals-problem-C-String-Reconstruction-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals), problem: (C) String Reconstruction Solution In C/C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=2e6+5;
int main()
{
char a[maxn]={};
int n,k,i;
cin>>n;
while(n–){
string x;
cin>>x>>k;
int t,len=x.size(),tt=-len;
while(k–){
scanf(“%d”,&t);
for(i=max(0,tt+len-t);i<len;i++) a[i+t]=x[i];
tt=t;
}
}
for(i=maxn-1;!a[i];) i–;
for(int j=1;j<=i;j++) putchar(a[j]?a[j]:’a’);

return 0;
}

(Visited 13 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: