[POJ1068]Parencodings 试题描述 Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P…
Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P-sequence). q B…
Parencodings Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P-s…
Parencodings 题目大意:给你一个P序列,表示从左到右的右括号左边有多少左括号,求M序列. 注释:M序列定义为每一个右括号左边最近的没有被之前的右括号匹配的括号之间,有多少已经匹配的括号队对.$1\le number for P\le 20$. 想法:暴力模拟.我们定义dis[i]表示第i-1个右括号到第i个右括号之间有多少可以直接使用的左括号. 然后我们从当前节点向之前查找,起一个dis大于0的将这个dis-1,并且输出M[i]=i-j+1.(i是当前右括号,j是dis不为0的编号)…
Parencodings Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28860 Accepted: 16997 Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn…
Parencodings Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 5 Accepted Submission(s) : 5 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Let S = s1 s2 - s2n be a w…
Parencodings Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19352 Accepted: 11675 Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn…
http://poj.org/problem?id=1068 #include<cstdio> #include <cstring> using namespace std; int ind[45]; bool used[45]; int r[21]; int l[21]; int len,n,llen; int w[21]; int main(){ int t; scanf("%d",&t); while(t--){ memset(used,0,siz…