QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#69587 | #5246. Nawiasowe podziały [B] | zglicz | 2 | 111ms | 28580kb | C++20 | 9.3kb | 2022-12-28 20:48:57 | 2022-12-28 20:48:58 |
Judging History
answer
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <array>
#include <random>
#include <cmath>
#include <chrono>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <climits>
#include <stack>
#include <valarray>
#include <random>
#include <bitset>
#include <numeric>
#include <iomanip>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define trav(a, x) for(auto& a : x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define eb emplace_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;
template<typename T> bool ckmin(T& a, const T& b){return b<a?a=b,1:0;}
template<typename T> bool ckmax(T& a, const T& b){return b>a?a=b,1:0;}
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
return '"' + s + '"';
}
string to_string(char c) {
return string(1, c);
}
string to_string(const char* s) {
return to_string((string) s);
}
string to_string(bool b) {
return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
bool first = true;
string res = "{";
for (int i = 0; i < static_cast<int>(v.size()); i++) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(v[i]);
}
res += "}";
return res;
}
template <size_t N>
string to_string(bitset<N> v) {
string res = "";
for (size_t i = 0; i < N; i++) {
res += static_cast<char>('0' + v[i]);
}
return res;
}
template <typename A>
string to_string(A v) {
bool first = true;
string res = "{";
for (const auto &x : v) {
if (!first) {
res += ", ";
}
first = false;
res += to_string(x);
}
res += "}";
return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// #include <atcoder/modint>
// using namespace atcoder;
// using mint = modint998244353; // modint1000000007;
// typedef vector<mint> vmi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // use rng() to get unsigned int
// mt19937_64 for random long longs
const ll inf = 1e18;
vector<ll> dp, ndp;
vector<vector<ll>> C;
void compute(int l, int r, int optl, int optr) {
if (l > r) return;
int mid = (l + r) / 2;
pair<ll, int> best = {inf, -1};
for (int k = optl; k <= min(mid, optr); ++k) {
ckmin(best, { (k ? dp[k-1] : 0) + C[k][mid], k });
}
ndp[mid] = best.first;
int opt = best.second;
compute(l, mid - 1, optl, opt);
compute(mid + 1, r, opt, optr);
}
void solve2(int n, int k, string x) {
if (n <= 3 || k >= (n + 1)/2) {
cout << 0 << endl;
return;
}
x = '#' + x;
map<int, int> wys; // kiedy ostatnio dana suma wystepowala
vi a(n + 1, -1); // pointer to previous
vi c(n + 1, -1);
vi kt(n + 1);
int nr = 0;
int s = 0;
wys[s] = 0;
rep(i, 1, n + 1) {
if (x[i] == '(') {
++s;
} else {
--s;
if (wys.count(s)) {
// we can put a pointer
int pop = wys[s];
a[i] = pop;
if (c[pop] != -1) {
c[i] = c[pop];
kt[i] = kt[pop] + 1;
} else {
c[i] = nr++;
kt[i] = 1;
}
a[pop + 1] = pop + 1;
c[pop + 1] = c[i];
}
}
wys[s] = i;
}
debug(a);
debug(c);
debug(kt);
--k;
vector<map<int, int>> opens;
vector<map<int, int>> closed;
map<int, int> copen, cclosed;
int lastClose = 0;
vi blocks;
rep(i, 1, n + 1) {
if (c[i] == -1) {
continue;
}
if (x[i] == '(') {
++copen[c[i]];
} else {
if (copen[c[i]] == 0) {
++cclosed[c[i]];
} else {
// need to make a closing before i
opens.pb(copen);
closed.pb(cclosed);
copen.clear();
cclosed.clear();
lastClose = i - 1;
blocks.pb(lastClose);
++cclosed[c[i]];
}
}
}
opens.pb(copen);
closed.pb(cclosed);
debug(blocks);
debug(sz(opens));
debug(opens);
debug(closed);
if (sz(blocks) <= k) {
cout << 0 << endl;
return;
}
vector<pii> lr(sz(blocks), {-1, -1});
rep(i, 0, sz(blocks)) {
lr[i].st = i;
lr[i].nd = i + 1;
}
vector<ll> cost(sz(blocks) + 1, 0); // cost within a block
vector<ll> potencjal(sz(blocks)); // for each cutting, how much would it add
debug(lr);
auto costFunc = [&](int lset, int rset) {
// [] // []
ll wouldAdd = 0;
if (sz(opens[lset]) < sz(closed[rset])) {
for (auto [opek, cnt] : opens[lset]) {
wouldAdd += (ll)cnt * closed[rset][opek];
}
} else {
for (auto [opek, cnt] : closed[rset]) {
wouldAdd += (ll)cnt * opens[lset][opek];
}
}
debug("compute cost: ", opens[lset], closed[rset], wouldAdd);
return wouldAdd;
};
set<int> active;
set<pair<ll, int>> pq;
rep(i, 0, sz(blocks)) {
potencjal[i] = costFunc(lr[i].st, lr[i].nd);
active.insert(i);
pq.insert({potencjal[i], i});
}
auto lacz = [&](int lset, int rset) {
// do lewego bede laczyl
if (sz(opens[lset]) < sz(opens[rset])) {
swap(opens[lset], opens[rset]);
}
if (sz(closed[lset]) < sz(closed[rset])) {
swap(closed[lset], closed[rset]);
}
// always add to lset
debug("lacz:");
debug("opens", opens[lset], opens[rset]);
debug("closed", closed[lset], closed[rset]);
for (auto [repr, fr] : opens[rset]) {
opens[lset][repr] += fr;
}
for (auto [repr, fr] : closed[rset]) {
closed[lset][repr] += fr;
}
};
ll res = 0;
while (sz(pq) > k) {
auto [potek, repr] = *pq.begin();
debug("usuwam podzial w: ", blocks[repr], potek);
pq.erase(pq.begin());
res += potek;
int lewy = lr[repr].st;
int prawy = lr[repr].nd;
lacz(lewy, prawy);
// lewy je posiada
auto it = active.find(repr);
int przed = -1, po = -1;
if (it != active.begin()) {
przed = *prev(it);
pq.erase({potencjal[przed], przed});
lr[przed].nd = lewy;
potencjal[przed] = costFunc(lr[przed].st, lr[przed].nd);
pq.insert({potencjal[przed], przed});
}
if (next(it) != active.end()) {
po = *next(it);
pq.erase({potencjal[po], po});
lr[po].st = lewy;
potencjal[po] = costFunc(lr[po].st, lr[po].nd);
pq.insert({potencjal[po], po});
}
active.erase(it);
}
cout << res << endl;
}
void solve() {
int n, k;
cin >> n >> k;
string x;
cin >> x;
if ((ll) n * n >= 1e7 ) {
solve2(n,k,x);
return;
}
x = '#' + x;
map<int, int> wys; // kiedy ostatnio dana suma wystepowala
vi a(n + 1, -1); // pointer to previous
vi c(n + 1, -1);
vi kt(n + 1);
int nr = 0;
int s = 0;
wys[s] = 0;
rep(i, 1, n + 1) {
if (x[i] == '(') {
++s;
} else {
--s;
if (wys.count(s)) {
// we can put a pointer
int pop = wys[s];
a[i] = pop;
if (c[pop] != -1) {
c[i] = c[pop];
kt[i] = kt[pop] + 1;
} else {
c[i] = nr++;
kt[i] = 1;
}
a[pop + 1] = pop + 1;
c[pop + 1] = c[i];
}
}
wys[s] = i;
}
debug(a);
debug(c);
debug(kt);
C.resize(n, vector<ll>(n));;
rep(i, 1, n + 1) {
vi howManyOpen(n, 0); // how many items from this specific component are currently open
vi howManyClosed(n, 0);
int currentlyInside = 0;
ford(j, i + 1, 1) {
// j - I need to add it to my current
if (c[j] != -1) {
if (x[j] == '(') {
currentlyInside += howManyClosed[c[j]];
++howManyOpen[c[j]];
} else {
++howManyClosed[c[j]];
}
}
C[j - 1][i - 1] = currentlyInside;
}
}
debug(C);
dp = C[0];
ndp.resize(n);
rep(i, 1, k) {
compute(0, n - 1, 0, n - 1);
dp = ndp;
}
cout << dp[n - 1] << endl;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int t;
// cin >> t;
t = 1;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 3ms
memory: 3580kb
input:
1 1 (
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
1 1 )
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3576kb
input:
2 1 ()
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
2 1 )(
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3408kb
input:
2 2 ()
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
2 2 )(
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3392kb
input:
10 4 ()))(()(()
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3456kb
input:
15 4 ())))()(()()(((
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
18 18 (()()()))(())(((((
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
18 3 (())(()()()())()()
output:
7
result:
ok single line: '7'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
17 5 ()()(())()(()()()
output:
3
result:
ok single line: '3'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3404kb
input:
17 4 ()(()()())(()()()
output:
4
result:
ok single line: '4'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3480kb
input:
18 4 ()(()())(())()()()
output:
4
result:
ok single line: '4'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
18 4 (())()(())()()(())
output:
4
result:
ok single line: '4'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
18 4 (()())(()())()(())
output:
3
result:
ok single line: '3'
Subtask #2:
score: 1
Accepted
Test #16:
score: 1
Accepted
time: 4ms
memory: 3952kb
input:
300 25 ((()()()(()())(((())())()))()((()(())))((()()))((()()))()()(((())())))((((())(()()()())(((()))(()())()(())())()()()()())(()((()()()))))(())()((()))((()))(()(()())))((()(())(((()))))((()()()()()())())(((()))()()()(())())(())()(((()))()((()()())))((())())(((()())())((()))(()()()()(())(()())((()...
output:
90
result:
ok single line: '90'
Test #17:
score: 0
Accepted
time: 3ms
memory: 3852kb
input:
300 1 ((((()))((((())))(())((()()(()())()())()()())()()())((()(()(())))((()))))()()(((())())))((((()((()))(())())))()(((())(())(())()()))((()()()())((())()())((()()(()(())))(()()))())()(((()()(()))))((()())()((()()(()()()())()(())()(()())()))((()()(())()())()()())((()((())())()))))(((())()(())(((())...
output:
332
result:
ok single line: '332'
Test #18:
score: 0
Accepted
time: 3ms
memory: 3936kb
input:
300 4 ((((((()(())()())))(((()()(())())))()())((((((()()))))()((())(()((())))()()())(()(()()(()())())()))(()(()())(()())())(((())))(()())()(()((()()())(()()((())))((()((())())))(((()())()))(()))()((()))()()()()()()()(()(()(())()))(()(()()()()())()(()))))()(((()())))((()(())()))((()()(()()((()()(()))...
output:
250
result:
ok single line: '250'
Test #19:
score: 0
Accepted
time: 3ms
memory: 3908kb
input:
300 1 (((()((()(()()()())()))((()))((()()(()(())())(()())()())()(()))((()()()))()((()(()())()()(()()))(()(()()()))()())()(()(())(())(())()(())(()())((())()()(())())(()((()))(()))(()(((()())))(()))((()()))()()(((()))))(()()(((()()))))(()()))()(()((((()()))(((()))))()())()(()((()())())(())(((()())(())...
output:
400
result:
ok single line: '400'
Test #20:
score: 0
Accepted
time: 3ms
memory: 3908kb
input:
300 2 ()((())()(())()()()()(()))(()(())(()))(()())(()()()()()()(()()())())(()())()(()()(()()())()((())()))(()()())(()())((()()(()))(()())()()())(()()()()())((()()))(()(())(()()))((()())(()())()(()(()()()())())()())(()())(()()()()()(())(()()))((()()()))(())(()(()())(()()))()(((()))()()()()(()())())((...
output:
453
result:
ok single line: '453'
Test #21:
score: 0
Accepted
time: 3ms
memory: 3968kb
input:
300 169 (((()))()()())(()(()(())))(()(()()())()(())()(())(()()()))(()(()))(()()(()())(()))(()()())()()(()(())(()()())(()))()((()))(())((())(())()((()))()()())(()()(()()))((()))((()()))(()()(()))(()())(())()(())(()()())()(()())(())((()())(()()))()(())(()(()))(()()(()()))()(()())(())(()(()))(((()))()(...
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 3ms
memory: 3800kb
input:
300 1 )((())(()()(()))(())))((()()()))))((((()))))()())()))((())))()))(())))()()))))())(())()())((((((()))(((()())())((())()(()(()()((()(())))())((()())())))()())))(((()(((()(((()))(()((()())))(((((((()(())((((()((()()())(((()))()((()()((((((()())))((()())))))))())()(())))()))()(()()()(((()(()))())(...
output:
202
result:
ok single line: '202'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3940kb
input:
300 2 )(())((())))(()()(((())(((()((((()()))())(((((())))))((())())())))(((((()((((())(()())))))))))((()()))(()))((()())(())(()(((((((((()))()(())(((((()(((()())(()))))()))((()((())())))((((((((()(())((()))()()(())(()()()()()))()())())()(()(((()))((()()(((((())(()))(()(()(((()(()))(()(((())((()(((((...
output:
181
result:
ok single line: '181'
Test #24:
score: 0
Accepted
time: 3ms
memory: 3920kb
input:
300 7 ()((()))())())((((()()(((())))))())()((()))()(())()())((()))))((((((()))((()()))())((()()()(()()((()((())))))))(()((()()(())()((())((((((()())(()))()))())))))(((()()())))()()(()))()))(()()(()()))()((())))((()(())(())(())()())())()))))(((())(()))))))()()(()()(())))))))))()()(()))(())()()(()))))...
output:
148
result:
ok single line: '148'
Test #25:
score: 0
Accepted
time: 3ms
memory: 3800kb
input:
290 15 ))(())())(((()()()))((()())))(()))()()))())()())()((()))))())()))(()()(()))()())(())((()()())((())()))(()(())))))(())(()(((()))((()))()((())()(((())(((()))((((((()()()(((()(()((()))(())(())(((()()()())()())()((()())()()(()()))))())(())))))(()()(()()())))()))()))))))())(((())(()))))())()(((
output:
88
result:
ok single line: '88'
Test #26:
score: 0
Accepted
time: 3ms
memory: 3984kb
input:
300 30 (()((()()))(()))()(((())(()()))(((()(())()))()(()(()(((())))(((((((())()(()())()((((()((()(((((()()))()()))()))()(()()())))(())(()((((())(()(((()()))))))))))()(()())))))))())()))((()())()())())())))))((())()))()()(())())())())(()))()(()))(()(((((()))))((()((()))))()()))(()(()((((((()()(((((((...
output:
42
result:
ok single line: '42'
Test #27:
score: 0
Accepted
time: 4ms
memory: 3960kb
input:
300 300 ((()())))))))))()()(()((())((()())))))(())))((()(((((()))())(((())))))((((())(()())()((((((())(()(())))())))())))()))((((()())((((((()())((())()(())(()()))(((()(())))))()())())()()(()))()()()))))(()())())()())(()((((())((((()()((()))()((((())(((((((())(()())((()()())(()())))(((()))))(()(())(...
output:
0
result:
ok single line: '0'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
300 1 (()((()))(()()((()(()()(()(()(()())()(()())()()(()(((()())))()())((()()((((())()(()(()()(((()(()))())()))((())))(())((((((())(((((())())((()())))((())(((()))(()(((((())((())))))))))))))((())((())(())))))(((((())))((()))((((()))()())))((((()))(()))()()))()(((((())))))((()))(()()())(()(()))()(((...
output:
261
result:
ok single line: '261'
Test #29:
score: 0
Accepted
time: 3ms
memory: 3936kb
input:
300 2 (((((((()))((((()(())))())))))))(((((((((((((((((((((())))))))))))))))))))))()))())))))(()())()()))(((())()())(())(()()(((())(()()()(()(()()((())((())))()()()((())))())(((()()))(())(((((())())(()())()()(())()(())(())()()(())((()()())())((())((())()))(()()(())(())())((()))()((())()()(())())((()...
output:
280
result:
ok single line: '280'
Test #30:
score: 0
Accepted
time: 3ms
memory: 3860kb
input:
298 7 (((((((())((((((())(((((()((((((((())(((()((())())))))))())()))))())())(()))())))())(((())))))))))((()((()(((()(()()))))))))))())(())())())((()((((((()())(()))))))(())((((((((((((()))))))))))))(()())(())()()()(()()()((()))()())((())()(()))(()()(()))((()))(((())()())(())()()()())(()()())()(()()...
output:
123
result:
ok single line: '123'
Test #31:
score: 0
Accepted
time: 3ms
memory: 3964kb
input:
300 15 ()((())((()))((((((())((()()(())((((()(()))((((())(()(((()))(((((())))((())(((((((((()(((((()))((()))))(()())))())((())(((()))())))))()))))))))((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))((((((()))(((())))())((()))))((())(()))(()(())((())()(((()))))))()((()()...
output:
42
result:
ok single line: '42'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
290 30 ((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))(((((())(())))(((((()))()))(()))))((()()))(()(()(())((())))())((())()())()((()))()(())(((()))()())()(()()(())()())()()(())(()(())(())()(())(())()()(())()(()))()(())))(((()((()(()))())((())())(()()(())))(()))()()()()(
output:
35
result:
ok single line: '35'
Subtask #3:
score: 0
Wrong Answer
Test #33:
score: 1
Accepted
time: 3ms
memory: 4384kb
input:
4000 1 (((((())())()((())(())(()()())()())(()(())(()))()(()))(()((())()()()()(()())(()()()))()(())()()(()(()()())))(()))(()(((()))()())((())(()()(()()))))((()((()())())((())())((()()))(())(())(()(()()))(((())())())((())()()(()))(()()()(()(())(()))()())((()))((())()(())()())))(((()(()()()()())(())())...
output:
5599
result:
ok single line: '5599'
Test #34:
score: 0
Accepted
time: 2ms
memory: 4032kb
input:
4000 3 (((((((())))()()((((())(())()())()())(()(()())())))(()((())()((()()()((())()()))()))(())(()(()))()(()()()()((()(()))())()((()()()))(())(()()((())())))))(()(((((())))())((()()(((()()))())())())(())(()())(((()))())(()((()()()))(((()))())())())((())(())((())(())()(())()(((()))((())))))(((((())))...
output:
4568
result:
ok single line: '4568'
Test #35:
score: 0
Accepted
time: 5ms
memory: 4096kb
input:
4000 8 (((()))((()()(()())(()())((()))(((())))))(((())()(())()()()()((())())())((())()((())()))()(((())())()())(((()()()))(()()()(())(()))))(()()((()))((()())())((())(())()(())))(((((()()()())))(()()(()()())()()))()((())(()(()))((())()())((()()))()())(((())())()((()())(()()(())())()()((())))(())()((...
output:
4780
result:
ok single line: '4780'
Test #36:
score: -1
Wrong Answer
time: 5ms
memory: 4136kb
input:
4000 21 (((((()())(())()))(()(())((((())())))()((()))()(()())()((())()())()()((((()))))))(((((()())()()()))((()))())((()))(()()(()))(()()((())))(())((()()())())(()()(())))(((())(()((())))()()(())(()((()()())(()))(()))))((()()((()()()())()())(()((()()()())())))(()()(((())()())()()((())(()))()(()))()(...
output:
3878
result:
wrong answer 1st lines differ - expected: '3864', found: '3878'
Subtask #4:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 5ms
memory: 4160kb
input:
4000 2 ((())(()(())))()((())()()()(())()()(())()((()))()()((()()))((())())((())())(()())()(())(()(()))((()())())(()())((()()))(()()())((()))()())(()(()))((()()())(())()((())()))(())((())((())))(((()(())))()(())())(()(())(())())((())(())())((()(()))()()()()(()())())(((()))(())())((()())())((())()((()...
output:
18486
result:
wrong answer 1st lines differ - expected: '18432', found: '18486'
Subtask #5:
score: 0
Wrong Answer
Test #75:
score: 0
Wrong Answer
time: 107ms
memory: 28580kb
input:
100000 3 (()((())(()))(())((()())))(((()()))(()))(()()()((())))()()((())(())((())(()(()))())((())))()()((())(()()))(((())))((())()(()())(()())()(()(()()())))(()(()()))()(()((())()()()()())((()))(())(())())(((()))()(()()())()(()()))((()()))(((()()()()))(()))(((())))(((()))(()()())(()(()()))(())(()())...
output:
4044179
result:
wrong answer 1st lines differ - expected: '3832013', found: '4044179'
Subtask #6:
score: 0
Wrong Answer
Test #89:
score: 0
Wrong Answer
time: 111ms
memory: 27248kb
input:
100000 6 ((((()()((())))()((()())()())((())()(((()()))())((())((()()()))()()()(())))(((()(())(()()))(())())(())))(((()))((((())))()))(()((())(())(())((()())))(()(()(()))(())(()()()(())())(()(())(()(()))(()())()((()))()()))(()()(())))((()())()((())((())()()(((()))(())))((())())()((()())(()))))()(((()...
output:
126040
result:
wrong answer 1st lines differ - expected: '126039', found: '126040'
Subtask #7:
score: 0
Wrong Answer
Test #103:
score: 0
Wrong Answer
time: 80ms
memory: 19336kb
input:
80000 81 ((((((()())((()((()))))(()())()(()(((()(()())(()())())(())))()(())(()()))()))(((()(()))((()))(())((((())))(())()((()))())((()(()())))(())(()()))(((()()))(()((())))())()(((()()))(()())()()(((()((()))(())))((())(()((())))())(()())))()()()((()()(()()(())()()((()))(())()))((()(())()()))(()(()()...
output:
87858
result:
wrong answer 1st lines differ - expected: '87799', found: '87858'
Subtask #8:
score: 0
Wrong Answer
Test #129:
score: 0
Wrong Answer
time: 60ms
memory: 16480kb
input:
79856 243 (())()(())(())(()()())()(())()(()())()(())()(())()((()))(())(()(())())()(()())()()(())(())((()()))(())(()()())(()())((()())()())(())()()(())()(())((()()))()()(()()())(())()()(()())(())(())((()))(())(())()()()()()(()(()))(()(())()(()))()()()()()()()()((()()))()()()()()(())()(())(()())()(()(...
output:
838505
result:
wrong answer 1st lines differ - expected: '794572', found: '838505'
Subtask #9:
score: 0
Wrong Answer
Test #155:
score: 0
Wrong Answer
time: 93ms
memory: 23976kb
input:
99599 64 ((((((()(((())()))))((((((()))()())())())(()(()(()())))(()(()()(())())((()(()()))((()))()(())()())()(()(())()((()()())()())()(((())()))(()))((())(()(())()))(()))())()(((())(((())()((())))())(()()(()))(()())()((())((()())()(())())(())()(())((())(()()(()))((()))(()()())))()(((()))(())))(())((...
output:
110523
result:
wrong answer 1st lines differ - expected: '110447', found: '110523'
Subtask #10:
score: 0
Wrong Answer
Test #181:
score: 0
Wrong Answer
time: 88ms
memory: 21464kb
input:
100000 256 ((((())()(())())(((()))()((())()(()(())))))(((()(()))(((()))()()()()))()((((()))(())((()))))((()))(()((()()()()())()())(())(())()()(()()))(((()()))))())((((()))()((())()(()(())((()))))()((()()()()((()))))()(()(()()(()(())(()))))(())(((())))((()()((()))()())()())()((()())))()(((((()()))))(...
output:
107558
result:
wrong answer 1st lines differ - expected: '107402', found: '107558'