QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133147 | #5246. Nawiasowe podziały [B] | jrjyy | 6 | 3739ms | 6084kb | C++20 | 3.5kb | 2023-08-01 16:24:58 | 2023-08-01 16:25:02 |
Judging History
answer
/* qoj_p5247.cpp */
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
int n, k; std::cin >> n >> k;
std::string s; std::cin >> s;
std::vector<int> stk, b(n, n), id(n, -1); int cur = 0;
for (int i = 0; i < n; ++i) {
if (s[i] == '(') {
stk.push_back(i);
} else {
if (!stk.empty()) b[i] = stk.back(), b[stk.back()] = i, stk.pop_back();
else b[i] = -1;
}
}
for (int i = 0; i < n; ++i) if (s[i] == '(' && b[i] < n && id[i] == -1) {
for (int j = i; s[j] == '(' && j < n; j = b[j] + 1) id[j] = id[b[j]] = cur;
++cur;
}
// for (int i = 0; i < n; ++i) std::cerr << b[i] << ' ' << id[i] << '\n';
auto calc = [&](int ql, int qr) {
static int l = 0, r = 0; static i64 x = 0;
static std::vector<int> f(cur);
while (r < qr) x += s[r] == ')' && b[r] >= l ? ++f[id[r]] : 0, ++r;
while (l > ql) --l, x += s[l] == '(' && b[l] < r ? ++f[id[l]] : 0;
while (qr < r) --r, x -= s[r] == ')' && b[r] >= l ? f[id[r]]-- : 0;
while (ql > l) x -= s[l] == '(' && b[l] < r ? f[id[l]]-- : 0, ++l;
// assert(x == (qr - ql == 2 ? 1 : 0)); //
// i64 y = 0;
// for (int i = ql; i < qr; ++i) for (int j = i + 2; j <= qr; j += 2) {
// int x = 0; bool f = true;
// for (int k = i; k < j; ++k) x += (s[k] == '(' ? 1 : -1), f &= x >= 0;
// y += f && x == 0;
// }
// std::cerr << "Move " << l << ' ' << r << '\n';
// if (y != x) {
// std::cerr << "X" << x << ' ' << y << '\n';
// for (auto &x : f) std::cerr << x << ' ';
// }
// assert(y == x);
return x;
};
using Info = std::pair<i64, int>;
auto merge = [&](const Info &x, const Info &y) {
return Info{x.first + y.first, x.second + y.second};
};
auto get = [&](auto val) {
std::vector<Info> f(n + 1, Info{1e18, -1}); f[0] = Info{0, 0};
auto trans = [&](auto self, int l, int r, int ql, int qr) -> void {
if (l >= r) return;
int m = (l + r) / 2; std::pair<Info, int> x{Info{1e18, -1}, -1};
assert(ql < qr);
for (int i = ql; i < qr; ++i)
x = std::min(x, {merge(f[i], Info{calc(i, m + 1) - val, 1}), i});
f[m + 1] = std::min(f[m + 1], x.first);
// std::cerr << "Got " << m + 1 << ' ' << x.second << ": "
// << x.first.first << ' ' << x.first.second << '\n';
self(self, l, m, ql, x.second + 1), self(self, m + 1, r, x.second, qr);
};
auto solve = [&](auto self, int l, int r) -> void {
if (l >= r) return;
int m = (l + r) / 2;
if (r - l > 1) self(self, l, m);
// std::cerr << "Trans " << l << ' ' << m + 1
// << " -> " << m + 1 << ' ' << r + 1 << '\n';
trans(trans, m, r, l, m + 1);
if (r - l > 1) self(self, m, r);
};
solve(solve, 0, n);
return f[n];
};
i64 lo = -1e10, hi = 0;
while (lo < hi) {
i64 m = (lo + hi + 1) / 2;
auto [s, c] = get(m);
// std::cerr << m << ": " << c << ' ' << s << '\n';
if (c <= k) lo = m;
else hi = m - 1;
// std::cerr << lo << ' ' << hi << '\n';
}
auto [ans, c] = get(lo); ans += lo * k;
std::cout << ans << '\n';
return 0;
}
詳細信息
Subtask #1:
score: 0
Dangerous Syscalls
Test #1:
score: 1
Accepted
time: 0ms
memory: 3568kb
input:
1 1 (
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3460kb
input:
1 1 )
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
2 1 ()
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
2 1 )(
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
2 2 ()
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3460kb
input:
2 2 )(
output:
0
result:
ok single line: '0'
Test #7:
score: -1
Dangerous Syscalls
input:
10 4 ()))(()(()
output:
result:
Subtask #2:
score: 0
Dangerous Syscalls
Test #16:
score: 1
Accepted
time: 4ms
memory: 3484kb
input:
300 25 ((()()()(()())(((())())()))()((()(())))((()()))((()()))()()(((())())))((((())(()()()())(((()))(()())()(())())()()()()())(()((()()()))))(())()((()))((()))(()(()())))((()(())(((()))))((()()()()()())())(((()))()()()(())())(())()(((()))()((()()())))((())())(((()())())((()))(()()()()(())(()())((()...
output:
90
result:
ok single line: '90'
Test #17:
score: 0
Accepted
time: 3ms
memory: 3528kb
input:
300 1 ((((()))((((())))(())((()()(()())()())()()())()()())((()(()(())))((()))))()()(((())())))((((()((()))(())())))()(((())(())(())()()))((()()()())((())()())((()()(()(())))(()()))())()(((()()(()))))((()())()((()()(()()()())()(())()(()())()))((()()(())()())()()())((()((())())()))))(((())()(())(((())...
output:
332
result:
ok single line: '332'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
300 4 ((((((()(())()())))(((()()(())())))()())((((((()()))))()((())(()((())))()()())(()(()()(()())())()))(()(()())(()())())(((())))(()())()(()((()()())(()()((())))((()((())())))(((()())()))(()))()((()))()()()()()()()(()(()(())()))(()(()()()()())()(()))))()(((()())))((()(())()))((()()(()()((()()(()))...
output:
250
result:
ok single line: '250'
Test #19:
score: 0
Accepted
time: 3ms
memory: 3504kb
input:
300 1 (((()((()(()()()())()))((()))((()()(()(())())(()())()())()(()))((()()()))()((()(()())()()(()()))(()(()()()))()())()(()(())(())(())()(())(()())((())()()(())())(()((()))(()))(()(((()())))(()))((()()))()()(((()))))(()()(((()()))))(()()))()(()((((()()))(((()))))()())()(()((()())())(())(((()())(())...
output:
400
result:
ok single line: '400'
Test #20:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
300 2 ()((())()(())()()()()(()))(()(())(()))(()())(()()()()()()(()()())())(()())()(()()(()()())()((())()))(()()())(()())((()()(()))(()())()()())(()()()()())((()()))(()(())(()()))((()())(()())()(()(()()()())())()())(()())(()()()()()(())(()()))((()()()))(())(()(()())(()()))()(((()))()()()()(()())())((...
output:
453
result:
ok single line: '453'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
300 169 (((()))()()())(()(()(())))(()(()()())()(())()(())(()()()))(()(()))(()()(()())(()))(()()())()()(()(())(()()())(()))()((()))(())((())(())()((()))()()())(()()(()()))((()))((()()))(()()(()))(()())(())()(())(()()())()(()())(())((()())(()()))()(())(()(()))(()()(()()))()(()())(())(()(()))(((()))()(...
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
300 1 )((())(()()(()))(())))((()()()))))((((()))))()())()))((())))()))(())))()()))))())(())()())((((((()))(((()())())((())()(()(()()((()(())))())((()())())))()())))(((()(((()(((()))(()((()())))(((((((()(())((((()((()()())(((()))()((()()((((((()())))((()())))))))())()(())))()))()(()()()(((()(()))())(...
output:
202
result:
ok single line: '202'
Test #23:
score: 0
Accepted
time: 3ms
memory: 3468kb
input:
300 2 )(())((())))(()()(((())(((()((((()()))())(((((())))))((())())())))(((((()((((())(()())))))))))((()()))(()))((()())(())(()(((((((((()))()(())(((((()(((()())(()))))()))((()((())())))((((((((()(())((()))()()(())(()()()()()))()())())()(()(((()))((()()(((((())(()))(()(()(((()(()))(()(((())((()(((((...
output:
181
result:
ok single line: '181'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
300 7 ()((()))())())((((()()(((())))))())()((()))()(())()())((()))))((((((()))((()()))())((()()()(()()((()((())))))))(()((()()(())()((())((((((()())(()))()))())))))(((()()())))()()(()))()))(()()(()()))()((())))((()(())(())(())()())())()))))(((())(()))))))()()(()()(())))))))))()()(()))(())()()(()))))...
output:
148
result:
ok single line: '148'
Test #25:
score: -1
Dangerous Syscalls
input:
290 15 ))(())())(((()()()))((()())))(()))()()))())()())()((()))))())()))(()()(()))()())(())((()()())((())()))(()(())))))(())(()(((()))((()))()((())()(((())(((()))((((((()()()(((()(()((()))(())(())(((()()()())()())()((()())()()(()()))))())(())))))(()()(()()())))()))()))))))())(((())(()))))())()(((
output:
result:
Subtask #3:
score: 0
Dangerous Syscalls
Test #33:
score: 1
Accepted
time: 73ms
memory: 3584kb
input:
4000 1 (((((())())()((())(())(()()())()())(()(())(()))()(()))(()((())()()()()(()())(()()()))()(())()()(()(()()())))(()))(()(((()))()())((())(()()(()()))))((()((()())())((())())((()()))(())(())(()(()()))(((())())())((())()()(()))(()()()(()(())(()))()())((()))((())()(())()())))(((()(()()()()())(())())...
output:
5599
result:
ok single line: '5599'
Test #34:
score: 0
Accepted
time: 77ms
memory: 3628kb
input:
4000 3 (((((((())))()()((((())(())()())()())(()(()())())))(()((())()((()()()((())()()))()))(())(()(()))()(()()()()((()(()))())()((()()()))(())(()()((())())))))(()(((((())))())((()()(((()()))())())())(())(()())(((()))())(()((()()()))(((()))())())())((())(())((())(())()(())()(((()))((())))))(((((())))...
output:
4568
result:
ok single line: '4568'
Test #35:
score: 0
Accepted
time: 73ms
memory: 3652kb
input:
4000 8 (((()))((()()(()())(()())((()))(((())))))(((())()(())()()()()((())())())((())()((())()))()(((())())()())(((()()()))(()()()(())(()))))(()()((()))((()())())((())(())()(())))(((((()()()())))(()()(()()())()()))()((())(()(()))((())()())((()()))()())(((())())()((()())(()()(())())()()((())))(())()((...
output:
4780
result:
ok single line: '4780'
Test #36:
score: 0
Accepted
time: 74ms
memory: 3604kb
input:
4000 21 (((((()())(())()))(()(())((((())())))()((()))()(()())()((())()())()()((((()))))))(((((()())()()()))((()))())((()))(()()(()))(()()((())))(())((()()())())(()()(())))(((())(()((())))()()(())(()((()()())(()))(()))))((()()((()()()())()())(()((()()()())())))(()()(((())()())()()((())(()))()(()))()(...
output:
3864
result:
ok single line: '3864'
Test #37:
score: 0
Accepted
time: 74ms
memory: 3632kb
input:
4000 55 ((((()))((((()())))())(())((()()())((()))(()()(()((())()((())))()())(()))((()())(()())()()))))((((())))(()()(((())())())()((()))(()(()(()))(())())())((((()())(((()))())())((())())(()((()(())()(()())))()(()()(())))))(((((())()))((()())(())()()(())()()(()())())(()()(())((()()()))))))((()(())((...
output:
2909
result:
ok single line: '2909'
Test #38:
score: 0
Accepted
time: 76ms
memory: 3636kb
input:
4000 2 (((()())()(()())(())((()()))()())()((((())))())()()(()()(()())(())(()())()(())))(((())((()))(()((())))((()())((()())()())(()))((()))()(())(()())(())(())()(()()((())))()(())(())()()())()((((()))()()))((()()((()))())(())(())()()((()))()(()())(()))((())(((())()))())((()(()())(()()))(()(()))())((...
output:
5959
result:
ok single line: '5959'
Test #39:
score: 0
Accepted
time: 74ms
memory: 3604kb
input:
4000 5 (((((()())()))()(()((()())(()()())())((())((()()())()()))()(())(()()()(()))()((()))()()(((((()))))(()))()()()(()()))(((())(()(()))()()(()())(())()(()))())(()()())((()(()(()())()))(()(()()()()(())))))(((())((()())()()(())()()(())))((((()))(())())((())(())))((()))(()())((((()))))(((())))(()(())...
output:
4784
result:
ok single line: '4784'
Test #40:
score: 0
Accepted
time: 75ms
memory: 3632kb
input:
4000 30 ((((()()(()())(()(())((()(()))()))(()(()((()))))(())()((()())()((())())()((())()))())()((())())(((()))()()((())(()))(()())(((()))())(())))()((()(((())))((((()))()()()()()()(())())(())(())()(())))())(((())()()((((()))())())))(((()(()))))((()(()(()())()()()()(()))()))((()((())()())((()()())())...
output:
3346
result:
ok single line: '3346'
Test #41:
score: 0
Accepted
time: 72ms
memory: 3564kb
input:
4000 200 (((())()(()(()())())(())(())(()(()()())()()(())()(()))((())())(()(()))()(()(())))(()(()))(()()())((()(()))()(()()))((()((()))))(()(()())()(())))(((())())((()((()))))(())()(()(()())(((()))()))(())(()(()())(())(())(())())(()()()()((()()())())(())((()))(()()()()()(())))((())()()((()))(())(()))...
output:
1712
result:
ok single line: '1712'
Test #42:
score: 0
Accepted
time: 40ms
memory: 3572kb
input:
4000 800 ()()(())()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()()(())()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()(...
output:
1410
result:
ok single line: '1410'
Test #43:
score: 0
Accepted
time: 72ms
memory: 3692kb
input:
4000 1 (()))))))(())())((((()()())))((())((()(()))))())()())))))()(()))()()()())()()((()((()))((((())))())(()))(())))(()()()))())(()(()(())(((((((((((()(())(()))()((()())(())))(()))((())(()))(((())(())))())(()))(()))()((((((())))()(()()()((((()())()(()))(((())((((())((())))()(((())))())()((()())((((...
output:
3883
result:
ok single line: '3883'
Test #44:
score: 0
Accepted
time: 76ms
memory: 3580kb
input:
4000 3 ()(()((())))()((()))(()()()))())))()())((()()((((()()))(()((()()((())(())())))(())))())()((()()(()))()()())))())))((()(()))(((()(((((())())())))()())())))((((((()))))()((()))))(()()(()((((())()()(())())(()(()((()))))()()((()(())))))(()()(((()())((()()))((()))(((((())(()()((((()((()((()()))(((...
output:
3322
result:
ok single line: '3322'
Test #45:
score: 0
Accepted
time: 72ms
memory: 3676kb
input:
4000 7 )(()(()))())))((())()((()))()()))()()))()(())()(())))((())))(((((((()))((((())))))))))))(()()((())(((())(((((())()))(())())()))()(((()())(())(()((()))()())))()(())(()))))(()))())())))))(()))))()))((())()))()(())())((()((((((()()(()()())((()()()(())((()))()(()))(((()))))(()))(()((())())()(((((...
output:
3230
result:
ok single line: '3230'
Test #46:
score: 0
Accepted
time: 77ms
memory: 3696kb
input:
3997 30 (())()()((())()((()((()(()((())(()((((())))((()))))))((())()()(()))()()(()(()(((()())())((()(())()))())((()()))(())(()((((()())(()))()()()((()()()(()))()))()()(()((((((())((())(()(((()((())()())()(()()((()()()()))(())))(())()))))))())(()(())))()())(()))))(())))(())((((((()))(()(((((()))())((...
output:
2556
result:
ok single line: '2556'
Test #47:
score: 0
Accepted
time: 76ms
memory: 3564kb
input:
4000 250 ))))(()))))())()())))))(()()()())()())))((()(()())(()))))()(()((()(())((((((())))((((((((())()()))()()()()))(((((()()()())()((()(())()))))))))))())(()(()(()))))((()())(((()))))()())))(()((((()()(()())(()()))())(()(()((((()()((()()())())((((()))()(()(()(())))())())()()()())(()(()))())(()())(...
output:
1017
result:
ok single line: '1017'
Test #48:
score: -1
Dangerous Syscalls
input:
3990 1 (((((((((((((((()(()))((((())(((()())(()))))())))(())))))))))(((((((()(((((()))))))))))))))((((((())(()()))(((((((()(((())((((((())))()))))(((()(((()())(()))))))))))))((((((((())((())(())))(((((((()())))))((((((())))(((((((((())((((())((((((()(((((()((()(())))))()))(()())))(((((((((((()(((()(...
output:
result:
Subtask #4:
score: 0
Dangerous Syscalls
Test #54:
score: 1
Accepted
time: 69ms
memory: 3580kb
input:
4000 2 ((())(()(())))()((())()()()(())()()(())()((()))()()((()()))((())())((())())(()())()(())(()(()))((()())())(()())((()()))(()()())((()))()())(()(()))((()()())(())()((())()))(())((())((())))(((()(())))()(())())(()(())(())())((())(())())((()(()))()()()()(()())())(((()))(())())((()())())((())()((()...
output:
18432
result:
ok single line: '18432'
Test #55:
score: 0
Accepted
time: 76ms
memory: 3568kb
input:
4000 5 (((((((()))(())(()(())()()(())(()))()()(((()))())()(()))(((()(()()))()())()()(()(())()(())))((()()()())(((())))((()())()(()()())()()()())()()(()(()))))())((()()())((((((()))()())(()())())())()((()()()(()()((()))()()())(())()())()()()))(())())()(((((()()(()(())()()))))((()()((())())((()())))((...
output:
4336
result:
ok single line: '4336'
Test #56:
score: 0
Accepted
time: 76ms
memory: 3508kb
input:
4000 13 (((((()()))(()()(()((())(()()()))(()))(((()()(()()))()())((())()())()())((()()(())())((()()()()))(())()(())())()((()(())())()()()()())((()(()()()(()())))(()()))(((())(()()))()(())))))()((())((((()()())(()()))(())((()((())))())()(((())()()(()()())(()))()(((()))(((())()()(())))))(((()())))(()(...
output:
3928
result:
ok single line: '3928'
Test #57:
score: 0
Accepted
time: 75ms
memory: 3580kb
input:
4000 34 (((((()())()(((()())()(()(()))(())(((())))()))(()()(()(()(()))))((((()))))((()))(((()()(())))()()(())((()))))()(()(())()()((())))()(()((()))())()((())((((()(()))(()())()()(()(())(())))(()()()())))(()()))((()))((((()()))(((()))))))((((()))((()()())())()(((((())))()(())))())(((())))()((((())))...
output:
3285
result:
ok single line: '3285'
Test #58:
score: 0
Accepted
time: 75ms
memory: 3648kb
input:
4000 89 ((((((()(()(())())))((()()))((())()())((()))(())((()))((((())))())()()(()((()))())())(((()())(())()((())(())))()))()(((()((()))(()())())(()((()()))(())(())()())((())()()())(())((()))(((())()))(((()))(()())(()((()))))()()))((()())(((()(()))((()(())))))(((()))(()))(((()(()()()())(()()()())()()...
output:
2483
result:
ok single line: '2483'
Test #59:
score: 0
Accepted
time: 70ms
memory: 3568kb
input:
4000 3 ((((()(())(())()(()((()(()))()())(()))())((()((())()((()()())())())())((()(()())()))(()())(((()))(())((())()))))((()())(((()))()(((())))(()()(()()))()(()()(()(())()()))((()))())(((()())())((())(())(())()()()()()((()))))((()(()()()()))()(())()()((()(())())(())))((())(())()())(((())()())((()))(...
output:
4590
result:
ok single line: '4590'
Test #60:
score: 0
Accepted
time: 69ms
memory: 3684kb
input:
4000 10 ((((()))((())))(((()()())()(())(((()))))))(((((()))()()(()())((())())()()()()()(())()())()((()())()()())()()(((()())())())(((()))(()((()))())((())()())()(())()(())))((()((()(()))(()()))())(()()(())(())((())(()))(()))())((((())())(((()))))()((()))))((((()()))(()((()()())())()()(()()))()()(()(...
output:
4500
result:
ok single line: '4500'
Test #61:
score: 0
Accepted
time: 76ms
memory: 3608kb
input:
4000 100 ((((((())((()))))(((()()())()((()(())))(()(()))()()((()(()))(())(()()())()))(((()))()))((()((()()))()))(((((())))(((())))()()((()()))()))(((()(())()()())()((()())((()))())()(())()(()()(()(()))))))(((((()))((()())(()())(()(())))()(()())())((()(()(()))((()()(())(()))))()()()()()((()())(())()(...
output:
2241
result:
ok single line: '2241'
Test #62:
score: 0
Accepted
time: 68ms
memory: 3568kb
input:
4000 400 ()((()))(()(())())(()())((())(())())((())()()(())()()()())(()()()()())(())((()()())())((()()))(())((())((())())(())())(()())(()())((()()))(()()()())()(()((()))())((()()()))((())(()))(()())((()()()())((())())())((()()())())(())()(()(()))((()))(()(())(())()()()(()()))(()(())())(())((())(())((...
output:
1134
result:
ok single line: '1134'
Test #63:
score: 0
Accepted
time: 43ms
memory: 3600kb
input:
4000 1200 ()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()()()()()()()()()()(())()()()()()()()()()()()()()(())()()(())()()()(())()()(())()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()...
output:
705
result:
ok single line: '705'
Test #64:
score: 0
Accepted
time: 77ms
memory: 3572kb
input:
4000 2 ((()()))))((((())(())))()((()))()(()))()))()(()))((())(()()(()()))(())))()))))))(())))(()((((()(((()())(((((((())()())()()(()()))))(((()))(((()()((()()(()))())(((()())()))((((((())(()()()(((((())))()))(()())(())((((()))()())())(())))()()(()()(()()())((((())(((())(())(()(((())))))(())))(()())(...
output:
3688
result:
ok single line: '3688'
Test #65:
score: 0
Accepted
time: 72ms
memory: 3608kb
input:
4000 5 )()(())(())))))(()(((())((())))))(()((())(())()(()(()((()((()()))())((()(((()()(((((()))(())))((()()()()()))())))((()))))((()()((())((())(())))(((())()((((()()(())())(())))()()()))))())(()())()))()))((())()))(())()()))(()()))()((())())(()()()(((())(((((()((()()(()()))(((((((()()(()(()(((())))...
output:
3157
result:
ok single line: '3157'
Test #66:
score: -1
Dangerous Syscalls
input:
3994 15 )())((()(()((()()((((()()))((()()()((((()())))(()(()()))())((()(()(((()(())())))))()())()())(()((())))))(((((((()))))())))(()()))((())))()()()(()(())(())())))()()((())))()(())))()((((())((())))()((((()))))(())()))()())()(((()(())()(())((((((()((())((((()(())()()(()))((()((()())(())())))))()(...
output:
result:
Subtask #5:
score: 1
Accepted
Test #75:
score: 1
Accepted
time: 3239ms
memory: 5760kb
input:
100000 3 (()((())(()))(())((()())))(((()()))(()))(()()()((())))()()((())(())((())(()(()))())((())))()()((())(()()))(((())))((())()(()())(()())()(()(()()())))(()(()()))()(()((())()()()()())((()))(())(())())(((()))()(()()())()(()()))((()()))(((()()()()))(()))(((())))(((()))(()()())(()(()()))(())(()())...
output:
3832013
result:
ok single line: '3832013'
Test #76:
score: 0
Accepted
time: 3463ms
memory: 5636kb
input:
100000 9 (((((())(((())))(()))(()(()))((()()()))()(())(()))(((()()(()))))(()((()()))()(((()))((())))(())(()))(((()())(())((())))(()))()()(()((()))()(()(()())))((()(()))(()()((()())))((()(())())()((()))(()))()(()))((()((())))())(((()(())))()(((()())()()())(())()()(()(())(()())())))((()))(((()())()()(...
output:
131464
result:
ok single line: '131464'
Test #77:
score: 0
Accepted
time: 3266ms
memory: 5760kb
input:
100000 15 ()((()(()()))()(())(()))(((()))()((())(())(())(()())))(()()()())(()((())))()(((()))()(()(()))((()))(()))(()((())()()()(()))(())(())(()())(()()))(()(())(())(()()))(((())(())))(())(()()()()()()(()))((()()())())((()))(((())()()()))((())())()((())(())(())()()(()))((()()(()))()()()())()(()())((...
output:
1352858
result:
ok single line: '1352858'
Test #78:
score: 0
Accepted
time: 3497ms
memory: 5736kb
input:
100000 21 ((((())()(()()()((())))((())(())))((()()((((())()))()(()()()())()(()())(()(()))))(((()())(())()()((())))))()((()(()()())()(()()(()()((()))))))()(((((())())())((()())(())()()(())()()()))(()))()(((((()())()))((()()))))(((())(())())(()(())((()))))()((((()()())())))()(((())()()()(()(()()()))))...
output:
120911
result:
ok single line: '120911'
Test #79:
score: 0
Accepted
time: 3138ms
memory: 5768kb
input:
100000 27 ((()))(()(()))()(())((())())((())()(())())((())())()()(()()())(())(()(()())()(())(())(()()))((())()(()))(()(())()(()()))()(()(()(())()())()(()))((()())()(()())(((()))))((()))(())()((()()()())()(()()())((())())()()((())())(()()()))(()()(())())(()()(()()))(((()))(())()())(())()(()(()()()))((...
output:
1866778
result:
ok single line: '1866778'
Test #80:
score: 0
Accepted
time: 3575ms
memory: 5740kb
input:
100000 1 )))))()))(()()()()((())(()()()))())())(()()()((()))()(())(((()))((())())()((((()))()()((()((()(()))())))(()))))()()())(()(())()))(()(()((()(())((((()((()())()))())())(((((((())())))(())))((()(())()(((((()()(()(()))(()))(())))()())()))))((()())))()))(()()))(((())(()(()()()(()))(((((((())()()...
output:
99830
result:
ok single line: '99830'
Test #81:
score: 0
Accepted
time: 3613ms
memory: 5696kb
input:
100000 3 ((((()(((()()))((())())))(()((()))()(()())(())((())())())()(((((()))()(())))(())(((()((((())())()((()(()(()))()))))()(()()))()))(())(()())())(()()))(()))())((())()(())())())())(()))((((()())(()))))())(()))(()(()())(()())()()())(((((()())())((((()(())()()()))(()(()()((())((())()(((()(()))(()...
output:
96717
result:
ok single line: '96717'
Test #82:
score: 0
Accepted
time: 3571ms
memory: 5676kb
input:
100000 7 )((()((()(()(()())()))()))(((())))(()()))()))(())))))()()))()))))()))())(((()))(()(())(()())()))()(())(((((()())(()(())())))())((((()()(()(((((((()(()((((())()))()()())))))())())()((((())())(()(((()()(())((((((())(()()()))))())())))(((((()()()())(()(()(())((((())))()))))())())()))()(()((())...
output:
95714
result:
ok single line: '95714'
Test #83:
score: 0
Accepted
time: 3565ms
memory: 5812kb
input:
99996 28 ()())((()))()()())))()))))))(()(())()))(()((()())()()))()))()))))())((((()))(()))()()))(()()()((()))(())((()(())))(((())))()()())(((((()((((()(()))(((()(((((()))((((()((()(())()))(())(())()(()))((()())(((()()))))((()()(((()()))()())()()(()(())((()()(())((((())(())(()))()))()()))(()()(()())(...
output:
91255
result:
ok single line: '91255'
Test #84:
score: 0
Accepted
time: 3737ms
memory: 5668kb
input:
100000 30 ))(()()())))()())((())))())(((((()))()))()))(())()((()()))(((())))())()((((((()(((()())(())(()())()(())((()()()))(())(((())((()()()))(())))((())((())())))))()())())(()()))(()()()(()((((((()(()((())())())((((())()(())())((((())()())())((()))())()))))()()))()(()))(((())())((()()(())())()(()(...
output:
91102
result:
ok single line: '91102'
Test #85:
score: 0
Accepted
time: 2772ms
memory: 5924kb
input:
99990 2 ((())()()()()()()())(()())(())(()(())())((())())()((()(()))(()))(()())(()(()))((()()(()()))()()(())()(())(()())())()(()()(())(())(()))((()))(()()(())(())(()))(((())))(()()(())()((())(())))()(()()(()()))()((()))()()((())()())(()(()))(())(()(()))(((()))())(())(())(())((()))(()()())(()()()())()...
output:
94531
result:
ok single line: '94531'
Test #86:
score: 0
Accepted
time: 3329ms
memory: 5680kb
input:
99998 5 ((((())((((((())(()())(((()())(()))(()())((()())))))()(((()))(())((((())((()(())())((()))))))))((())(())(()))))))((()(()()())(((()()())(())())((((()))((())))(((((())()())(()))(((()))()))((()())))))))(((((((((((()())())(()()(((()()()))))))))(((()())))(((())()())((((()))))((()))))(((((())))()(...
output:
855997
result:
ok single line: '855997'
Test #87:
score: 0
Accepted
time: 3241ms
memory: 5760kb
input:
100000 15 (())(()()(())()())()(())(())((()())())(((()))()()()()()()(())()()()())(()()()()()())()(()()())(())((()())()())(())()(()()(())(())()()()())(())()(())()(()())(())(()())()(()()()(())())()((()))()(()(()))()(()()()(())()()())((()))(()()()(()()))((())())(()()()()())((()()()))((())()(())()())(())...
output:
337304
result:
ok single line: '337304'
Test #88:
score: 0
Accepted
time: 2885ms
memory: 5952kb
input:
99992 29 (((((((((()()())(((()))(())))((()((()))())))(((())(()()())())(())()))(((()(())())((()()))(((()())))))())((((((((((()((()()()))(()))(()()())((((())()())())))((((((()())()((()()(()))((())((()()))(((()()))))))(()())))(((((()((()()))())((()()))))(((((())(())(()))()))))((((((())((()))))))((((()(...
output:
285381
result:
ok single line: '285381'
Subtask #6:
score: 1
Accepted
Test #89:
score: 1
Accepted
time: 3481ms
memory: 5680kb
input:
100000 6 ((((()()((())))()((()())()())((())()(((()()))())((())((()()()))()()()(())))(((()(())(()()))(())())(())))(((()))((((())))()))(()((())(())(())((()())))(()(()(()))(())(()()()(())())(()(())(()(()))(()())()((()))()()))(()()(())))((()())()((())((())()()(((()))(())))((())())()((()())(()))))()(((()...
output:
126039
result:
ok single line: '126039'
Test #90:
score: 0
Accepted
time: 3568ms
memory: 5680kb
input:
100000 12 ((()((())(((()))()())()()((()))())((((()()))()()))))(((())(()))(((((())))((())))(()()((()()()))((())()()((()(())((()))()()))())(()((()())())(()()(()))())()(()(())(())))()((()(()))((()))()((()()((())(())))))())(((()()))(()((()()))()(((()()()())()())))())(()((()())(())()(((()()))(()()()()))(...
output:
130680
result:
ok single line: '130680'
Test #91:
score: 0
Accepted
time: 3242ms
memory: 5688kb
input:
100000 18 ((())(()()()()())()()(())((())()()()())()()()()((()()())((()))()()(()())()()()())(()())()(()(())))(()()((()()))(())()()(()())()(()())((()())()()(())()())((())(()))(()()()))((())(()())()(((())))(()(()))(()(()))()(())()(((())())()()())((())))((()())((()())))((()))(()(()()()()((())))()(()))((...
output:
525576
result:
ok single line: '525576'
Test #92:
score: 0
Accepted
time: 3536ms
memory: 5676kb
input:
100000 24 ((((((())()((())))()()(())((()())())()()(((()))()()(((())))())(()())(()(()()(())((()())(()())))(()())()(()(())()())(()((()))))()(((()(()()))())())((()))()()(()(()))())((()()()()(()(()))(()))()(()))()(((()))(()()(()(()))())()((()()())()((())(())((())(())()()())()())((())))()((()())((()()()(...
output:
118587
result:
ok single line: '118587'
Test #93:
score: 0
Accepted
time: 3438ms
memory: 5668kb
input:
100000 30 ((((())()()(((()()())())))((()))(())(()()(())))((())())((())(())())(((()(()(()))())(()())()()(())))(((()())(()))()((())((())()())((())()()()())()()()(())()()(()()))(((()()))(()()())(()(()()(())()))(())((())(()))(())()(()))))(((())(()()())()()((()))(()(()()()()((())))))((((()()()))(()((()))...
output:
132047
result:
ok single line: '132047'
Test #94:
score: 0
Accepted
time: 3597ms
memory: 5744kb
input:
99999 2 ()))())))))()))()))(()()))())))())(()))(((())(()(((()))(((()((((((((((((()))(())()(()((())(()())(())())()())()())()(()(((())())()(()(())(()))))))))))()))()()))())()(()())))((()(()((()))))))(()()())))()((())))))((()(((()()(())())()()))(())())())())))(())))(())()))())())(((((()()((((((()()(())...
output:
97853
result:
ok single line: '97853'
Test #95:
score: 0
Accepted
time: 3719ms
memory: 5776kb
input:
100000 5 )()()())(()())()()(())()))(()((())))(((((()())()((())()((()))()))(((()))(((()())((())((()())())()())))((((()))))(()((())(((()))(()((((()(())(((()(((()()))))((()((()(()(()((((()()()()(((()())))(((()(()()))))))()(()))((())()(((()(()())))))(((((()(())())(((()())()(())(()))()()()))()()())(((())...
output:
96190
result:
ok single line: '96190'
Test #96:
score: 0
Accepted
time: 3571ms
memory: 5704kb
input:
100000 15 )())((()))()((()()((()())()(((((())())()()((((()()(()())()(()((())))))(()()(()(()((())))))())(()())()))))())())()())()()(((((()()()()))))(((((()())())(()((()())()))(()()((()()((()((()))(((())()))(())((())(())))))())()((()()))(((())((()((()())(())))()()(())))(())(()()())))()())()((()(()(()(...
output:
93249
result:
ok single line: '93249'
Test #97:
score: 0
Accepted
time: 3706ms
memory: 5640kb
input:
100000 29 )()()))))()(()()()))(()())()(((())()))()())))())(((())()())))))))))(((())())((()(())()))(()))())())((((((((()(()((((())()())(()())))())((()())(()))(()())()())(((()()())()(()))((((((()(())((())))((()))(((())(())(()))(())()(())((()())(((()(()((()(())((()()(()()(((())()))()(())))((()()))(()))...
output:
91679
result:
ok single line: '91679'
Test #98:
score: 0
Accepted
time: 2268ms
memory: 5932kb
input:
100000 1 ((((((((()((((((()(()))(((((())(()))(()))((((((((((((((((((())((())((()((((((())(())))(((()))(())))())))))))(()((())(()()))))))(((((()(()())))(((()))))(()))))(((((((())())((()())))))((()())((((()(((()(((()((((())()))())))()))((((())(())))(((())))))))))((())))))()))))))(()))())))((((((((((((...
output:
10653510
result:
ok single line: '10653510'
Test #99:
score: 0
Accepted
time: 2937ms
memory: 6084kb
input:
100000 3 ()((((((((((((()()))())())((((((((((((()())(()()))((((((((()(()((()())())))((()((()((((()()))(()))))))((((()))((((((())(()(((()))()))))(((((((((()(()))(((((()((())))))(()))(((((((())(()))))())((((()(()))))(())))))))()))((((((((((())())(((((())))(((((())()))(((()(((()())((()((()))))))))))(()...
output:
99072
result:
ok single line: '99072'
Test #100:
score: 0
Accepted
time: 2764ms
memory: 5644kb
input:
99995 7 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
3068236
result:
ok single line: '3068236'
Test #101:
score: 0
Accepted
time: 3094ms
memory: 5768kb
input:
99995 28 (((((()))()(()))()(()()((()))))())(((((((()(())(())))((((((((())))()(()(()))))((()))))(()()(())))))))(()())((())()))(((((()())())))((((((((((((())))())())))))(((())())(((())())())(()))())((())()())(()))(((((((()))(((()))((((((())()))(()())))(())()))(((((((()()())(()()))((())(()((()()))(()()...
output:
193063
result:
ok single line: '193063'
Test #102:
score: 0
Accepted
time: 2401ms
memory: 5956kb
input:
99991 30 (((((((((((()())(((((((((((())(((()((()(((()())))))))(())))(()))((((()()))()))))((()(((((()()))(()))((())((((((((((())(())))))()))))(((())((()(()((()((())))(((((()(((((())((((((())((((()())))))))((())))())))))))))))))))(((()())(((((()(())))(())))(()())))(((((())())))))))))))((()())(((((()((...
output:
166229
result:
ok single line: '166229'
Subtask #7:
score: 1
Accepted
Test #103:
score: 1
Accepted
time: 2716ms
memory: 5156kb
input:
80000 81 ((((((()())((()((()))))(()())()(()(((()(()())(()())())(())))()(())(()()))()))(((()(()))((()))(())((((())))(())()((()))())((()(()())))(())(()()))(((()()))(()((())))())()(((()()))(()())()()(((()((()))(())))((())(()((())))())(()())))()()()((()()(()()(())()()((()))(())()))((()(())()()))(()(()()...
output:
87799
result:
ok single line: '87799'
Test #104:
score: 0
Accepted
time: 2554ms
memory: 5220kb
input:
80000 729 (((())(()))(()()())(()(()))(()())(()()()())(((()()())))()(()()()(()())))(((())((()()())))())((()(())()()())((()()()))()(()()()())()()(((())(()))(()())()()()(())))((()))((()())()(()()())(()()()()())(())(((()))(()(()())())())(()()())(()(())()()()()(())())()())(((())()))(((()())(())()(())((()...
output:
76309
result:
ok single line: '76309'
Test #105:
score: 0
Accepted
time: 2651ms
memory: 5260kb
input:
79770 6561 (((((((()()))(()())()()()(((())))(())(()((()))())()(()()(())()()))(()()(()())()(())(((())()))(()))(()()())(()((()(()())())(((()))())()(())()())(())))((()))()((((())()))(()())))()((()())(((()(())()())()(())((()())(())))))((((()((()())())(()(())()()))()(())(())(((())))(())()))(()(()())()))(...
output:
19831
result:
ok single line: '19831'
Test #106:
score: 0
Accepted
time: 2590ms
memory: 5204kb
input:
80000 8 ((()(()())((())()((()())))()(()(()(())())()))((())()()()()()(()))()((((())()())()(())(()))()((())()()(()((()))()(())()()())((()))(()(()())()))())((()(()))(((())()))(((())))((()))((())))(()((())()()()(()()())()())(()()()(()(())(())))))(()((()())((()))(()(()())())()()())(()((())(())()(()())(()...
output:
119650
result:
ok single line: '119650'
Test #107:
score: 0
Accepted
time: 2613ms
memory: 5160kb
input:
80000 144 ((()((()(())))((())(())(()()))())(()()(())((((()))())())(()())())(((()()()))((()())()()())(())(()())(((())()())(()()())((()()())()()))(()(())()())((()))((())(()())()()(()(()))(())()(()))(())((()())(((())())()((()))(()())(())())())())((()()()()((()))))(((())))(((())))()((((()()())()())()(()...
output:
94339
result:
ok single line: '94339'
Test #108:
score: 0
Accepted
time: 2552ms
memory: 5232kb
input:
80000 2584 (()()()()(())()(((())))(()()()()(()(()())))((((()())()))()(()())())((())()(())(()))()((())()))((((())))(()(()())(()()()()))((()())())((())()((())()(()())())()()()()(())())()(())(((()))((())))(()((()))(())(()(()())())(())))((())((()()((()))))()((()()(())))(()(())(()())()(()()(())()))()(()(...
output:
45749
result:
ok single line: '45749'
Test #109:
score: 0
Accepted
time: 2740ms
memory: 5112kb
input:
79993 1000 ()))())(((())))))(())((()(())))()(((())(()()()()(((())()()()())(()()()())(((()()((()))()((())())()(((())()(())(())((((()()((()(((())((((()(())()())))())())((())()(())(())((())(((())((()()((((())())(())))(((()(()))()))(((())))))(((((((((()(((()(()())())()))()(()()()())()()((())((()(())()((...
output:
43241
result:
ok single line: '43241'
Test #110:
score: 0
Accepted
time: 2770ms
memory: 5216kb
input:
79995 4000 )(()((())()((())))())()(()))(()((())))))))))(())(((()()))()))((()())())((((((()((((((((((())((())(()))(()()(())))))))()()(((())))()()()))))((()()(((((())())(((())()((()()()(((((())))(()(())))(((()))((()())()))((((()(((()()())())())))))())))(((((()())((((((((())))))()))))((((())())((((((((...
output:
23347
result:
ok single line: '23347'
Test #111:
score: 0
Accepted
time: 2473ms
memory: 5148kb
input:
80000 101 (())(())(((())(()()(())())(((((()())()()))()()((())(()))()((()()))()()())(()()(())()())((()(()())))()())((()(()(((())())()))(()()()()((())))((()(())()()((()))(((())()()()()())))((()(()())))(()())()()()()()()())((((()(()))))())(()()(())()()((())((())(()())()()))(()()())))()(()))(()(()()(())...
output:
105978
result:
ok single line: '105978'
Test #112:
score: 0
Accepted
time: 2356ms
memory: 5160kb
input:
80000 101 ((()(())()(())(())()((()))()(()()()))(()()()(())()()()()()()()()()()()()((()))()()()(()()()(()()))()()()(())()()(())()()()((()))()()()(())()()()()()(())()()(())()()()()(())()()()()()()()(())()()()()(())()()()()()()()()(()())(()))(()()()(())()()()()()()()()()()(())()()()()()()()()()()()()()...
output:
297923
result:
ok single line: '297923'
Test #113:
score: 0
Accepted
time: 2518ms
memory: 5256kb
input:
79993 500 )(((()(()())(()())(()()()())(()))(()(())()()()()())((()())(()))((())((()())(()(()())))(()())(()((()))()(((()))())()(()))(()()()())(((())(())())))(((())((()(()()))))(())(()()()())(((())()))(()()))(()(())())((()())()()(()())()(())(((()()))()())(()()(()))())(((())(()()()()()()())()(()())(())(...
output:
83615
result:
ok single line: '83615'
Test #114:
score: 0
Accepted
time: 2197ms
memory: 5204kb
input:
80000 500 ()()()(())()(())(((()())))(())(()()()(())()(())()()()()()()()()()()()()())(()((())())())(()(()(())))(()()()((()))()()())(()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()()(())()()()()()())(()()(())(())()()(()())(())(())()()()()()()()()()()()()()()(...
output:
200154
result:
ok single line: '200154'
Test #115:
score: 0
Accepted
time: 2465ms
memory: 5288kb
input:
79995 1001 ()((()()()()()))(()()()()(())(()())(()()()())(()()())(()()()()()(())()()(()()(()))))(()()()()(()()()()()(()()()())(())((()()()()))())(((()()(())()))((()()()()()()(()((())(()))))())(())()()()())((((()()(()()()(())(())))((())(((())))))()(())()()()())(())(())(()())())((((())(()()()()()()()()...
output:
73878
result:
ok single line: '73878'
Test #116:
score: 0
Accepted
time: 2328ms
memory: 5212kb
input:
80000 1001 (((())(())(())(()()()())(()))()(()()()()()()()()(())()(())()()()()()()()()(())()()()()()()()()()()()()()(())()()((()))()()()()()(()()())()()()()()()()())()(()())((()())()(()())()()()()()())((())()()())((()())(())(((()))(()))()()(()))(()(())()()()()()()()(())()()()()()()()()(())()()()()()(...
output:
129694
result:
ok single line: '129694'
Test #117:
score: 0
Accepted
time: 2472ms
memory: 5260kb
input:
79995 3001 ((()()()()(()())((())(())(())))(()(())())(()()())(((()()())()(()(())()((((((())()()))()()(())()()()()))()()))(()()()()()())()((())()()()()()())(()(()))()())(((()))()(()()())()()()())(()(()()()))())(())(()()(())(()())(())(())((())()())(((()())(())()(())(())()))((()(()()(())(()())(()()()()(...
output:
47142
result:
ok single line: '47142'
Test #118:
score: 0
Accepted
time: 2276ms
memory: 5288kb
input:
79991 3001 ((())(()())()(())()((()))((()))(())()()()(())(()()()()()()())()()(())()()()((()()))()(())()()(())()((()))()()(())(())(())()(())(()()())()(())()()(()()()()()())(())(()))((()()()()()()()()()()()()()())(()()()(())(())()()()(())()()()()()((()))(())(())()()(())()()(())()(())()(())()(())()())((...
output:
65975
result:
ok single line: '65975'
Test #119:
score: 0
Accepted
time: 2438ms
memory: 5156kb
input:
80000 1 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
21979221
result:
ok single line: '21979221'
Test #120:
score: 0
Accepted
time: 1774ms
memory: 5380kb
input:
80000 5 (((((((((((((((()((()))))))())((()(()))((((())))((((((((((((((((())))))((((((((()))(()())))()))(()))))())(((((())()))))))))))(())))((((((((((((((((((((((((((())((((())(())))))()))))((((((()())((((((((((((((((((((((((()(((((()(()))())))))((()((((((())((())()))(())))(()()))))))(()(((((((((())(...
output:
89513
result:
ok single line: '89513'
Test #121:
score: 0
Accepted
time: 2247ms
memory: 5164kb
input:
80000 50 )())()()())((()(()((((()))(()()()()))()((((()()))(())))(()()((()(())(((((()()(()()))()((()((())))(())()(()())())(()(()()())(((())()))))(())(()))))()((((())(()(((((()(()())((()((((((()))((())))(((((())((((()))(()((())()))()(((((()))()(()(())(()((((((()((()())()()))()))(())()((())))())()()())...
output:
58479
result:
ok single line: '58479'
Test #122:
score: 0
Accepted
time: 1774ms
memory: 5376kb
input:
79997 300 ((((((((((((()((())(((()()())()))))((((((((())())))((()())))))(((()())((()))()))(((())())(()()())())))((((()())(())((()))))((()((()(())((()))))(()))))(()((()(((()))()))))))(((((())(()()))))(())((())())))(((((()))((()))(()()))((((())(())()))(((((((()))((((())))((()))())(()))())))()(((()()))...
output:
31597
result:
ok single line: '31597'
Test #123:
score: 0
Accepted
time: 2426ms
memory: 5224kb
input:
80000 600 ((()()))(())(()())(()()()())(())(())((()))()((())())(()(()()))(())(()(()))(((()))()()())()(()()())((()()())(()))()((()()))((())()(())()())(()(()())()(())()()())((()()()))(((()))()(())()()(())(())()()()())((()))(())()(())(()())((())()())((()))()(())(()(()())()()())(())()(()(())())()(()())((...
output:
55476
result:
ok single line: '55476'
Test #124:
score: 0
Accepted
time: 1907ms
memory: 5468kb
input:
79996 3000 (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
8310
result:
ok single line: '8310'
Test #125:
score: 0
Accepted
time: 1818ms
memory: 5428kb
input:
79998 5001 (((((((())()(())))()())(())((((())((())(()())())((())()(()()())))(((((()()))()))()(()(((()())((((())(()())))))(()()(()(()(()())((()))))))((((()))()((((()))))))))))))((((((())(((((()())))()(()()(()))))))((((((()()())))((((((())(((())((())))))((()))(()(())))))))((())((((()))()(()))((()())()...
output:
5056
result:
ok single line: '5056'
Test #126:
score: 0
Accepted
time: 2486ms
memory: 5236kb
input:
79997 7001 (((((((((())((()(((()(((())(())))))((()))))))(((((((())))(((((((())(((((((()(((())())))(((()(()))((((((()(()))))()))))))((())))((((((((((()((())((((())(((((()()))))))))))))()))(((()()))))))))))))))()))((()())))))(((())())((((((((((((()((()())))(()()))(())))(((((((((())(((()))()))())(())))...
output:
9887
result:
ok single line: '9887'
Test #127:
score: 0
Accepted
time: 1181ms
memory: 5144kb
input:
80000 40000 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()...
output:
1
result:
ok single line: '1'
Test #128:
score: 0
Accepted
time: 1908ms
memory: 5144kb
input:
80000 150 ()(())()()(())()()()()(()())()(()()())()()()(())(())(())()()(())(()()())((()))()()()()()()(())()()(())(())(())()()()()(())()()()(())(())()()()(())()(())()()(())()()()(())()()(())()()()()()()()()()()(())(()()())(())()()()()()()()()()()()()()(())()()()()()(())()()()(())()()()()()()()(())()((...
output:
2783888
result:
ok single line: '2783888'
Subtask #8:
score: 1
Accepted
Test #129:
score: 1
Accepted
time: 2240ms
memory: 5256kb
input:
79856 243 (())()(())(())(()()())()(())()(()())()(())()(())()((()))(())(()(())())()(()())()()(())(())((()()))(())(()()())(()())((()())()())(())()()(())()(())((()()))()()(()()())(())()()(()())(())(())((()))(())(())()()()()()(()(()))(()(())()(()))()()()()()()()()((()()))()()()()()(())()(())(()())()(()(...
output:
794572
result:
ok single line: '794572'
Test #130:
score: 0
Accepted
time: 2641ms
memory: 5252kb
input:
79156 2187 ((((((())))((()))()(()(())()()())(()))((()(())()))((((())()))(()(((()()))())(()())(())(())(()()(())(()))(((())))(()()))()(((()()()))(()(()())))(((())(()(()))(())()())()()(())))((())()(())())(((()()()()())(())(())()((((()))(())())))((()(()()))((()()))())(())(()(()(()))()()()())((()()())())...
output:
43675
result:
ok single line: '43675'
Test #131:
score: 0
Accepted
time: 2640ms
memory: 5208kb
input:
80000 2 ((())((()))()(()()(((()))))(()(((()())(()))(())(()()))()(())(()())()((()))((()()()())()(()())()())(()((()()))(()(()))(()))(()()(())()()()))(((()(())())((()))())((()()()(()))((()())(())())(()())))(())(()()((()(()()))()(())()())()((()))((())()))((()))(()()(())(())())()((()(()()()()())((()()))(...
output:
120005
result:
ok single line: '120005'
Test #132:
score: 0
Accepted
time: 2597ms
memory: 5204kb
input:
80000 34 ((((()))((()))((()(()())(())))()())((()())()((()()))()()()((())())(()(()))(()()()()())(())(()(()()()(()())())()())))(((()(()()))(()()(()))()((()))((())()(())()(())()()()((()())())())(()((()())()()())()(())()()(()()))()(()(()(()))(()))())((())()(()(()())()())(()(()())()()))(()(()))((((())))(...
output:
112242
result:
ok single line: '112242'
Test #133:
score: 0
Accepted
time: 2644ms
memory: 5256kb
input:
80000 610 ((()())((()(())(()))()((())))((((())())()())((())))()(()()(((())))(()()(()()))(()(())((()))(())()()(()))()(((()))(()))(()())()((()((()))(()()))()))()((()(()))(()())(((()())()())((()()))(()())()(()()))()(()(()()()()())()()(())))()((()(()())()))()((((())()()())())()(()()((()()())()())))(((((...
output:
72136
result:
ok single line: '72136'
Test #134:
score: 0
Accepted
time: 2568ms
memory: 5108kb
input:
80000 10946 (())(((())(()(())())))((((()()))()((()()())))())(()((((())))()(())())((()((()))))((())()(()(()())()())((())()))()(()()()()))((((()())))((())()(()))())(((())(())(()(())))(()(()(())((())))())(())(()(())()()()))((((()())()))(()()()((()))()())(()(()))()((()())((())))()((()()))(()((()()))())(...
output:
12534
result:
ok single line: '12534'
Test #135:
score: 0
Accepted
time: 2746ms
memory: 5288kb
input:
79994 3000 ()()(((()()(())((())(()(()(()))))((()()()))))()((((((()((()))()()()(())())((((()))))((()(()(())()((())))()))(()))())((()((()()(()())((()()()()((()))(()(((()(((((()(())()()()()))())())(())))((()))(()())()(())))(((()(()(()(())(())))()))())()()))())))))()))()(()())()(((())()((())))())))())((...
output:
27732
result:
ok single line: '27732'
Test #136:
score: 0
Accepted
time: 2765ms
memory: 5208kb
input:
80000 80000 (()))((()())(())()())()((((()())())())())(((()(((())()()())()(((()(()(())((((()(((((((())))()((())((((())))(()))(()((((((()))())(())()()())()(()))()())())()())))()()))())))(()()())(((())((()()()())(((()())))))))()()(()))((()(()((((()))))()()())(((()((((()))))((((()((()()()()))((()()(()((...
output:
0
result:
ok single line: '0'
Test #137:
score: 0
Accepted
time: 2401ms
memory: 5212kb
input:
79991 101 (((()(()()())((()())))()(()())((()())()(()())(())()(())(())()(())())(((())))(()()()()()(())()()()()(())()(())()()())(()()()()()()()()())(()()()())((()(()()()()()()()()()()()()))(())(()()()()()()()()()))((())()()()()()()()()(()())()()(())()(())()()()()()()()()())(()()()(())()(()(()))(())))(...
output:
174618
result:
ok single line: '174618'
Test #138:
score: 0
Accepted
time: 2186ms
memory: 5240kb
input:
79993 101 (()()(())()(())()(())((()))()()()()()(()()())(()((())())(())()()()()()()()())((()))(()((()(())))(()()(((()())))))(()()(()))(()()()()(()))(()(()))()(((()))()()()(())()(())()())((()((()))((((()))))(()()))(())()())(())(()())(((((())()))))(()()(()())(())()()()())((())()())((())(()(()))()(())()...
output:
469537
result:
ok single line: '469537'
Test #139:
score: 0
Accepted
time: 2299ms
memory: 5220kb
input:
80000 500 ()(())(())()(()(())()()(())()()()())(()()()()()()()()()()()()()()()()()(())(())(())()(())()()()()()()()()())(()(())(()))((()()()()()()()()()()()(())(())()((()))()()()()(()())(())()()()()((())(())))(()()()()(())()()(())()()()()()()(())(()()()()()()()())()()(()()(())()((())))(())(((())))((()...
output:
142093
result:
ok single line: '142093'
Test #140:
score: 0
Accepted
time: 2275ms
memory: 5256kb
input:
79992 500 (((()())((()()))((()()()()()()())((())))(()())(()))((()(()))())((()()()()()()((()()))()(()()())(()(()))()()()(())()()()))(()()(()())(())(()())(())()()(()(()))(())()())(((()()()())()))((()()()))(()()()()()()()())((())(((((())))(((()))))))(()()()())(()()()((()))()(()())(()()()())(()())(()(((...
output:
174691
result:
ok single line: '174691'
Test #141:
score: 0
Accepted
time: 2399ms
memory: 5152kb
input:
80000 1001 (((())(()()()()()()())(((()))()(())()()()()()()(()()())(((()()))))()((()))()((()()(())()()())(()(()())(())()(())(())()(()(()))()()()))(()((()))()(()))(()()(())()()())((()())()(())()()()()()())(())()(())((((()))()()))((()()())(())()((())()()()(())(())(())))(((()))()()()()()()()()()()())(()...
output:
98911
result:
ok single line: '98911'
Test #142:
score: 0
Accepted
time: 2189ms
memory: 5156kb
input:
79998 1001 ()(((()((()))())(()()()())(())())(()()()()(()))()()(())())(()())(()()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()()()()()()()()()(())(())()()()()()()(())()()()()()()()()()(())()()(()()())()()()(())((()))(()()())()(())()()()()(())(())()())(()()()()()()()()()()()()()()()()()()...
output:
171234
result:
ok single line: '171234'
Test #143:
score: 0
Accepted
time: 2377ms
memory: 5148kb
input:
80000 3001 ((((())))(()(()())()()()(())(())(())()()()((())())(())()(())()()()((()))()((()))()()(())()())(((())(())(())()(()()()(())())()(())(())()(())()()()()(())()(()()())()(())()(())()()))(()()()()(())()()()()()())(()()(())()(()()()()())()()())(()()()()()()()()()()()()()(())()()()()()()()(())()())...
output:
57222
result:
ok single line: '57222'
Test #144:
score: 0
Accepted
time: 2148ms
memory: 5096kb
input:
79999 3001 ()()()()((()))(()())((()))(())((())((()))()((())((((())))())())(()()((()()()())))()()()()(())()())((())()((()))(())(())()()()())((()(()))(()())(())()(())()(())()()(())()()()(())(())()()()()()(())()()()(())()()()())((())((()))()(())(()()()())()()(()(()()()))(())(())((()))(())()()()()(())()...
output:
81628
result:
ok single line: '81628'
Test #145:
score: 0
Accepted
time: 2109ms
memory: 5136kb
input:
80000 2 (((()())()((((((((((((()))()())((()())((()))))))()))))))))(((((((((((()))(((()()(()))()((())()))())((()(()()))((((())((())(())))((((((()((()()))(()))(((())(()(()))(()))(((()))))))(((((()))(())))(((()(())(())))(()()))))((()())(((()()())))(()()()))))(()(()()())))((())(())))))((((()()())()(()()...
output:
7982716
result:
ok single line: '7982716'
Test #146:
score: 0
Accepted
time: 2045ms
memory: 5376kb
input:
80000 10 ()((())()())()(()()()()()())()()()(()(()))()((())(()())()()()()())(()(()())())(()()())()(())(()())(())()((())())()()()()(()()()()(())()())()(()(()()(())())())(())()()(())((()())())()(())(()()(())()())()((()()())()((()))()()())(()(())()())((())(()))()(())(())(()()()()()()(())(()())()()(()())...
output:
40264
result:
ok single line: '40264'
Test #147:
score: 0
Accepted
time: 2357ms
memory: 5204kb
input:
80000 100 (((((()((((()(((())()())))))((((((((())(()(()())(()()))((())()()))(()))((((()())(())))((((()))((()()())(()))))))(((())((())(()))())((())(()(()())))((()))))))((()(())(()()()))())((((()(())(())))((()))(((())((())(())(((())()(()))(((()()))())())))(())))()((((((()()())())((()))))))))((()(()))(...
output:
128492
result:
ok single line: '128492'
Test #148:
score: 0
Accepted
time: 2215ms
memory: 5144kb
input:
80000 500 )()(())(()()()))((()(()(())(())((())(())())())))))))(()(())())))()))()((((()())(()()(())())))()(((((())())((())(()()()())())()())()()(((()(()((())((())((((())())))))())))((()))(()()))(())(())))(()(())(()))((((()()(())(())()()((((()()(())()()))(((((()()((()())()(()(()(())()))()())))))(((()(...
output:
58413
result:
ok single line: '58413'
Test #149:
score: 0
Accepted
time: 2476ms
memory: 5192kb
input:
80000 1000 (())((()))(())(()(()()))(()())((())()(()()()))((())()()()())(()(())()()()()()())()(()()())()()(()()())()((()()))((())())()(())(()())()((()))(()())(())(()()()(())()())(()())(()())((()())()())()((()))()((()))()()(()(()))(()()(()))()(()(()()))(()())()(()())(()((()))()())((()))(()())((())()((...
output:
32493
result:
ok single line: '32493'
Test #150:
score: 0
Accepted
time: 2180ms
memory: 5128kb
input:
80000 4001 (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
15516
result:
ok single line: '15516'
Test #151:
score: 0
Accepted
time: 2544ms
memory: 5152kb
input:
79997 6001 ((((()()((())()())))(((((()()())((((())())((((((((((()))())(()())(())))))))))))(((())(((())()(()(()())))())(()(()()(()))()))((()())()(()(((()(())))()))))((()(((()))))))((())(()()(((()()())()())))))((((((()(()(((()))))))((()())(((()()())((())()()))(()())((()())((()())(())()))))))((()())(((...
output:
15468
result:
ok single line: '15468'
Test #152:
score: 0
Accepted
time: 2174ms
memory: 5304kb
input:
79998 10000 (()()(()((()))()(())))()(()(()()(())))()(()))))(()((()()()(((())(()())()))))()()(())(((())))())()())()))()(())(((()))))((())(()(((()()((()))))((()))))())(()(((((()))())()())(()())((((()()()())()()))((()))()((()())((())((()(())(()))(((()(()))(()))()))())()()(()(()()()(()()(()((((((()()(()...
output:
5669
result:
ok single line: '5669'
Test #153:
score: 0
Accepted
time: 1193ms
memory: 5216kb
input:
80000 40001 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()...
output:
0
result:
ok single line: '0'
Test #154:
score: 0
Accepted
time: 1928ms
memory: 5260kb
input:
80000 250 ()()()()()()()(())()(())()(())()(()())()()(())()(())()()()()()()()()()()()()()()()()()()()()()()()()(())(())()(())()()()(())(())()()()(())()()()()()()()()()()()(()())(())()()()()(())()(())(())(()())()()(()())()()()()()()()(()())()()()()(())()(())(()())(())()(())()()()(())()(())(())()()()()...
output:
1669944
result:
ok single line: '1669944'
Subtask #9:
score: 1
Accepted
Test #155:
score: 1
Accepted
time: 3508ms
memory: 5644kb
input:
99599 64 ((((((()(((())()))))((((((()))()())())())(()(()(()())))(()(()()(())())((()(()()))((()))()(())()())()(()(())()((()()())()())()(((())()))(()))((())(()(())()))(()))())()(((())(((())()((())))())(()()(()))(()())()((())((()())()(())())(())()(())((())(()()(()))((()))(()()())))()(((()))(())))(())((...
output:
110447
result:
ok single line: '110447'
Test #156:
score: 0
Accepted
time: 3570ms
memory: 5692kb
input:
100000 1024 ((((((((()()))(((()()()(((())())))()(((())))((())()(()()())(()()))((()())(())()()))))(((((())())()))))(((((((()))))())(((())()()((())))((()()))())()(()()())((()()(((()))()())(()(()()))()((()(()))(())()(())()()(()())())()((()))(())())()()))())(((()()((()(())()))(()))((()())((()()()))()(()...
output:
74496
result:
ok single line: '74496'
Test #157:
score: 0
Accepted
time: 3472ms
memory: 5816kb
input:
99065 16384 (((((((())((()())))()((())(((())))(()(())((()(()(()))))(()))())((()(((()())))()((())(())(()())(()()))((())()())(())(()(()(())(()))(()((()))))()(()))((()((()))()))()())(((()))(()(())())()(()(()(()(()()(())))(((())))))(((())(()())))(()()((()))()(())()((()))(()(())(())()))(()))(()(()))(()()...
output:
10056
result:
ok single line: '10056'
Test #158:
score: 0
Accepted
time: 3392ms
memory: 5764kb
input:
100000 8 (((((())(())())(()()(()()))()((())()(())(())()))())()(((())(())())((())()))()((())(()()(((())))(()(()())(()())()))()(()(())()(()())())()()(()(())(()())))()(()((()()())()())((())))(()((()())(())()()(((())())()()()())()())(())(()))(((())()()())((())(())))((()()((())()()()))()(())((((()))()())...
output:
149395
result:
ok single line: '149395'
Test #159:
score: 0
Accepted
time: 3509ms
memory: 5756kb
input:
100000 144 (((((())(()(())()()(())())(((()))(()()))))()((()()(()())(())((()(()()(())))))(())(()()))((())((((()))()()(()))()())((())()())()()(()()()()(())(()()(())())))()((()(())()(()))()(()((()))())(()(()(()))))((()((()))()))((((()(()))((())()))())(((())(())()(((())())))()))((((())))()()(()()()())((...
output:
110178
result:
ok single line: '110178'
Test #160:
score: 0
Accepted
time: 3297ms
memory: 5672kb
input:
100000 2584 ((())()((()))()(()((()))()(())()()()(())())()(()()()()))(()(()(()())))((())())((())()(()()())(()))(((())()())(()())()(()()))((()(()))((())())(())()(()))(((()))((()))(())(()()())()(((())))(())(()(()()(()()))()))(((()()))()(((())))()(())(())()(())()())((())(()()(())))(())(())(()(()()))(()(...
output:
68085
result:
ok single line: '68085'
Test #161:
score: 0
Accepted
time: 3739ms
memory: 5788kb
input:
99994 501 ()(()())()()))())(()(())()((())((((()((((()()())())))(((()))()())()))))(()()()()((())((()(()))()())()((()())))))))()()))(())))(())))((())()(()()))()))()))))))()))((()(())()((()(()((((((((())()))(((())(()())()()))())()))(()(((()())))()((((()((())()(()())(())(()()((((()())))(()())()(())())((...
output:
67411
result:
ok single line: '67411'
Test #162:
score: 0
Accepted
time: 3646ms
memory: 5736kb
input:
100000 3000 ()()()(())()))((()())(())((((()))()())))(())(()))()(()))((()))(())((()()())()(()((()))()))))(())(())(((((()(())())))((((()))((())()))())((()(())(()))(())()()(())((()(())))))()((())))()(((()))((())())()()()(())))))()(()())(()((()()()()()()((()()))()))((()(()()())))()()()))))(()((((())((()...
output:
39091
result:
ok single line: '39091'
Test #163:
score: 0
Accepted
time: 3275ms
memory: 5668kb
input:
100000 101 ()(()())(()(())()()()()())((()()()()()((()))(()())(()(()()()(()())))()(((()))()(()()()(((()))((())()))((()))(()()()()())((()))))))((()(())()())(((()()()()()())((())(()()))(()()()()()()()()()())(((()())))(()(()((()))))(())()())()(())))(()()(())(())((())(())()())(())(()()()()()()())((()()((...
output:
134322
result:
ok single line: '134322'
Test #164:
score: 0
Accepted
time: 2955ms
memory: 5812kb
input:
100000 101 ((()()(())()()()())(()())((())(((())(())()))()((())())(()))(()()((())(()))((()()()))()()()((()))(((()()))))(()()()()())((())(())(((()))())()()(()))(((())())()((())())()()()()(()()())()(())(((()))))((()()()())(())()())((())()())(()()()(()())()()()()()()()(())()(()))(()()()())((())()()(())(...
output:
376709
result:
ok single line: '376709'
Test #165:
score: 0
Accepted
time: 3382ms
memory: 5660kb
input:
100000 500 (((((()()))(((()))(((())()()()()())(()())(()(())()(())))((((()())((())))(())(())(())((())())(()()()))(()(()()())()(()()())((())))(((()))()))((())((())()()()(())(())()()()((()())))((((((())()()()()()))()(()()))(()()())))(((())()())()(()())(()())((((())))((())))))((()()(())(())()((()))()))(...
output:
110012
result:
ok single line: '110012'
Test #166:
score: 0
Accepted
time: 2867ms
memory: 5676kb
input:
99991 500 )(((((()()()()((()))()(()()())((()))(())()())()()()))((()())(())(())(())(())()(((())))()()(())()(())()()()(())()()()()()()()()()()()()())(()()()()(())(()()((())())()()))((((()))())())(()()()()()()()()()()()()()()()()()()()(())()()(())()()((()))()()(())()((()))())()(()()()()())(()()(()())((...
output:
280975
result:
ok single line: '280975'
Test #167:
score: 0
Accepted
time: 3282ms
memory: 5760kb
input:
99993 1001 (()()()(()()(())(())(())(()()())()((())()(()))())(()(((()(())((()()))()()()()()())(()()()()()())(()())(())()()()())(()()(())(()())(()()((()))()())()(()()()(())))()()()()())(((()()(())(())(())(()(())))(()()()))))((()((()))(()())((()()()))(())(()()()()()()())()((((()))())))((((()(())()(((()...
output:
99251
result:
ok single line: '99251'
Test #168:
score: 0
Accepted
time: 3053ms
memory: 5820kb
input:
99992 1001 ((()()()()()()(())()()(())()()()()()())(()()()())(()(()))(()()()()())((()())(())()()()())((())(()())(())()(())(()()((())))((()))(()))((())()()()()()()()()()()()()()())(())((()()(())())(((()())((()))))(()(()))(()()()()()()()()()())(((())(())))(((()))()((()()()))))((()()))(((())))(()())(()(...
output:
183863
result:
ok single line: '183863'
Test #169:
score: 0
Accepted
time: 3261ms
memory: 5636kb
input:
100000 3001 ((()((())((()))((()()())()())(()())(()(())()()()()()()))((((()()()()(()(())()()(())()()()())((()()()()())((())()))((()()()()((())())(())()((()(())))((())()))((()()()(())())((()())())((()))()())())(()()()()()()()))(()()(()))((())((()()()())()))()()))(()()()(()()()()(()))(()()()()())(())((...
output:
66312
result:
ok single line: '66312'
Test #170:
score: 0
Accepted
time: 2966ms
memory: 5676kb
input:
99992 3001 (((((()())))((())())(()()()())(())(()())(()())(())(()))(())(()()())(())(()()()()()()()()()()(())()()()(())()()()()()()()()()())((()()()()()()))(()(()()()())(())((()))()(())(()())()()())(()()(()()()))(()())((((()()))((()))((()))))(()()(())()()()())(()(()(())))()((()(())))(())((())()()()()(...
output:
97522
result:
ok single line: '97522'
Test #171:
score: 0
Accepted
time: 2246ms
memory: 5940kb
input:
99996 1 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
1344330
result:
ok single line: '1344330'
Test #172:
score: 0
Accepted
time: 3312ms
memory: 5748kb
input:
100000 5 (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
852358
result:
ok single line: '852358'
Test #173:
score: 0
Accepted
time: 3098ms
memory: 5680kb
input:
100000 50 (((((((((((()()(()()()))))(((()((())()())((())()))((())((())())))((())(((())()(()))())((())(()()))))))(())))((((()())((((()(())))(())))))(((((()())(())(()))(()(())())((((((()(())((())))()())))))))()(()))))))((((((((((((()((()))(()()(())))((()())(())))(())(()(((()()()))((()(())((())()))())(...
output:
220152
result:
ok single line: '220152'
Test #174:
score: 0
Accepted
time: 2761ms
memory: 6052kb
input:
99995 300 ((((()(((((((())(()))))((()((((())((((()((((((((((((((()(()))((((())))))))))))((()())(()))))))))))))))))))(((((((((((((((((((((((((((())))(())))((())((((((()()))(()))((((((())(()(((()))))))(((((((((())))(((((((()())()))())))(((()())((((((((()))())())))(()()))()))(())))))))((((((())))(((()(...
output:
40670
result:
ok single line: '40670'
Test #175:
score: 0
Accepted
time: 2816ms
memory: 5948kb
input:
100000 600 ((((((()))())((((((()())((()())(()))(((())()())()()))(((((((()()(())))((()((())(()())()))))))))))(((((()(()(())))()(((())()(()))((()()))))((()((()()))(((())(()()))))(((((())(()(()))((())()()))(()))((()()())((())(())(()))))(()))()))))))))(((()(())((())()()))()(()))((((((((()((()())()(()))(...
output:
32350
result:
ok single line: '32350'
Test #176:
score: 0
Accepted
time: 3130ms
memory: 5688kb
input:
100000 2001 (((())())(()())()()()()(()()))(())(())(())(()())(()()())(())((()()))(())(()())(())((()())(()))()(()()())(())(()()(())(())()(()))()(()(()))()(()(()))((())(()()))(())(()()(())())(()()(()(()))(()()))(())()(()(())()())(()(()())()()()(())()())()(()()(())(()()()()()(())))(()(()))()(())(()()())...
output:
84392
result:
ok single line: '84392'
Test #177:
score: 0
Accepted
time: 3059ms
memory: 6008kb
input:
100000 4001 ((()())(())(())(()))(()()()(())()())(())(()())(((())()))(()((()))())()(()(()))(()(())()())(()((())(()))()())(())(())((())(())()(())()()((()()()))())()()()(())(()()()(())()(()())()(()))(()())((())()(())()(())((()()))(()())()()(()()))(()(()))((()))(()()()())(())((()))()(())()()()((()))((()...
output:
22628
result:
ok single line: '22628'
Test #178:
score: 0
Accepted
time: 3330ms
memory: 5676kb
input:
99990 7777 )()))))(()))((())))((((()())((()()())))(())()((()())((()(()))((((())())((((()()()))))))()())))())))))(()())()())()(())()()()()))))))()(()((()()())))())(())()()((()()))((()((()(((()()))())()())))()())())()))(()()))()))()(()((()()()(()(()())()()()(())()))))))))()((()(()(()())()(()(((())()))...
output:
15339
result:
ok single line: '15339'
Test #179:
score: 0
Accepted
time: 1556ms
memory: 5640kb
input:
100000 50000 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...
output:
1
result:
ok single line: '1'
Test #180:
score: 0
Accepted
time: 1568ms
memory: 5644kb
input:
100000 100000 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()...
output:
0
result:
ok single line: '0'
Subtask #10:
score: 1
Accepted
Test #181:
score: 1
Accepted
time: 3455ms
memory: 5668kb
input:
100000 256 ((((())()(())())(((()))()((())()(()(())))))(((()(()))(((()))()()()()))()((((()))(())((()))))((()))(()((()()()()())()())(())(())()()(()()))(((()()))))())((((()))()((())()(()(())((()))))()((()()()()((()))))()(()(()()(()(())(()))))(())(((())))((()()((()))()())()())()((()())))()(((((()()))))(...
output:
107402
result:
ok single line: '107402'
Test #182:
score: 0
Accepted
time: 3654ms
memory: 5760kb
input:
99728 4096 ((((((()((()))))()))((((((()()(()())))(())()(()))()(()()()()()((()()()))()(((()))()(()))((()))(()()())()()))())(((()))(())((()((())()(()()))()))()(((())(())(()))(())((()(()(())()())()))((()())()())(()())(((()()()(())))))())(((())()())((()())())((()((()()())()()))()((()))))(()(((()((()))))...
output:
41913
result:
ok single line: '41913'
Test #183:
score: 0
Accepted
time: 3534ms
memory: 5764kb
input:
100000 2 (((((()(())((()))))(()(((())((()))(()()))()()()))()()(((()())(((())()()))()(()))()(()))(())(((()))))((()((())(()()(())))(((()))()()((()))))()(((()())(())())()())(((()))()()((()(())(((())()())))())()(()(())(((()))()(())(())(()))(()()())())())((()(()((())())))))))((((())((()()((()())))()((())...
output:
125299
result:
ok single line: '125299'
Test #184:
score: 0
Accepted
time: 3414ms
memory: 5732kb
input:
100000 34 (()((()()(())((()))(((()()))))()()(())()(((())((())))())(()(()(())())))()((()(()())()()()()))((()()(()(()()))(((())(())())())(()()()())))((()((()(())()(()))()(())))()()((()()(()()))(())((())())(())((())((())()))()((()))()()(((()())))()()()()((()()()(()())())))((()()())()(()()()())(()()()()...
output:
129202
result:
ok single line: '129202'
Test #185:
score: 0
Accepted
time: 3493ms
memory: 5684kb
input:
100000 610 ((((()(((()())()())())()()((()()))()())((((()))(()()(()))())(())(()()()(()))()(())))(((((()())()()()())())())(((()))()(()())()(((()))())()))((((((())()())())()()())()(()))((()(()()())((()()))())(()()()))()(((()())))()())()((((()))(()()())((())(())()((())))((()()())((()(()()))()(())()()))(...
output:
89431
result:
ok single line: '89431'
Test #186:
score: 0
Accepted
time: 3345ms
memory: 5664kb
input:
100000 10946 (((()(()))())((()))(()())((()))(())()(()())((())(()()())()())(((()))(()))(()())()(()))(((())()())()(()())()(((()))))(((()())()(())())(()()((())(())()()()())((()()))())(()())()()(((())))()(()(())()))()(()(()(()(())))())(()(()((()()())))(()())()()(()()))(((())()()(())))(((()))())(((()()))...
output:
22048
result:
ok single line: '22048'
Test #187:
score: 0
Accepted
time: 3739ms
memory: 5668kb
input:
99999 1001 (((())((()()())(()))))((())())))()()()((()(((()((()))(())))()(()(()))()((())(())))(()((()()))))()(((())))()))())((()()()))()()(())()())())(((()(())())(()())(()()(()()()()((()()()())(((()))((())()(()))(())()(())())(())))()()))()()())()))(())))))))()(())(((()))((())(()))))(((()(())))((())((...
output:
58142
result:
ok single line: '58142'
Test #188:
score: 0
Accepted
time: 3629ms
memory: 5680kb
input:
100000 100000 )(()()(((())((())(())((()()((()((()))))(()(()()()()()()(()(()((()()((())((((())(()()(()((())()()(())((()(()((())((()(()((())((((())()()))())()))()((()()))))))(()()())())()())))()))((())())(()(((())))()()()()(((()((((()((()))()(())())))()()())((()())())((())())()))())())())()((((()))))(...
output:
0
result:
ok single line: '0'
Test #189:
score: 0
Accepted
time: 3096ms
memory: 5744kb
input:
99997 101 (((((()()()))()()(())(()()()())()(()())()(()()())()((())(()))((())()(())()(())())(())()(()()())()(())(()())(()())((()))(((())()))(((())))(())(((())())))((()(())()(())()(())()()(())())(())(()()()(())()())(()(())))(())((())((())()((())())(()())()))((()(())))((()()())()()(())(())()(((())))(()...
output:
226645
result:
ok single line: '226645'
Test #190:
score: 0
Accepted
time: 2855ms
memory: 5652kb
input:
99993 101 ()()()()()(())()(()())()()((()()()())())(()()(()))(())()()()()(()()(()))(())()(())(()()())(()()(()())(()))((())())(()())(()(()()))(()(()(((()((()))()))))()())()(()()()()()()()()()()()()()()()()()()()()()(())()()()()()()()()()(())()()(())(())(())(())(())(())()()(()())()(())()((((())))())()(...
output:
628404
result:
ok single line: '628404'
Test #191:
score: 0
Accepted
time: 2989ms
memory: 5616kb
input:
100000 500 ()()(()((())()()()))((()))((())(())(())())((())()((())))((()))(()())(()()()()()()())((()())(()))(((((())))(()(())()()()()()()())()(())((()()()))(((())))(((())))((()))()(())()(())(()()())(((()))(()))()(()())()()(())()()()()()()()()()))((()())(()()()()())(())(()()()())(())(()()()()()()()())...
output:
187233
result:
ok single line: '187233'
Test #192:
score: 0
Accepted
time: 3074ms
memory: 5816kb
input:
99992 500 (()(()((()))()(())((())()(()))()()(()())()(())((()))()(()()))(()()()()(())(()()()))(()()()()())((())()()()()()()(())()(())(())(()))(()())(()(())(()(()())()())()(())(()()()())()((()))(())()(()(()))()((()()))(())(())()()()()()(())((()()))()(()()())(()())(())(((())))(())(()))(((()))()()())(((...
output:
339045
result:
ok single line: '339045'
Test #193:
score: 0
Accepted
time: 3109ms
memory: 5732kb
input:
100000 1001 (((((()()()(())()(())()()()()()()()())((()()()()()))))((())()()())(()()()()()(())()()()(()())(())())(()()()()()())((()))(((()))(())(())((()())())()(())(()()))((()()())()()()(())()()((()))())((())(())(()())((())())(())()(())())(((()()()(())()()))((())()()()()))(((())()()()()(())()()()())(...
output:
132487
result:
ok single line: '132487'
Test #194:
score: 0
Accepted
time: 2811ms
memory: 5768kb
input:
100000 1001 ()(())(()(())())(()()()()()()())(()(()))((())(()((()())())()(()()((()))()(())((())))))((())(((()))()(())())(())(()()()()()()()()()())(())()(())()(())(())()()(())()(()())(())()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()(()())()()(...
output:
229454
result:
ok single line: '229454'
Test #195:
score: 0
Accepted
time: 3072ms
memory: 5764kb
input:
100000 3001 ((()(())()()(()(())())()((())())()()(()()()))(()(()())(())()()(())()()(())(())()()()()()((()))()()()()(())(())()()(()())()())(()(())()()()()()()()()()()()()())(()()()()()(())()(())(()())()()((()))()((()()()()))((()))((()))(()())(()())()(())(())((())(()()))()(())()(((())))(()())(()(())(()...
output:
82308
result:
ok single line: '82308'
Test #196:
score: 0
Accepted
time: 2921ms
memory: 5680kb
input:
100000 3001 (()()()()()()()()()()()()()()()()()()()()()()()()(())()()()(())(())()()()()()()()(())(())()()()(((()))())(()())(())()()()()(())()()()()(())()((()))(())(())((()))()(())((()))(())(((())))()()()(()())(()()()())()(()()())(())(())(()())(())()(())(())((()))(((())))((()()()()()()()()())())(((()...
output:
115349
result:
ok single line: '115349'
Test #197:
score: 0
Accepted
time: 3288ms
memory: 5772kb
input:
99993 2 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
6013753
result:
ok single line: '6013753'
Test #198:
score: 0
Accepted
time: 3110ms
memory: 5732kb
input:
99991 10 (()())(()())(()()())(()())((()())())(())(()())()()()((()())())(())(())(()())(()()(()())()(()())(()(()))(())())(((()))()()(()))(()())(())()((())(())(()())(())(())())(((())))()(())(())(()())(()()())(()((())))((()()))()()(())()()(()()())(((())))()(()()()(()))((()))(()()())(((()))()()())()()()(...
output:
89461
result:
ok single line: '89461'
Test #199:
score: 0
Accepted
time: 2902ms
memory: 5936kb
input:
99998 100 (()(())()()())(()(()))(())(((())))()()((()))(()()())(()()(())()()()(())())(())(()(())()(())()(())()((()))(())())((())()()()()()(()()))((()()()))((()()()()()))((()())()())()((()))()()()((()))(())(()()()()(())((())))((()))(()()(())(())())((()))(()())(())(((())()()))()()((()))((()())()()()(()...
output:
53969
result:
ok single line: '53969'
Test #200:
score: 0
Accepted
time: 2776ms
memory: 5936kb
input:
99990 500 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
49676
result:
ok single line: '49676'
Test #201:
score: 0
Accepted
time: 3196ms
memory: 5680kb
input:
100000 1000 ((((((((((((())(((())(((()))())))(()(()())((((((()))((())())(()(()))))))))((((())(((((()))(()))(((())(((())))))(()(()))))(()(())()))))(((((((()))(((())()))(()))((())()())(()())))(()()()))((((()(()))(())(())))()(())))))))(((((((((()(()((())())))(((()()()))(((())((())(((()()()))))((()())((...
output:
45154
result:
ok single line: '45154'
Test #202:
score: 0
Accepted
time: 3131ms
memory: 5740kb
input:
100000 3000 ((((((((((((((((())((()((()(()))())))))((((((((((())((((((((((((((((((()(()))(()))(((())(((((())((()((())((())(((()(((((()))(()(())))((()())())))))))))))))))(((()())())))))))((((()(()())))(((((((((())((())))((((((()((()))))(()))))((()(((()(((((()())))))))))(())))))((((())(((()))())))(()(...
output:
53085
result:
ok single line: '53085'
Test #203:
score: 0
Accepted
time: 3306ms
memory: 5764kb
input:
100000 5555 ((((((((((())))())((((())(((((()())))())))))))(())))((((())((()((()))))))(((()())(((((((((()()))))(((((()())(()))(((((((())))))(()))((((((())(((())())(()())))()))((((())((()()))))((((())(()))))))))))))))(((()()))))(((((()(((()))((((((((((((()((((())))((()())))))))))))()))))))))((())((()(...
output:
24920
result:
ok single line: '24920'
Test #204:
score: 0
Accepted
time: 3256ms
memory: 5668kb
input:
99997 12000 ()()()(())(())(()()())(()())(()())()(((())()))()()((()()))(()(())((())()))(())()(())((()))(()(())(())())(()(()()))(()(()()))((())())((())(())())((()()())())()(()((()))()(()())())(()()()()()())(())(()()(()))(()())()(())()(()()())(()(()))(()()(()))()((()())(()))(())(()()()())(()(()()))((()...
output:
8147
result:
ok single line: '8147'
Test #205:
score: 0
Accepted
time: 1545ms
memory: 5760kb
input:
100000 50001 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...
output:
0
result:
ok single line: '0'
Test #206:
score: 0
Accepted
time: 1567ms
memory: 5776kb
input:
100000 1 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...
output:
1250025000
result:
ok single line: '1250025000'