题目传送门
/*
题意:给出m个位置,每次把[p,len-p+1]内的字符子串反转,输出最后的结果
字符串处理:朴素的方法超时,想到结果要么是反转要么没有反转,所以记录
每个转换的次数,把每次要反转的反转就不超时了:)
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAXN = 2e5 + ;
const int INF = 0x3f3f3f3f;
char s[MAXN];
int to[MAXN];
int main(void) //Codeforces Round #297 (Div. 2) B. Pasha and String
{
int m;
scanf ("%s", s + );
int len = strlen (s + );
scanf ("%d", &m);
while (m--)
{
int p; scanf ("%d", &p);
int q = len - p + ;
to[p]++;
}
int sum = ;
for (int i=; i<=len/; ++i)
{
sum += to[i];
if (sum & ) swap (s[i], s[len-i+]);
}
printf ("%s", s + );
return ;
}
/*
abcdef
1
2
vwxyz
2
2 2
abcdef
3
1 2 3
*/