QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#294572 | #4824. Bracket-and-bar Sequences | ucup-team027# | 0 | 1ms | 3564kb | C++23 | 1.5kb | 2023-12-30 14:41:27 | 2023-12-30 14:41:28 |
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int encode(int n, string s) {
int op = n, st = 0, cl = 0;
vector<int> g;
vector<int> bs;
for (char c: s) {
int cop = (op > 0);
int cst = (st > 0);
int ccl = (cl > 0);
int ch = 0, cho = cop+cst+ccl;
if (c == '(') {
ch = 0;
op--; st++;
} else if (c == '|') {
ch = cop;
st--; cl++;
} else if (c == ')') {
ch = cop+cst;
cl--;
}
g.push_back(ch);
bs.push_back(cho);
}
reverse(g.begin(), g.end());
reverse(bs.begin(), bs.end());
int ans = 0;
for (int i = 0; i < bs.size(); i++) {
ans *= bs[i]; ans += g[i];
}
return ans;
}
string decode(int n, int g) {
int op = n, st = 0, cl = 0;
string ans;
for (int _ = 0; _ < 3*n; _++) {
int cop = (op > 0);
int cst = (st > 0);
int ccl = (cl > 0);
int cho = cop+cst+ccl;
int md = g%cho; g /= cho;
char ch;
if (md == 0) {
if (cop) ch = '(';
else if (cst) ch = '|';
else ch = ')';
} else if (md == 1) {
if (cop && cst) ch = '|';
else ch = ')';
} else {
ch = ')';
}
ans.push_back(ch);
if (ch == '(') {
op--; st++;
} else if (ch == '|') {
st--; cl++;
} else {
cl--;
}
}
return ans;
}
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
string s; cin >> s;
int t; cin >> t;
while (t--) {
int n; cin >> n;
string g; cin >> g;
if (s == "encode") cout << encode(n, g) << '\n';
else cout << decode(n, stoll(g)) << '\n';
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3472kb
input:
encode 3 1 (|) 4 ((((|)|)|)|) 5 (|(|))((|(|))|)
output:
0 56 3593
input:
decode 3 1 0 4 56 5 3593
output:
(|) ((((|)|)|)|) (|(|))((|(|))|)
result:
ok 3 lines
Test #2:
score: 100
Accepted
time: 0ms
memory: 3444kb
input:
encode 1 1 (|)
output:
0
input:
decode 1 1 0
output:
(|)
result:
ok single line: '(|)'
Test #3:
score: 100
Accepted
time: 0ms
memory: 3484kb
input:
encode 3 2 ((|)|) 1 (|) 2 (|(|))
output:
2 0 1
input:
decode 3 2 2 1 0 2 1
output:
((|)|) (|) (|(|))
result:
ok 3 lines
Test #4:
score: 100
Accepted
time: 1ms
memory: 3564kb
input:
encode 1000 3 (|)(|)(|) 3 (|)(|(|)) 3 (|)((|)|) 3 (|(|))(|) 3 (|(|)(|)) 3 (|(|(|))) 3 (|((|)|)) 3 ((|)|)(|) 3 ((|)|(|)) 3 ((|)(|)|) 3 ((|(|))|) 3 (((|)|)|) 4 (|)(|)(|)(|) 4 (|)(|)(|(|)) 4 (|)(|)((|)|) 4 (|)(|(|))(|) 4 (|)(|(|)(|)) 4 (|)(|(|(|))) 4 (|)(|((|)|)) 4 (|)((|)|)(|) 4 (|)((|)|(|)) 4 (|)((|)...
output:
15 7 11 41 17 5 25 46 22 34 74 12 63 31 47 167 71 23 103 187 91 139 299 51 185 89 137 497 533 1165 209 65 305 245 101 29 149 517 193 733 661 361 190 94 142 502 214 70 310 562 1274 572 274 626 284 418 898 154 950 2030 1526 938 428 908 164 340 56 255 127 191 671 287 95 415 751 367 559 1199 207 743 359...
input:
decode 1000 3 15 3 7 3 11 3 41 3 17 3 5 3 25 3 46 3 22 3 34 3 74 3 12 4 63 4 31 4 47 4 167 4 71 4 23 4 103 4 187 4 91 4 139 4 299 4 51 4 185 4 89 4 137 4 497 4 533 4 1165 4 209 4 65 4 305 4 245 4 101 4 29 4 149 4 517 4 193 4 733 4 661 4 361 4 190 4 94 4 142 4 502 4 214 4 70 4 310 4 562 4 1274 4 572 ...
output:
(|)(|)(|) (|)(|(|)) (|)((|)|) (|(|))(|) (|(|)(|)) (|(|(|))) (|((|)|)) ((|)|)(|) ((|)|(|)) ((|)(|)|) ((|(|))|) (((|)|)|) (|)(|)(|)(|) (|)(|)(|(|)) (|)(|)((|)|) (|)(|(|))(|) (|)(|(|)(|)) (|)(|(|(|))) (|)(|((|)|)) (|)((|)|)(|) (|)((|)|(|)) (|)((|)(|)|) (|)((|(|))|) (|)(((|)|)|) (|(|))(|)(|) (|(|))(|(|)...
result:
ok 1000 lines
Test #5:
score: 100
Accepted
time: 1ms
memory: 3500kb
input:
encode 1000 6 (|((((|)|)|)|)(|)) 6 (|((|)(|)(|)|(|))) 6 (|((|)(|(|))|(|))) 6 (|((|)((|)|)|(|))) 6 (|((|(|))(|)|(|))) 6 (|((|(|)(|))|(|))) 6 (|((|(|(|)))|(|))) 6 (|((|((|)|))|(|))) 6 (|(((|)|)(|)|(|))) 6 (|(((|)|(|))|(|))) 6 (|(((|)(|)|)|(|))) 6 (|(((|(|))|)|(|))) 6 (|((((|)|)|)|(|))) 6 (|((|)(|)(|)(...
output:
383725 142321 152041 146857 142681 152401 155641 153913 142489 152209 147025 148105 147529 535981 483493 264793 545701 493213 370741 227857 540517 488029 269329 193513 122557 536341 483853 265153 546061 549301 547573 493573 371101 228217 496813 374341 263533 169249 495085 372613 229729 157801 103045...
input:
decode 1000 6 383725 6 142321 6 152041 6 146857 6 142681 6 152401 6 155641 6 153913 6 142489 6 152209 6 147025 6 148105 6 147529 6 535981 6 483493 6 264793 6 545701 6 493213 6 370741 6 227857 6 540517 6 488029 6 269329 6 193513 6 122557 6 536341 6 483853 6 265153 6 546061 6 549301 6 547573 6 493573 ...
output:
(|((((|)|)|)|)(|)) (|((|)(|)(|)|(|))) (|((|)(|(|))|(|))) (|((|)((|)|)|(|))) (|((|(|))(|)|(|))) (|((|(|)(|))|(|))) (|((|(|(|)))|(|))) (|((|((|)|))|(|))) (|(((|)|)(|)|(|))) (|(((|)|(|))|(|))) (|(((|)(|)|)|(|))) (|(((|(|))|)|(|))) (|((((|)|)|)|(|))) (|((|)(|)(|)(|)|)) (|((|)(|)(|(|))|)) (|((|)(|)((|)|)...
result:
ok 1000 lines
Test #6:
score: 100
Accepted
time: 1ms
memory: 3524kb
input:
encode 1000 7 ((|)(|(|(|)(|)))|(|)) 7 ((|)(|(|)(|)(|))(|)|) 7 (|(|(|)((|)|))(|(|))) 7 ((|(|))|(|))(|(|))(|) 7 (|)((|(|)((|)|)(|))|) 7 (((|(|)(|))|((|)|))|) 7 ((|)((|(|))(|(|))|)|) 8 (|)(|)(|(|))((|((|)|))|) 7 ((|)|)((|)|)(((|)|)|) 7 (|)((|)|)(((|)|(|))|) 7 (|((|)|(|)))(|(|)(|)) 7 ((|)|(|(|)((|)|))(|...
output:
5607970 8321362 270533 651218 5941211 8221996 1329178 721055 29902 174523 278833 1006918 105919 324826 113789 853609 1935437 124388 1623461 660982 4448389 23334241 13416658 289712 21352682 298318 406663 416785 646988 1847819 248776 263477 25413710 51761 7290253 7896182 11944 10327045 5689484 91735 1...
input:
decode 1000 7 5607970 7 8321362 7 270533 7 651218 7 5941211 7 8221996 7 1329178 8 721055 7 29902 7 174523 7 278833 7 1006918 8 105919 7 324826 7 113789 7 853609 7 1935437 7 124388 7 1623461 7 660982 7 4448389 7 23334241 7 13416658 7 289712 7 21352682 7 298318 7 406663 7 416785 7 646988 7 1847819 7 2...
output:
((|)(|(|(|)(|)))|(|)) ((|)(|(|)(|)(|))(|)|) (|(|(|)((|)|))(|(|))) ((|(|))|(|))(|(|))(|) (|)((|(|)((|)|)(|))|) (((|(|)(|))|((|)|))|) ((|)((|(|))(|(|))|)|) (|)(|)(|(|))((|((|)|))|) ((|)|)((|)|)(((|)|)|) (|)((|)|)(((|)|(|))|) (|((|)|(|)))(|(|)(|)) ((|)|(|(|)((|)|))(|)) (|)(|)(|)((|)|(|))((|)|) ((|)((|)...
result:
ok 1000 lines
Test #7:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
encode 1000 7 (|(|)(|)(|(((|)|)|))) 7 (((|)|)((|)|)(|(|))|) 7 (|(|))((|)(|)|(|(|))) 7 (|)(|((|((|(|))|))|)) 7 (|((|)|(|))(|((|)|))) 7 (|)((|(|)(|(|)))(|)|) 7 (((|)(|)(|)|)|(|(|))) 7 ((|(|))|)((|)|)(|(|)) 7 (|)(|(|((|)(|)|(|)))) 7 (((|)(|)|)|(|))(|)(|) 7 (|)(|(|(|)((|)|))(|)) 7 ((|)(|)|(((|)|)|(|))) ...
output:
311825 1554764 40841 631207 582097 2812667 124100 123098 126455 321380 335639 783058 438239 143999 335518 3695149 402785 4982372 481439 13827679 5012402 833189 34810 269552 164122 1946326 3987253 70553 120881 593840 1169842 6053005 67055 13414652 267682 4531070 230213 311890 340439 1217461 197767 42...
input:
decode 1000 7 311825 7 1554764 7 40841 7 631207 7 582097 7 2812667 7 124100 7 123098 7 126455 7 321380 7 335639 7 783058 8 438239 8 143999 7 335518 7 3695149 7 402785 7 4982372 8 481439 8 13827679 7 5012402 7 833189 7 34810 7 269552 7 164122 7 1946326 7 3987253 7 70553 7 120881 7 593840 7 1169842 7 ...
output:
(|(|)(|)(|(((|)|)|))) (((|)|)((|)|)(|(|))|) (|(|))((|)(|)|(|(|))) (|)(|((|((|(|))|))|)) (|((|)|(|))(|((|)|))) (|)((|(|)(|(|)))(|)|) (((|)(|)(|)|)|(|(|))) ((|(|))|)((|)|)(|(|)) (|)(|(|((|)(|)|(|)))) (((|)(|)|)|(|))(|)(|) (|)(|(|(|)((|)|))(|)) ((|)(|)|(((|)|)|(|))) (|)(|)(|(|(|(|))))(|)(|) (|)(|)(|)(|...
result:
ok 1000 lines
Test #8:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
encode 1000 7 (((|)|(|)(|)(|)(|))|) 7 (|)(|(|(|)))((|(|))|) 7 ((|)|)(|((|)|))(|(|)) 7 (|(|(|)))((|(|(|)))|) 7 (((|)(|)|)|(|(|)))(|) 7 ((|)((((|)|)|)|)|(|)) 7 (|((|((|)|(|))(|))|)) 7 ((|)(((|)(|)(|)|)|)|) 8 (|)(|)(|)(|(|))((|)|(|)) 7 (|(|(|))(|)((|(|))|)) 7 ((((|(|))|)(|)(|)|)|) 7 (|(|))((|)(|)|)((|)...
output:
17769212 172631 118174 879509 922724 497482 13415881 103018 70271 1143029 645320 82313 174526 7949368 111740 1978907 571061 956404 124330 2233652 5269573 31678 552937 4694197 1561399 103568 343943 356378 445475 2673769 167105 270502 721601 1678492 241294 432479 4611622 176098 11225132 4933468 465884...
input:
decode 1000 7 17769212 7 172631 7 118174 7 879509 7 922724 7 497482 7 13415881 7 103018 8 70271 7 1143029 7 645320 7 82313 7 174526 7 7949368 7 111740 7 1978907 7 571061 7 956404 7 124330 7 2233652 7 5269573 7 31678 7 552937 7 4694197 7 1561399 7 103568 7 343943 7 356378 7 445475 7 2673769 7 167105 ...
output:
(((|)|(|)(|)(|)(|))|) (|)(|(|(|)))((|(|))|) ((|)|)(|((|)|))(|(|)) (|(|(|)))((|(|(|)))|) (((|)(|)|)|(|(|)))(|) ((|)((((|)|)|)|)|(|)) (|((|((|)|(|))(|))|)) ((|)(((|)(|)(|)|)|)|) (|)(|)(|)(|(|))((|)|(|)) (|(|(|))(|)((|(|))|)) ((((|(|))|)(|)(|)|)|) (|(|))((|)(|)|)((|)|) ((|)|)(|)(((|)|(|))|) ((((|)|)|(|...
result:
ok 1000 lines
Test #9:
score: 100
Accepted
time: 1ms
memory: 3484kb
input:
encode 1000 7 ((|(|)(|(|)))|)((|)|) 7 (|(|))((|(|(|(|))))|) 7 (|)(|(|((|)(|)|)))(|) 8 (|)(|)(|(|)(|))(|(|(|))) 7 (|((((|(|))|)|(|))|)) 7 (((|(|))|)|)(|)((|)|) 7 ((|(|))((|)|)|((|)|)) 7 (((|(|))(|)|)(|)(|)|) 7 (|(|))(|(|)(|)(|)(|)) 7 (((|)((|)|)|(|))(|)|) 7 ((|(|)((|(|))|))(|)|) 7 (|)((|(|))(|)|((|)|...
output:
2828930 1405577 1596119 54047 13198897 186580 1212062 1632268 120665 1644980 18879242 402971 974536 120905 892094 164012 356315 1882834 8348306 2781727 2750557 331555 1952617 73535 620906 1977077 179683 82906 547723 186451 13697887 430013 161392 141617 148607 652940 95507 4162189 329995 209390 37293...
input:
decode 1000 7 2828930 7 1405577 7 1596119 8 54047 7 13198897 7 186580 7 1212062 7 1632268 7 120665 7 1644980 7 18879242 7 402971 7 974536 7 120905 7 892094 7 164012 7 356315 7 1882834 7 8348306 8 2781727 7 2750557 7 331555 7 1952617 8 73535 7 620906 7 1977077 7 179683 7 82906 7 547723 7 186451 8 136...
output:
((|(|)(|(|)))|)((|)|) (|(|))((|(|(|(|))))|) (|)(|(|((|)(|)|)))(|) (|)(|)(|(|)(|))(|(|(|))) (|((((|(|))|)|(|))|)) (((|(|))|)|)(|)((|)|) ((|(|))((|)|)|((|)|)) (((|(|))(|)|)(|)(|)|) (|(|))(|(|)(|)(|)(|)) (((|)((|)|)|(|))(|)|) ((|(|)((|(|))|))(|)|) (|)((|(|))(|)|((|)|)) ((((|)(|)|)|)(|)|)(|) (|(|))((|)|...
result:
ok 1000 lines
Test #10:
score: 100
Accepted
time: 1ms
memory: 3496kb
input:
encode 1000 7 ((((|)|(|)(|))|)(|)|) 7 (((|)(|)|)(|)(|(|))|) 7 (|)(|((|(|)(|))(|)|)) 7 (|(|)(((|)|)|(|))(|)) 7 (|)((|(|))|(|(|(|)))) 7 ((|(|)(|)(|)(|))|)(|) 7 (|((|)(|(|)((|)|))|)) 7 (((|)|(|))|)((|)|)(|) 7 (|)(((|(|))|(|))|(|)) 7 (|(|))(|((|)|))(|(|)) 7 (|(|)(|))(|(|((|)|))) 7 ((|(|)(|))|(|))(|)(|) ...
output:
3765688 1553444 2184247 2164769 38795 25100366 6161917 730700 813715 118169 86321 1626566 361699 208222 247817 4862669 8327692 2621089 3295805 1642198 410047 51550 5936722 259129 50303 123629 812878 536198 2151446 25372526 111449 1678600 4387801 4216858 990136 5243221 1217974 43895 1958860 6058813 1...
input:
decode 1000 7 3765688 7 1553444 7 2184247 7 2164769 7 38795 7 25100366 7 6161917 7 730700 7 813715 7 118169 7 86321 7 1626566 7 361699 7 208222 7 247817 7 4862669 7 8327692 7 2621089 7 3295805 7 1642198 8 410047 7 51550 7 5936722 7 259129 8 50303 7 123629 7 812878 7 536198 7 2151446 7 25372526 7 111...
output:
((((|)|(|)(|))|)(|)|) (((|)(|)|)(|)(|(|))|) (|)(|((|(|)(|))(|)|)) (|(|)(((|)|)|(|))(|)) (|)((|(|))|(|(|(|)))) ((|(|)(|)(|)(|))|)(|) (|((|)(|(|)((|)|))|)) (((|)|(|))|)((|)|)(|) (|)(((|(|))|(|))|(|)) (|(|))(|((|)|))(|(|)) (|(|)(|))(|(|((|)|))) ((|(|)(|))|(|))(|)(|) (|)((((|)|)|(|))|(|)) ((|)|)(|(|)(((...
result:
ok 1000 lines
Test #11:
score: 100
Accepted
time: 1ms
memory: 3516kb
input:
encode 1000 7 (|((|)(|)|(|))(|(|))) 7 (|(((|)|)(|((|)|))|)) 7 (|)((|)((|)|)|)(|)(|) 7 (|(|))(|)(((|)(|)|)|) 7 (|(|(|((|)|(|)))))(|) 7 ((|)(|(|))|(|))((|)|) 7 (|)((|)(|)|)(|(|))(|) 7 (|(((|)|(|(|)))|(|))) 7 (((|)((|)|)(|)|)|)(|) 7 ((|)|)((((|)(|)|)|)|) 7 (((|)|(|)(|))|)((|)|) 7 (|(((|)(|)|)|(|(|)))) ...
output:
600133 6152365 110443 31673 2199773 536290 96715 4202533 991796 34222 1252988 619417 11090606 247066 238783 25267502 923477 331690 208772 35540 6521650 741154 994456 2782441 2233402 104143 1643711 12788966 3510970 4766284 1311806 2014820 650894 10361305 201922 33262 1529927 1169852 460469 51365 4911...
input:
decode 1000 7 600133 7 6152365 7 110443 7 31673 7 2199773 7 536290 7 96715 7 4202533 7 991796 7 34222 7 1252988 7 619417 7 11090606 7 247066 8 238783 7 25267502 7 923477 7 331690 7 208772 7 35540 7 6521650 7 741154 7 994456 7 2782441 7 2233402 7 104143 8 1643711 7 12788966 7 3510970 7 4766284 7 1311...
output:
(|((|)(|)|(|))(|(|))) (|(((|)|)(|((|)|))|)) (|)((|)((|)|)|)(|)(|) (|(|))(|)(((|)(|)|)|) (|(|(|((|)|(|)))))(|) ((|)(|(|))|(|))((|)|) (|)((|)(|)|)(|(|))(|) (|(((|)|(|(|)))|(|))) (((|)((|)|)(|)|)|)(|) ((|)|)((((|)(|)|)|)|) (((|)|(|)(|))|)((|)|) (|(((|)(|)|)|(|(|)))) ((|(|)((|)|))(|)|)(|) ((|)((|)|)(|)|...
result:
ok 1000 lines
Test #12:
score: 100
Accepted
time: 1ms
memory: 3520kb
input:
encode 1000 7 (|(|(|(|)(|)(|(|))))) 7 (|(|(|(|(|)))(|)))(|) 7 (|(((|)(|(|))|)|)(|)) 7 (|((|)(|(|(|))(|))|)) 7 (|)((|)(|)|(((|)|)|)) 7 ((|(|))(|)(|)(|)(|)|) 7 (((|(|))|)|)((|(|))|) 7 ((|(|(|))((|)(|)|))|) 7 (|(|)(|(|(|))(|))(|)) 7 (|((|)|(|)(|(|)))(|)) 7 (|((|)|(|)(|)(|(|)))) 7 ((|)|((|)(|(|(|)))|)) ...
output:
28253 931565 10376353 13414009 208459 1628726 1166356 18609710 432353 1036993 127201 4448902 312467 2708314 382399 3543566 995296 2030993 2405498 1301254 680921 58747 96707 1860013 492442 7964698 492452 653140 2162758 1950118 657533 108551 12487070 17887858 810085 422615 129089 209072 625528 65837 9...
input:
decode 1000 7 28253 7 931565 7 10376353 7 13414009 7 208459 7 1628726 7 1166356 7 18609710 7 432353 7 1036993 7 127201 7 4448902 7 312467 7 2708314 8 382399 7 3543566 7 995296 7 2030993 7 2405498 7 1301254 7 680921 7 58747 7 96707 7 1860013 7 492442 7 7964698 7 492452 7 653140 7 2162758 7 1950118 7 ...
output:
(|(|(|(|)(|)(|(|))))) (|(|(|(|(|)))(|)))(|) (|(((|)(|(|))|)|)(|)) (|((|)(|(|(|))(|))|)) (|)((|)(|)|(((|)|)|)) ((|(|))(|)(|)(|)(|)|) (((|(|))|)|)((|(|))|) ((|(|(|))((|)(|)|))|) (|(|)(|(|(|))(|))(|)) (|((|)|(|)(|(|)))(|)) (|((|)|(|)(|)(|(|)))) ((|)|((|)(|(|(|)))|)) (|)(((|)(|(|(|)))|)|) ((|)((|)|(|((|...
result:
ok 1000 lines
Test #13:
score: 100
Accepted
time: 1ms
memory: 3500kb
input:
encode 1000 7 (|(|((|)|))(|))((|)|) 7 ((|)(|)|)(|)(|(|(|))) 7 ((((|(|))|(|(|)))|)|) 8 (|)(|)(|)(|(((|)|)|)(|)) 7 ((((((|)|)|)|)|)|(|)) 7 (((|((|)|)((|)|))|)|) 7 (|(|((|)|))(|)((|)|)) 7 ((|)(|)|(|((|(|))|))) 7 (|(|(|(|)(|)(|)))(|)) 7 (|(|)((|)|(((|)|)|))) 7 ((((|((|)(|)|))|)|)|) 7 (|(|))(|(|)(|))(|(|...
output:
535757 13810 2109800 907903 497632 3049348 1188941 571090 463709 702161 475352 51545 1085098 2014690 988517 2189944 1615657 8216386 35080 206833 59891 1179923 33379 625508 1669963 289654 278942 318295 784009 1413626 1166054 279542 1867883 550433 911929 288281 359618 2037673 710687 111691 4860193 815...
input:
decode 1000 7 535757 7 13810 7 2109800 8 907903 7 497632 7 3049348 7 1188941 7 571090 7 463709 7 702161 7 475352 7 51545 7 1085098 7 2014690 7 988517 7 2189944 7 1615657 7 8216386 7 35080 7 206833 7 59891 7 1179923 7 33379 7 625508 7 1669963 7 289654 7 278942 7 318295 7 784009 7 1413626 7 1166054 7 ...
output:
(|(|((|)|))(|))((|)|) ((|)(|)|)(|)(|(|(|))) ((((|(|))|(|(|)))|)|) (|)(|)(|)(|(((|)|)|)(|)) ((((((|)|)|)|)|)|(|)) (((|((|)|)((|)|))|)|) (|(|((|)|))(|)((|)|)) ((|)(|)|(|((|(|))|))) (|(|(|(|)(|)(|)))(|)) (|(|)((|)|(((|)|)|))) ((((|((|)(|)|))|)|)|) (|(|))(|(|)(|))(|(|)) ((|)(((|)|)|(|))|(|)) ((|)(|)(|)|...
result:
ok 1000 lines
Test #14:
score: 100
Accepted
time: 1ms
memory: 3524kb
input:
encode 1000 8 (|(|((|)|)))(|(|)((|)|)) 8 (|)(|(|)((|)(|)(|)|)(|)) 8 (|)((|(|(|)(|))(|(|)))|) 8 (|)((|(((|)|)|))(|)|)(|) 8 (|((|)(|(|)(|(|)(|)))|)) 8 (((|)|(|))(|((|)|(|)))|) 8 ((|)(((|(|))(|)|)(|)|)|) 8 ((|)((|)|)((|)(|)|)(|)|) 8 ((|)|)(|(|(|)((|)|)(|))) 8 (|(|))(|((|)|(|((|)|)))) 8 ((((|)(|)(|)|(|)...
output:
4758125 18168839 120282251 44365115 272905933 160974620 7821610 8911258 1788190 1160153 15979912 20494364 163537633 3943991 103758169 1113502 1914983 22163612 953597 10064218 25815146 1066843 24158369 24913612 27127889 42186151 2884811 148149394 60353264 227063 5822237 11474338 4349117 31684576 2343...
input:
decode 1000 8 4758125 8 18168839 8 120282251 8 44365115 8 272905933 8 160974620 8 7821610 8 8911258 8 1788190 8 1160153 8 15979912 8 20494364 8 163537633 8 3943991 8 103758169 8 1113502 8 1914983 8 22163612 8 953597 8 10064218 8 25815146 8 1066843 8 24158369 8 24913612 8 27127889 8 42186151 8 288481...
output:
(|(|((|)|)))(|(|)((|)|)) (|)(|(|)((|)(|)(|)|)(|)) (|)((|(|(|)(|))(|(|)))|) (|)((|(((|)|)|))(|)|)(|) (|((|)(|(|)(|(|)(|)))|)) (((|)|(|))(|((|)|(|)))|) ((|)(((|(|))(|)|)(|)|)|) ((|)((|)|)((|)(|)|)(|)|) ((|)|)(|(|(|)((|)|)(|))) (|(|))(|((|)|(|((|)|)))) ((((|)(|)(|)|(|)(|))|)|) (((|)|)|((|)(|)(|)|(|))) ...
result:
ok 1000 lines
Test #15:
score: 100
Accepted
time: 1ms
memory: 3484kb
input:
encode 1000 9 ((|)((|((|)(|)|(|(|))))|)|) 9 ((((|)(|(|))|(((|)|)|))|)|) 9 (|((|((|)(((|)|)|)|))|(|))) 9 (((((|)|)|)((|)(|)|)(|)|)|) 9 (|)(((|(|))(|(|))|)(|)|(|)) 9 (|)(|((|)|)(|)(|)(|)((|)|)) 9 ((((|)(|(|))|)(|)|)(|(|))|) 9 (|(|))(((|)(|)|(|(|))(|))|) 9 (|(((|)|(|))|(|)((|)|))(|)) 9 (((|(|)((|)(|)|)...
output:
1056647866 196545160 3034727221 41710448 115838899 57005335 503790472 381568745 1651634641 6176906596 3000077365 1682453 75459844 654000436 7556648041 232660241 146825213 35631958 35606135 1249359970 10840008793 130996570 101270483 1990360 11869003 29279515 325788764 35823340 177632995 1698749878 12...
input:
decode 1000 9 1056647866 9 196545160 9 3034727221 9 41710448 9 115838899 9 57005335 9 503790472 9 381568745 9 1651634641 9 6176906596 9 3000077365 9 1682453 9 75459844 9 654000436 9 7556648041 9 232660241 9 146825213 9 35631958 9 35606135 9 1249359970 9 10840008793 9 130996570 9 101270483 9 1990360 ...
output:
((|)((|((|)(|)|(|(|))))|)|) ((((|)(|(|))|(((|)|)|))|)|) (|((|((|)(((|)|)|)|))|(|))) (((((|)|)|)((|)(|)|)(|)|)|) (|)(((|(|))(|(|))|)(|)|(|)) (|)(|((|)|)(|)(|)(|)((|)|)) ((((|)(|(|))|)(|)|)(|(|))|) (|(|))(((|)(|)|(|(|))(|))|) (|(((|)|(|))|(|)((|)|))(|)) (((|(|)((|)(|)|)(|))|)(|)|) (|((|((|(|))|)(|)(|)...
result:
ok 1000 lines
Test #16:
score: 100
Accepted
time: 1ms
memory: 3488kb
input:
encode 1000 10 (|)(|)(|)(|)(|)(|)(|)(|)(|)(|) 10 ((((((((((|)|)|)|)|)|)|)|)|)|) 10 (|(|(|(|(|(|(|(|(|(|)))))))))) 10 ((|)|)((|)|(((|)|)|)(|((|)|))) 10 (|)((|)|((|((|)(|((|)|))|))|)) 10 (|)(((|)|)((|(|))((|)|)(|)|)|) 10 ((|)(|((|)|))(|)((|(|))|(|))|) 10 (((((((|(|(|)))|)|)|)(|)|)|)|) 10 (((|)|((|)|))...
output:
262143 261632 1343693 753920590 2472084379 375089459 30964870978 906986176 235141532 1559920745 2344715494 926551714 283635821 1893906131 150986785 698622925 101560909 7848946145 10119043318 4166436716 2583835265 3905176930 163791149516 594970369934 991383919 7337062252 1601980244 11765938246 353128...
input:
decode 1000 10 262143 10 261632 10 1343693 10 753920590 10 2472084379 10 375089459 10 30964870978 10 906986176 10 235141532 10 1559920745 10 2344715494 10 926551714 10 283635821 10 1893906131 10 150986785 10 698622925 10 101560909 10 7848946145 10 10119043318 10 4166436716 10 2583835265 10 390517693...
output:
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) ((((((((((|)|)|)|)|)|)|)|)|)|) (|(|(|(|(|(|(|(|(|(|)))))))))) ((|)|)((|)|(((|)|)|)(|((|)|))) (|)((|)|((|((|)(|((|)|))|))|)) (|)(((|)|)((|(|))((|)|)(|)|)|) ((|)(|((|)|))(|)((|(|))|(|))|) (((((((|(|(|)))|)|)|)(|)|)|)|) (((|)|((|)|))|)(|)(|)((|)(|)|) (|(|))(((|)|)(|)(|(|(...
result:
ok 1000 lines
Test #17:
score: 100
Accepted
time: 1ms
memory: 3496kb
input:
encode 1000 11 (|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) 11 (((((((((((|)|)|)|)|)|)|)|)|)|)|) 11 (|(|(|(|(|(|(|(|(|(|(|))))))))))) 11 ((|)|)((|(|))(|)(|)(|)|((|)(|)|)) 11 (|((((|)|)|)|((|(|(((|)|)|)))|))) 11 ((|)|(((|)|(|((|((|)|))|)(|)))|)) 11 (((|)|)|)((|(|)(((|)|)|))(|(|))|) 11 ((|)((|)|)|((|)((|)|)|(|(|...
output:
1048575 1047552 8062157 19722967630 241764704425 2392429325926 275344539836 5967824218 312643654610 255345626182 123196181201 516447820006 146570934532 40935178099 121855863386 5229212277181 76525574609 1495179654203 280640403682 3612200483 177842864117 4235634447908 668839652 4505028185 37428951541...
input:
decode 1000 11 1048575 11 1047552 11 8062157 11 19722967630 11 241764704425 11 2392429325926 11 275344539836 11 5967824218 11 312643654610 11 255345626182 11 123196181201 11 516447820006 11 146570934532 11 40935178099 11 121855863386 11 5229212277181 11 76525574609 11 1495179654203 11 280640403682 1...
output:
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) (((((((((((|)|)|)|)|)|)|)|)|)|)|) (|(|(|(|(|(|(|(|(|(|(|))))))))))) ((|)|)((|(|))(|)(|)(|)|((|)(|)|)) (|((((|)|)|)|((|(|(((|)|)|)))|))) ((|)|(((|)|(|((|((|)|))|)(|)))|)) (((|)|)|)((|(|)(((|)|)|))(|(|))|) ((|)((|)|)|((|)((|)|)|(|(|(|))))) ((|(|)(|)(|))|((|(|))(|)|)(|...
result:
ok 1000 lines
Test #18:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
encode 1000 12 (|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) 12 ((((((((((((|)|)|)|)|)|)|)|)|)|)|)|) 12 (|(|(|(|(|(|(|(|(|(|(|(|)))))))))))) 12 ((|)|)((|)(|(|))(|(|))(|)((|)(|)|)|) 12 (((|(|((|)|))(|))(|)|)|)(((|)|)|(|)) 12 ((|)|)(|(|)((|(|((|)(|)|)))(|(|))|)) 12 ((|(|((|)|(|))(|)((|)|)(|)(|)(|)))|) 12 (|((|...
output:
4194303 4192256 48372941 119658631054 1046882705716 5487453348190 435246444693950 26692945127401 3897789600550 45384354382 136139210298292 526904250401 24370593329 310534235995 9216853052516 1005559684043 17354164895 5176643235301 6047209895032 5913790711493 20332033613798 1246624416490 498098634509...
input:
decode 1000 12 4194303 12 4192256 12 48372941 12 119658631054 12 1046882705716 12 5487453348190 12 435246444693950 12 26692945127401 12 3897789600550 12 45384354382 12 136139210298292 12 526904250401 12 24370593329 12 310534235995 12 9216853052516 12 1005559684043 12 17354164895 12 5176643235301 12 ...
output:
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) ((((((((((((|)|)|)|)|)|)|)|)|)|)|)|) (|(|(|(|(|(|(|(|(|(|(|(|)))))))))))) ((|)|)((|)(|(|))(|(|))(|)((|)(|)|)|) (((|(|((|)|))(|))(|)|)|)(((|)|)|(|)) ((|)|)(|(|)((|(|((|)(|)|)))(|(|))|)) ((|(|((|)|(|))(|)((|)|)(|)(|)(|)))|) (|((|)((|)|(|(|))((|)|))|(|))(|)(|)) ((|)...
result:
ok 1000 lines
Test #19:
score: 100
Accepted
time: 1ms
memory: 3564kb
input:
encode 1000 13 (((|)|(|((|)|)(|))(|)((|)|))(|((|)|))|) 13 (|((|)((|)|)((((|)|)((|)|)|)(|)|(|))|)) 13 (|(|(|(|))(|)(|)(|(|((|)|)))(|(|))))(|) 13 ((|(((|)|)(|(|))|((|)|(|))))((|(|))|)|) 13 (|)(((((|)|)|)(|)(|)(|(((|)|)|(|)))|)|) 13 ((|((|)(|)(|)((|)|)|))|)(|)(|((|)(|)|)) 13 (|(|)(|)((|(|(|(|)))(|))(|(...
output:
1414339492275260 5107028471981113 6442688154557 1155676536311186 4734319256003 54598199294270 318027284707601 50489624298727 3426280945949 294857798281052 2599512564080 9517292905549 31491935661053 49822422515 233407493582866 7860481817170 34700158982947 174007271800721 2371953683702 10433650880086 ...
input:
decode 1000 13 1414339492275260 13 5107028471981113 13 6442688154557 13 1155676536311186 13 4734319256003 13 54598199294270 13 318027284707601 13 50489624298727 13 3426280945949 13 294857798281052 13 2599512564080 13 9517292905549 13 31491935661053 13 49822422515 13 233407493582866 13 7860481817170 ...
output:
(((|)|(|((|)|)(|))(|)((|)|))(|((|)|))|) (|((|)((|)|)((((|)|)((|)|)|)(|)|(|))|)) (|(|(|(|))(|)(|)(|(|((|)|)))(|(|))))(|) ((|(((|)|)(|(|))|((|)|(|))))((|(|))|)|) (|)(((((|)|)|)(|)(|)(|(((|)|)|(|)))|)|) ((|((|)(|)(|)((|)|)|))|)(|)(|((|)(|)|)) (|(|)(|)((|(|(|(|)))(|))(|((|)|))|(|))) (|)(|((|(|(|)(|)))|)...
result:
ok 1000 lines
Test #20:
score: 100
Accepted
time: 1ms
memory: 3564kb
input:
encode 1000 14 (|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) 14 ((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|) 14 (|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))) 14 ((|)|(|))(|((|)|))((|)((|)|(|)(|(|)))(|)|) 14 (|((|)|(|)((((|)|)|)(|)(|)|(|(((|)|)|))))) 14 (((|)|(|))|(|(|)(|))(|(|)))(|(((|)|(|))|)) 14 (|)(|)(|(...
output:
67108863 67100672 1741425869 75587314607926 362380976488417 69943118542892 30454943008799 58152410772742556 8738929318827700 744488983485902 373100630456605 58905082351755836 77298500086373 25834643044199192 9537136056346081 747117802165973 1618461637216429 685355793611500 23862317918138141 47480388...
input:
decode 1000 14 67108863 14 67100672 14 1741425869 14 75587314607926 14 362380976488417 14 69943118542892 14 30454943008799 14 58152410772742556 14 8738929318827700 14 744488983485902 14 373100630456605 14 58905082351755836 14 77298500086373 14 25834643044199192 14 9537136056346081 14 747117802165973...
output:
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|) ((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|) (|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))) ((|)|(|))(|((|)|))((|)((|)|(|)(|(|)))(|)|) (|((|)|(|)((((|)|)|)(|)(|)|(|(((|)|)|))))) (((|)|(|))|(|(|)(|))(|(|)))(|(((|)|(|))|)) (|)(|)(|(|)(|(|))((|)(|)(|)|))(|((|)|))(|)...
result:
ok 1000 lines
Test #21:
score: 0
Wrong Answer on the first run
input:
encode 1000 15 ((|(|))|(|(|((|((|)(|)|)(|(|)))|)))((|)|(|))) 15 (|)(|)(|(|(|)(|((|)(|((|)|))|)(|)))((|)(|)|)) 15 ((|)|)((|)(|)(|(|(|)(|)(|))((|)|))(|)|(|(|))) 15 (|(|)((|)|(((|)|)(|)(|)(|)|(|)))((|)|))((|)|) 15 ((|(|(|)((|)|)((|)|((|(|))(|)|))))|)(|(|))(|) 15 (|)((|)|(|(|)))(((|)((|)|)|)|(|(|)(|((|)...
output:
42061251664720994 1552741169418335 2280087674322574 30188948406898769 415064445733979078 6167655371803 8854748861472667 1941696789202405 18876131836010026 1063203488011792010 492849033613342 115435386326042180 420738455469051325 4133194470879870025 26215066804945820 1031898857264651462 5974864264942...
input:
output:
result:
wrong answer Integer parameter [name=x_i] equals to 4133194470879870025, violates the range [0, 2*10^18] (test case 14)