Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
3
|
Codeforces Beta Round 3 |
FINISHED |
False |
7200 |
463859999 |
March 7, 2010, noon |
Problems
B'This is yet another problem on regular bracket sequences. A bracket sequence is called regular, if by inserting "+" and "1" into it we get a correct mathematical expression. For example, sequences "(())()", "()" and "(()(()))" are regular, while ")(", "(()" and "(()))(" are not. You have a pattern of a bracket sequence that consists of characters "(", ")" and "?". You have to replace each character "?" with a bracket so, that you get a regular bracket sequence. For each character "?" the cost of its replacement with "(" and ")" is given. Among all the possible variants your should choose the cheapest. The first line contains a non-empty pattern of even length, consisting of characters "(", ")" and "?". Its length doesn 't exceed 5 xc2 xb7104. Then there follow m lines, where m is the number of characters "?" in the pattern. Each line contains two integer numbers ai and bi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89 xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106), where ai is the cost of replacing the i-th character "?" with an opening bracket, and bi -- with a closing one. Print the cost of the optimal regular bracket sequence in the first line, and the required sequence in the second. Print -1, if there is no answer. If the answer is not unique, print any of them. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
13659 |
vlad89 |
D |
March 7, 2010, 1:51 p.m. |
OK |
GNU C++ |
TESTS |
80 |
50 |
2764800 |
|
2500 |
13137 |
ACRush |
D |
March 7, 2010, 1:14 p.m. |
OK |
GNU C++ |
TESTS |
80 |
60 |
9625600 |
|
2500 |
13680 |
balroginfire |
D |
March 7, 2010, 1:52 p.m. |
OK |
GNU C++ |
TESTS |
80 |
80 |
8089600 |
|
2500 |
13403 |
2222 |
D |
March 7, 2010, 1:30 p.m. |
OK |
GNU C++ |
TESTS |
80 |
80 |
30617600 |
|
2500 |
13495 |
ilyakor |
D |
March 7, 2010, 1:37 p.m. |
OK |
GNU C++ |
TESTS |
80 |
90 |
4505600 |
|
2500 |
13629 |
a70babat |
D |
March 7, 2010, 1:49 p.m. |
OK |
GNU C++ |
TESTS |
80 |
90 |
5017600 |
|
2500 |
13466 |
Saeed_Reza |
D |
March 7, 2010, 1:35 p.m. |
OK |
GNU C++ |
TESTS |
80 |
230 |
3686400 |
|
2500 |
12555 |
Petr |
D |
March 7, 2010, 12:39 p.m. |
OK |
Java 6 |
TESTS |
80 |
160 |
30617600 |
|
2500 |
12889 |
Nerevar |
D |
March 7, 2010, 1 p.m. |
OK |
MS C++ |
TESTS |
80 |
60 |
2355200 |
|
2500 |
remove filters
Back to search problems