博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VK Cup 2012 Qualification Round 2 C. String Manipulation 1.0 字符串模拟
阅读量:6941 次
发布时间:2019-06-27

本文共 2583 字,大约阅读时间需要 8 分钟。

C. String Manipulation 1.0

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

codeforces.com/problemset/problem/91/B

Description

One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo the change.
For example, one can change name "arca" by removing the second occurrence of character "a" to get "arc".
Polycarpus learned that some user initially registered under nickname t, where t is a concatenation of k copies of string s. Also, Polycarpus knows the sequence of this user's name changes. Help Polycarpus figure out the user's final name.

Input

The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per line. The changes are written as "pi ci" (without the quotes), where pi (1 ≤ pi ≤ 200000) is the number of occurrences of letter ci, ci is a lowercase Latin letter. It is guaranteed that the operations are correct, that is, the letter to be deleted always exists, and after all operations not all letters are deleted from the name. The letters' occurrences are numbered starting from 1.

Output

Print a single string — the user's final name after all changes are applied to it.

Sample Input

2

bac
3
2 a
1 b
2 c

Sample Output

acb

HINT

 

题意

 

题解:

 

代码

 

//qscqesze#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
typedef long long ll;using namespace std;//freopen("D.in","r",stdin);//freopen("D.out","w",stdout);#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)#define maxn 2000001#define mod 1000000007#define eps 1e-9int Num;char CH[20];const int inf=0x3f3f3f3f;inline ll read(){ 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;}//**************************************************************************************int check[maxn];vector
kiss[30];string os,s;int main(){ int k=read(); cin>>os; for(int i=0;i
>a>>b; check[kiss[b-'a'][a-1]]=1; kiss[b-'a'].erase(kiss[b-'a'].begin()+a-1); } for(int i=0;i

 

转载地址:http://ecfnl.baihongyu.com/

你可能感兴趣的文章
与其倒推以前不如推到重建
查看>>
Could not find Developer Disk Image
查看>>
表空间和文件系统使用率监控脚本
查看>>
Unix高级环境编程—进程控制(一)
查看>>
面向对象进阶
查看>>
Python 携程
查看>>
相约深圳~敏捷之旅
查看>>
报错OPTION SQL_SELECT_LIMIT=
查看>>
js单例模式
查看>>
微服务(二)hystrix
查看>>
课堂练习-词语接龙
查看>>
别再抱怨了,国内这么多优秀的Android资源你都知道吗?
查看>>
hausaufgabe--python 20-Closure functions 2
查看>>
实体类自动化生成 vs插件
查看>>
计算机网络技术基础知识
查看>>
笔试算法题(55):快速排序实现之三路划分, 三元中值法和插入排序处理小子文件...
查看>>
day060 ajax文件上传 json补充
查看>>
SpringBoot中常见的错误
查看>>
洗洗睡了吧啊,何必在意……费口舌不热么
查看>>
D. Ilya and Escalator
查看>>