VK Cup 2012 Qualification Round 2 C. String Manipulation 1.0 字符串模拟
C. String Manipulation 1.0
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
codeforces.com/problemset/problem/91/B
Description
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 <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
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-9
int Num;
char CH[];
const int inf=0x3f3f3f3f;
inline ll read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} //************************************************************************************** int check[maxn];
vector<int> kiss[];
string os,s;
int main()
{
int k=read();
cin>>os;
for(int i=;i<k;i++)
s+=os;
for(int i=;i<s.size();i++)
kiss[s[i]-'a'].push_back(i);
int n=read();
for(int i=;i<n;i++)
{
int a;
char b;
cin>>a>>b;
check[kiss[b-'a'][a-]]=;
kiss[b-'a'].erase(kiss[b-'a'].begin()+a-);
}
for(int i=;i<s.size();i++)
if(!check[i])
cout<<s[i]; }
VK Cup 2012 Qualification Round 2 C. String Manipulation 1.0 字符串模拟的更多相关文章
- DP VK Cup 2012 Qualification Round D. Palindrome pairs
题目地址:http://blog.csdn.net/shiyuankongbu/article/details/10004443 /* 题意:在i前面找回文子串,在i后面找回文子串相互配对,问有几对 ...
- VK Cup 2012 Qualification Round 1 C. Cd and pwd commands 模拟
C. Cd and pwd commands Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset ...
- VK Cup 2012 Qualification Round 1---C. Cd and pwd commands
Cd and pwd commands time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- VK Cup 2012 Qualification Round 1 E. Phone Talks —— DP
题目链接:http://codeforces.com/contest/158/problem/E E. Phone Talks time limit per test 3 seconds memory ...
- VK Cup 2015 - Qualification Round 1 D. Closest Equals 离线+线段树
题目链接: http://codeforces.com/problemset/problem/522/D D. Closest Equals time limit per test3 secondsm ...
- VK Cup 2016 - Qualification Round 2 D. Three-dimensional Turtle Super Computer 暴力
D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Des ...
- VK Cup 2016 - Qualification Round 2 B. Making Genome in Berland 水题
B. Making Genome in Berland 题目连接: http://www.codeforces.com/contest/638/problem/B Description Berlan ...
- VK Cup 2016 - Qualification Round 1 (Russian-Speaking Only, for VK Cup teams) C. Promocodes with Mistakes 水题
C. Promocodes with Mistakes 题目连接: http://www.codeforces.com/contest/637/problem/C Description During ...
- VK Cup 2016 - Qualification Round 1 (Russian-Speaking Only, for VK Cup teams) B. Chat Order 水题
B. Chat Order 题目连接: http://www.codeforces.com/contest/637/problem/B Description Polycarp is a big lo ...
随机推荐
- delphi 注册表操作(读取、添加、删除、修改)完全手册
DELPHI VS PASCAL(87) 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息. 一.创建和释放TRegistry对象 1.创建TRegistry对象.为了操 ...
- (转)Visual Studio原生开发的10个调试技巧(二)
我以前关于Visual Studio调试技巧的文章引起了大家很大的兴趣,以至于我决定分享更多调试的知识.以下的列表中你可以看到写原生开发的调试技巧(接着以前的文章来编号).这些技巧可以应用在VS200 ...
- C#(WinForm)实现软件注册
转自:http://www.cnblogs.com/ynbt/archive/2011/11/02/2233470.html 源码如下:下载
- 如何解决grails2.3.2中不能运行fork模式
升级到grails 2.3.2之后,运行时报如下的异常: Exception in thread "main" Error | Forked Grails VM exited wi ...
- 【LeetCode】102 - Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- Exploit用法示例
一.msf> show exploits与msf> show payloads:这两条命令用于展示Metaploit目录中所有可用的漏洞利用代码和攻击载荷. 二.msf> searc ...
- Arduino uno R3 ISP刷Rootloader for arduino pro mini
找了好久才发现的,好东西.介绍怎么使用uno对mini 刷Rootloader **SOLUTION** Reinstall the Arduino Pro Mini Bootloader using ...
- make subversion时出现neon报错 及 svn其他问题汇总(3ge )
在make subvision时,出现以下错误提示: /usr/local/src/neon-0.29.6/src/ne_auth.c:781: undefined reference to`ne__ ...
- QCon 2013 上海 -- 高并发可用
高并发可用应该是这次QCon的主要议题,目测超过一半的话题都在讨论这个主题或者和这个主题相关.看到Yun关于AWS re:Invent的总结,好像这个在AWS上也是很热的一个主题.就我个人而言,没 ...
- 微信企业支付--遇到不明确结果的err_code:SYSTEMERROR,NOT_FOUND
前提 项目开发中实现微信提现的功能.使用到了两个接口 企业付款接口:https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfer ...