QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#115292 | #2356. Partition of Queries | ckiseki# | AC ✓ | 30ms | 27804kb | C++20 | 2.4kb | 2023-06-25 15:41:36 | 2023-06-25 15:41:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
template <typename ...T>
void debug_(const char *s, T ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int cnt = sizeof...(T);
(..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I>
void orange_(const char *s, I L, I R) {
cerr << "\e[1;32m[ " << s << " ] = [ ";
for (int f = 0; L != R; ++L)
cerr << (f++ ? ", " : "") << *L;
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
const int maxn = 1000025;
int64_t pre[maxn], suf[maxn];
int64_t dp[maxn];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, y;
cin >> n >> y;
string s;
cin >> s;
for (int i = 0; i < n; i++) {
pre[i + 1] = pre[i] + (s[i] == '+');
}
for (int i = n - 1; i >= 0; i--) {
suf[i] = suf[i + 1] + (s[i] == '?');
}
dp[0] = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '+')
dp[0] += suf[i];
}
debug(dp[0]);
int64_t ans = dp[0];
deque<pair<int64_t,int64_t>> dq;
const auto insert = [&dq](int64_t slope, int64_t b) {
using pll = pair<int64_t,int64_t>;
const auto ok = [](pll A, pll B, pll C) {
assert (A.first <= B.first && B.first <= C.first);
return (C.second - B.second) * (B.first - A.first) > (B.second - A.second) * (C.first - B.first);
};
pair<int64_t,int64_t> cur(slope, b);
while (dq.size() >= 2 && !ok(dq[dq.size()-2], dq[dq.size()-1], cur))
dq.pop_back();
dq.emplace_back(cur);
};
const auto query = [&dq](int64_t x) {
const auto f = [](pair<int64_t,int64_t> l, int64_t z) {
return l.first * z + l.second;
};
while (dq.size() >= 2 && f(dq[0], x) >= f(dq[1], x))
dq.pop_front();
return f(dq[0], x);
};
insert(0, dp[0]);
for (int i = 1; i <= n; i++) {
dp[i] = 1e18;
dp[i] = query(suf[i - 1]) + y - pre[i] * suf[i - 1];
insert(pre[i], dp[i]);
// for (int j = 0; j < i; j++) {
// dp[i] = min(dp[i], dp[j] - (pre[i] - pre[j]) * suf[i - 1] + y);
// }
debug(i, dp[i]);
ans = min(ans, dp[i]);
}
cout << ans << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3412kb
input:
6 5 ++??+?
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
6 8 ++??+?
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
5 1 +++++
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
10 0 ++?+??++??
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3484kb
input:
12 100 +?+++??+??++
output:
19
result:
ok single line: '19'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
1 1 ?
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
9 7 ++++++++?
output:
7
result:
ok single line: '7'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3480kb
input:
9 8 ++++++++?
output:
8
result:
ok single line: '8'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
10 15 ++++++++??
output:
15
result:
ok single line: '15'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
5 3 +?+?+
output:
3
result:
ok single line: '3'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
10 5 +?+?+??+??
output:
10
result:
ok single line: '10'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
10 7 +?+?+??+??
output:
12
result:
ok single line: '12'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
15 4 +?+?+??+??+??+?
output:
14
result:
ok single line: '14'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
15 6 +?+?+??+??+??+?
output:
18
result:
ok single line: '18'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
19 8 +?+?+??+??+??+?++??
output:
28
result:
ok single line: '28'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
20 9 +?+?+??+??+??+?++???
output:
30
result:
ok single line: '30'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3416kb
input:
500 100 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????++++...
output:
2710
result:
ok single line: '2710'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
10000 100 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????++...
output:
56616
result:
ok single line: '56616'
Test #19:
score: 0
Accepted
time: 13ms
memory: 17648kb
input:
500000 3000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...
output:
17820759
result:
ok single line: '17820759'
Test #20:
score: 0
Accepted
time: 26ms
memory: 27496kb
input:
1000000 3000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
35626062
result:
ok single line: '35626062'
Test #21:
score: 0
Accepted
time: 26ms
memory: 27744kb
input:
1000000 1000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
19934461
result:
ok single line: '19934461'
Test #22:
score: 0
Accepted
time: 22ms
memory: 27804kb
input:
1000000 10000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...
output:
66661466
result:
ok single line: '66661466'
Test #23:
score: 0
Accepted
time: 29ms
memory: 27680kb
input:
1000000 30000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...
output:
117384143
result:
ok single line: '117384143'
Test #24:
score: 0
Accepted
time: 30ms
memory: 27464kb
input:
1000000 500000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++??...
output:
490361116
result:
ok single line: '490361116'
Test #25:
score: 0
Accepted
time: 22ms
memory: 27760kb
input:
1000000 1000000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?...
output:
695515718
result:
ok single line: '695515718'
Test #26:
score: 0
Accepted
time: 16ms
memory: 27748kb
input:
1000000 924 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
924
result:
ok single line: '924'
Test #27:
score: 0
Accepted
time: 6ms
memory: 27452kb
input:
1000000 69971 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
69971
result:
ok single line: '69971'
Test #28:
score: 0
Accepted
time: 14ms
memory: 27464kb
input:
1000000 275229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
275229
result:
ok single line: '275229'
Test #29:
score: 0
Accepted
time: 7ms
memory: 27656kb
input:
1000000 275886 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
275886
result:
ok single line: '275886'
Test #30:
score: 0
Accepted
time: 7ms
memory: 27768kb
input:
1000000 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
2750
result:
ok single line: '2750'
Test #31:
score: 0
Accepted
time: 4ms
memory: 27804kb
input:
1000000 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
27500
result:
ok single line: '27500'
Test #32:
score: 0
Accepted
time: 13ms
memory: 27556kb
input:
1000000 0 ++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++...
output:
0
result:
ok single line: '0'
Test #33:
score: 0
Accepted
time: 12ms
memory: 27552kb
input:
1000000 4 +++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????++++++++++++++++++++++++++...
output:
60608
result:
ok single line: '60608'
Test #34:
score: 0
Accepted
time: 11ms
memory: 27572kb
input:
1000000 1 +?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?...
output:
500000
result:
ok single line: '500000'
Test #35:
score: 0
Accepted
time: 15ms
memory: 27476kb
input:
1000000 1000000 +?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?...
output:
705858800
result:
ok single line: '705858800'
Test #36:
score: 0
Accepted
time: 15ms
memory: 27552kb
input:
1000000 822 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
7398
result:
ok single line: '7398'
Test #37:
score: 0
Accepted
time: 10ms
memory: 27484kb
input:
1000000 924 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
179256
result:
ok single line: '179256'
Test #38:
score: 0
Accepted
time: 9ms
memory: 27560kb
input:
1000000 0 ++++++++++??????????+++++++++++++++++++++++++++++++++++???????????????????????????????????++++++++++++++++++++????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????++++++++++++++++++++++++++++++++++++????????????????????????????????????++++????++++++++++++++...
output:
0
result:
ok single line: '0'
Test #39:
score: 0
Accepted
time: 18ms
memory: 27652kb
input:
1000000 69971 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
180870046
result:
ok single line: '180870046'
Test #40:
score: 0
Accepted
time: 15ms
memory: 27480kb
input:
1000000 69971 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
180835657
result:
ok single line: '180835657'
Test #41:
score: 0
Accepted
time: 21ms
memory: 27628kb
input:
1000000 822 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????+...
output:
17939203
result:
ok single line: '17939203'
Test #42:
score: 0
Accepted
time: 22ms
memory: 27556kb
input:
1000000 924 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????+...
output:
19239363
result:
ok single line: '19239363'
Test #43:
score: 0
Accepted
time: 15ms
memory: 27476kb
input:
1000000 924 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+...
output:
17839350
result:
ok single line: '17839350'
Test #44:
score: 0
Accepted
time: 9ms
memory: 27676kb
input:
1000000 822 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????...
output:
18116120
result:
ok single line: '18116120'
Test #45:
score: 0
Accepted
time: 16ms
memory: 27468kb
input:
1000000 972519 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++??...
output:
685792922
result:
ok single line: '685792922'
Test #46:
score: 0
Accepted
time: 11ms
memory: 18176kb
input:
500000 570465 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...
output:
261665426
result:
ok single line: '261665426'
Test #47:
score: 0
Accepted
time: 1ms
memory: 7408kb
input:
100000 74846 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
18660523
result:
ok single line: '18660523'
Test #48:
score: 0
Accepted
time: 1ms
memory: 5508kb
input:
2879 999609 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...
output:
999126
result:
ok single line: '999126'
Test #49:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
2879 999609 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...
output:
999126
result:
ok single line: '999126'
Test #50:
score: 0
Accepted
time: 15ms
memory: 27484kb
input:
1000000 822 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
8220
result:
ok single line: '8220'
Test #51:
score: 0
Accepted
time: 9ms
memory: 27556kb
input:
1000000 924 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
1848000
result:
ok single line: '1848000'
Test #52:
score: 0
Accepted
time: 14ms
memory: 27476kb
input:
1000000 55 +?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+????????...
output:
2724973
result:
ok single line: '2724973'
Test #53:
score: 0
Accepted
time: 16ms
memory: 27564kb
input:
1000000 822 +++++???????????????????????????????????????????????????????????????????????????????????????????????+++++???????????????????????????????????????????????????????????????????????????????????????????????+++++???????????????????????????????????????????????????????????????????????????????????...
output:
6485000
result:
ok single line: '6485000'
Test #54:
score: 0
Accepted
time: 15ms
memory: 27532kb
input:
1000000 55 +++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++...
output:
1100000
result:
ok single line: '1100000'
Test #55:
score: 0
Accepted
time: 16ms
memory: 27556kb
input:
1000000 3681 ++++++++++?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
368100
result:
ok single line: '368100'
Test #56:
score: 0
Accepted
time: 10ms
memory: 27468kb
input:
1000000 73257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
48789162
result:
ok single line: '48789162'
Test #57:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
32 8 +??+?++??++?+??+?++?+??++??+?++?
output:
45
result:
ok single line: '45'
Test #58:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
1024 20 +??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+...
output:
2726
result:
ok single line: '2726'
Test #59:
score: 0
Accepted
time: 8ms
memory: 19232kb
input:
524288 1000 +??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+...
output:
11461382
result:
ok single line: '11461382'
Test #60:
score: 0
Accepted
time: 13ms
memory: 19560kb
input:
524288 10000 +??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??...
output:
36801050
result:
ok single line: '36801050'