#pragma once
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+6;
const int K = 103;
bool possible[N][K][2]={};
bool backtrack[N][K][2]={};
bool white_poss[N]={};
bool black_poss[N]={};
string solve_puzzle(string s, vector<int> c) {
const int n = s.size();
const int k = c.size();
vector<int> pref_white, pref_black;
for (int i = 0; i < s.size(); ++i) {
int prv_w = pref_white.size() ? pref_white.back() : 0;
int prv_b = pref_black.size() ? pref_black.back() : 0;
if (s[i] == '_') ++prv_w;
if (s[i] == 'X') ++prv_b;
pref_white.push_back(prv_w);
pref_black.push_back(prv_b);
}
possible[0][0][0] = true;
for (int i = 1; i <= n; ++i) {
for (int ck = 0; ck <= k; ++ck) {
if (s[i-1] != 'X') possible[i][ck][0] = possible[i-1][ck][0] | possible[i-1][ck][1];
if (ck == 0) continue;
if (s[i-1] == '_') continue;
if (c[ck-1] > i) continue;
int r = i;
int l = i - c[ck-1]+1;
--r;
l -= 2;
int su = pref_white[r];
if (l >= 0) su -= pref_white[l];
if (su > 0) continue;
l++;
possible[i][ck][1] = possible[l][ck-1][0];
// cerr << "update " << i << " " << ck << " " <<
}
}
backtrack[n][k][0] = possible[n][k][0];
backtrack[n][k][1] = possible[n][k][1];
auto upd_bool = [&] (bool& val, bool new_val) {
val |= new_val;
};
auto assure = [&] (bool& val, bool old) {
val &= old;
};
vector<int> lst_black(k+1, 1e9);
if (backtrack[n][k][1]) black_poss[n] = true;
if (backtrack[n][k][0]) white_poss[n] = true;
for (int i = n-1; i > 0; --i) {
for (int ck = k; ck >= 0; --ck) {
bool case1 = backtrack[i+1][ck][0];
assure(case1, possible[i][ck][0]);
upd_bool(backtrack[i][ck][0], case1);
if (ck < k) {
int le = c[ck];
bool case2 = backtrack[i+le][ck+1][1];
assure(case2, possible[i][ck][0]);
upd_bool(backtrack[i][ck][0], case2);
}
if (backtrack[i][ck][0]) {
white_poss[i] = true;
}
if (ck > 0) {
upd_bool(backtrack[i][ck][1], backtrack[i+1][ck][0]);
assure(backtrack[i][ck][1], possible[i][ck][1]);
if (backtrack[i][ck][1]) black_poss[i] = true;
}
}
}
for (int i = n; i > 0; --i) {
for (int ck = k; ck > 0; --ck) {
if (backtrack[i][ck][1]) lst_black[ck] = i;
if (lst_black[ck] - i + 1 <= c[ck-1]) black_poss[i] = true;
}
}
string ret(n, '0');
for (int i = 1; i <= n; ++i) {
if (white_poss[i] && black_poss[i]) ret[i-1] = '?';
else if (white_poss[i]) ret[i-1] = '_';
else if (black_poss[i]) ret[i-1] = 'X';
else assert(false);
}
return ret;
}
Compilation message
paint.cpp:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for (int i = 0; i < s.size(); ++i) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
4444 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
4444 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
4444 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
4444 KB |
n = 20, m = 2 |
12 |
Correct |
0 ms |
4444 KB |
n = 17, m = 4 |
13 |
Correct |
0 ms |
4444 KB |
n = 17, m = 6 |
14 |
Correct |
0 ms |
4444 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
4444 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
4444 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
4444 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
4444 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
4444 KB |
n = 19, m = 10 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
4444 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
4444 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
4444 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
4444 KB |
n = 20, m = 2 |
12 |
Correct |
0 ms |
4444 KB |
n = 17, m = 4 |
13 |
Correct |
0 ms |
4444 KB |
n = 17, m = 6 |
14 |
Correct |
0 ms |
4444 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
4444 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
4444 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
4444 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
4444 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
4444 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
4444 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
4444 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
4444 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
4444 KB |
n = 89, m = 10 |
25 |
Correct |
1 ms |
4444 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
4444 KB |
n = 86, m = 8 |
27 |
Correct |
0 ms |
4444 KB |
n = 53, m = 22 |
28 |
Correct |
0 ms |
4444 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
4444 KB |
n = 63, m = 25 |
30 |
Correct |
1 ms |
4444 KB |
n = 100, m = 50 |
31 |
Correct |
1 ms |
4444 KB |
n = 99, m = 50 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
4444 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
4444 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
4444 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
4444 KB |
n = 20, m = 2 |
12 |
Correct |
0 ms |
4444 KB |
n = 17, m = 4 |
13 |
Correct |
0 ms |
4444 KB |
n = 17, m = 6 |
14 |
Correct |
0 ms |
4444 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
4444 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
4444 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
4444 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
4444 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
4444 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
4444 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
4444 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
4444 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
4444 KB |
n = 89, m = 10 |
25 |
Correct |
1 ms |
4444 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
4444 KB |
n = 86, m = 8 |
27 |
Correct |
0 ms |
4444 KB |
n = 53, m = 22 |
28 |
Correct |
0 ms |
4444 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
4444 KB |
n = 63, m = 25 |
30 |
Correct |
1 ms |
4444 KB |
n = 100, m = 50 |
31 |
Correct |
1 ms |
4444 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
4444 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
4444 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
4440 KB |
n = 81, m = 6 |
37 |
Correct |
0 ms |
4444 KB |
n = 98, m = 7 |
38 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
4444 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
4444 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
4444 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
4444 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
4444 KB |
n = 20, m = 2 |
12 |
Correct |
0 ms |
4444 KB |
n = 17, m = 4 |
13 |
Correct |
0 ms |
4444 KB |
n = 17, m = 6 |
14 |
Correct |
0 ms |
4444 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
4444 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
4444 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
4444 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
4444 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
4444 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
4444 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
4444 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
4444 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
4444 KB |
n = 89, m = 10 |
25 |
Correct |
1 ms |
4444 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
4444 KB |
n = 86, m = 8 |
27 |
Correct |
0 ms |
4444 KB |
n = 53, m = 22 |
28 |
Correct |
0 ms |
4444 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
4444 KB |
n = 63, m = 25 |
30 |
Correct |
1 ms |
4444 KB |
n = 100, m = 50 |
31 |
Correct |
1 ms |
4444 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
4444 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
4444 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
4440 KB |
n = 81, m = 6 |
37 |
Correct |
0 ms |
4444 KB |
n = 98, m = 7 |
38 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
4444 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
42 |
Correct |
1 ms |
4440 KB |
n = 11, m = 2 |
43 |
Correct |
1 ms |
4444 KB |
n = 11, m = 2 |
44 |
Correct |
0 ms |
4444 KB |
n = 13, m = 3 |
45 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
46 |
Correct |
1 ms |
4444 KB |
n = 81, m = 2 |
47 |
Correct |
1 ms |
4444 KB |
n = 93, m = 2 |
48 |
Correct |
1 ms |
4444 KB |
n = 81, m = 2 |
49 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
50 |
Correct |
1 ms |
4440 KB |
n = 90, m = 2 |
51 |
Correct |
1 ms |
4544 KB |
n = 87, m = 2 |
52 |
Correct |
1 ms |
4444 KB |
n = 97, m = 2 |
53 |
Correct |
1 ms |
4444 KB |
n = 85, m = 2 |
54 |
Correct |
1 ms |
4444 KB |
n = 88, m = 7 |
55 |
Correct |
1 ms |
4440 KB |
n = 96, m = 7 |
56 |
Correct |
1 ms |
4444 KB |
n = 85, m = 7 |
57 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
58 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
59 |
Correct |
1 ms |
4444 KB |
n = 86, m = 7 |
60 |
Correct |
1 ms |
4444 KB |
n = 87, m = 7 |
61 |
Correct |
1 ms |
4444 KB |
n = 100, m = 7 |
62 |
Correct |
1 ms |
4536 KB |
n = 100, m = 7 |
63 |
Correct |
1 ms |
4444 KB |
n = 92, m = 21 |
64 |
Correct |
1 ms |
4444 KB |
n = 93, m = 22 |
65 |
Correct |
1 ms |
4440 KB |
n = 95, m = 22 |
66 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
67 |
Correct |
1 ms |
4444 KB |
n = 94, m = 22 |
68 |
Correct |
1 ms |
4440 KB |
n = 93, m = 22 |
69 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
70 |
Correct |
1 ms |
4444 KB |
n = 83, m = 20 |
71 |
Correct |
1 ms |
4544 KB |
n = 99, m = 23 |
72 |
Correct |
1 ms |
4444 KB |
n = 96, m = 19 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
4444 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
4444 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
4444 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
4444 KB |
n = 20, m = 2 |
12 |
Correct |
0 ms |
4444 KB |
n = 17, m = 4 |
13 |
Correct |
0 ms |
4444 KB |
n = 17, m = 6 |
14 |
Correct |
0 ms |
4444 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
4444 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
4444 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
4444 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
4444 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
4444 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
4444 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
4444 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
4444 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
4444 KB |
n = 89, m = 10 |
25 |
Correct |
1 ms |
4444 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
4444 KB |
n = 86, m = 8 |
27 |
Correct |
0 ms |
4444 KB |
n = 53, m = 22 |
28 |
Correct |
0 ms |
4444 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
4444 KB |
n = 63, m = 25 |
30 |
Correct |
1 ms |
4444 KB |
n = 100, m = 50 |
31 |
Correct |
1 ms |
4444 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
4444 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
4444 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
4440 KB |
n = 81, m = 6 |
37 |
Correct |
0 ms |
4444 KB |
n = 98, m = 7 |
38 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
4444 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
42 |
Correct |
1 ms |
4440 KB |
n = 11, m = 2 |
43 |
Correct |
1 ms |
4444 KB |
n = 11, m = 2 |
44 |
Correct |
0 ms |
4444 KB |
n = 13, m = 3 |
45 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
46 |
Correct |
1 ms |
4444 KB |
n = 81, m = 2 |
47 |
Correct |
1 ms |
4444 KB |
n = 93, m = 2 |
48 |
Correct |
1 ms |
4444 KB |
n = 81, m = 2 |
49 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
50 |
Correct |
1 ms |
4440 KB |
n = 90, m = 2 |
51 |
Correct |
1 ms |
4544 KB |
n = 87, m = 2 |
52 |
Correct |
1 ms |
4444 KB |
n = 97, m = 2 |
53 |
Correct |
1 ms |
4444 KB |
n = 85, m = 2 |
54 |
Correct |
1 ms |
4444 KB |
n = 88, m = 7 |
55 |
Correct |
1 ms |
4440 KB |
n = 96, m = 7 |
56 |
Correct |
1 ms |
4444 KB |
n = 85, m = 7 |
57 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
58 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
59 |
Correct |
1 ms |
4444 KB |
n = 86, m = 7 |
60 |
Correct |
1 ms |
4444 KB |
n = 87, m = 7 |
61 |
Correct |
1 ms |
4444 KB |
n = 100, m = 7 |
62 |
Correct |
1 ms |
4536 KB |
n = 100, m = 7 |
63 |
Correct |
1 ms |
4444 KB |
n = 92, m = 21 |
64 |
Correct |
1 ms |
4444 KB |
n = 93, m = 22 |
65 |
Correct |
1 ms |
4440 KB |
n = 95, m = 22 |
66 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
67 |
Correct |
1 ms |
4444 KB |
n = 94, m = 22 |
68 |
Correct |
1 ms |
4440 KB |
n = 93, m = 22 |
69 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
70 |
Correct |
1 ms |
4444 KB |
n = 83, m = 20 |
71 |
Correct |
1 ms |
4544 KB |
n = 99, m = 23 |
72 |
Correct |
1 ms |
4444 KB |
n = 96, m = 19 |
73 |
Correct |
2 ms |
6492 KB |
n = 4825, m = 5 |
74 |
Correct |
1 ms |
6492 KB |
n = 4384, m = 5 |
75 |
Correct |
1 ms |
6740 KB |
n = 4528, m = 5 |
76 |
Correct |
1 ms |
6492 KB |
n = 4980, m = 5 |
77 |
Correct |
1 ms |
6488 KB |
n = 4730, m = 5 |
78 |
Correct |
1 ms |
6492 KB |
n = 4784, m = 5 |
79 |
Correct |
1 ms |
6488 KB |
n = 4875, m = 5 |
80 |
Correct |
1 ms |
6492 KB |
n = 4576, m = 5 |
81 |
Correct |
1 ms |
6492 KB |
n = 4297, m = 5 |
82 |
Correct |
3 ms |
6748 KB |
n = 4662, m = 48 |
83 |
Correct |
3 ms |
6488 KB |
n = 4753, m = 49 |
84 |
Correct |
3 ms |
6688 KB |
n = 4148, m = 46 |
85 |
Correct |
4 ms |
6488 KB |
n = 4906, m = 50 |
86 |
Correct |
4 ms |
6492 KB |
n = 4967, m = 50 |
87 |
Correct |
3 ms |
6492 KB |
n = 4828, m = 49 |
88 |
Correct |
2 ms |
6492 KB |
n = 4105, m = 45 |
89 |
Correct |
4 ms |
6488 KB |
n = 4954, m = 50 |
90 |
Correct |
3 ms |
6492 KB |
n = 4884, m = 49 |
91 |
Correct |
3 ms |
6492 KB |
n = 4307, m = 100 |
92 |
Correct |
4 ms |
6492 KB |
n = 4668, m = 100 |
93 |
Correct |
4 ms |
6708 KB |
n = 4647, m = 100 |
94 |
Correct |
4 ms |
6492 KB |
n = 4372, m = 100 |
95 |
Correct |
4 ms |
6708 KB |
n = 4791, m = 100 |
96 |
Correct |
5 ms |
6744 KB |
n = 4029, m = 100 |
97 |
Correct |
4 ms |
6492 KB |
n = 4439, m = 100 |
98 |
Correct |
3 ms |
6492 KB |
n = 4018, m = 100 |
99 |
Correct |
4 ms |
6492 KB |
n = 4979, m = 100 |
100 |
Correct |
4 ms |
6488 KB |
n = 4996, m = 89 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
4444 KB |
n = 18, m = 1 |
3 |
Correct |
1 ms |
4444 KB |
n = 17, m = 1 |
4 |
Correct |
0 ms |
4444 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
6 |
Correct |
0 ms |
4444 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
4444 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
4444 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
4444 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
4444 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
4444 KB |
n = 20, m = 2 |
12 |
Correct |
0 ms |
4444 KB |
n = 17, m = 4 |
13 |
Correct |
0 ms |
4444 KB |
n = 17, m = 6 |
14 |
Correct |
0 ms |
4444 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
4444 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
4444 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
4444 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
4444 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
4444 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
4444 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
4444 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
4444 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
4444 KB |
n = 89, m = 10 |
25 |
Correct |
1 ms |
4444 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
4444 KB |
n = 86, m = 8 |
27 |
Correct |
0 ms |
4444 KB |
n = 53, m = 22 |
28 |
Correct |
0 ms |
4444 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
4444 KB |
n = 63, m = 25 |
30 |
Correct |
1 ms |
4444 KB |
n = 100, m = 50 |
31 |
Correct |
1 ms |
4444 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
4444 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
4444 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
4440 KB |
n = 81, m = 6 |
37 |
Correct |
0 ms |
4444 KB |
n = 98, m = 7 |
38 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
4444 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
42 |
Correct |
1 ms |
4440 KB |
n = 11, m = 2 |
43 |
Correct |
1 ms |
4444 KB |
n = 11, m = 2 |
44 |
Correct |
0 ms |
4444 KB |
n = 13, m = 3 |
45 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
46 |
Correct |
1 ms |
4444 KB |
n = 81, m = 2 |
47 |
Correct |
1 ms |
4444 KB |
n = 93, m = 2 |
48 |
Correct |
1 ms |
4444 KB |
n = 81, m = 2 |
49 |
Correct |
1 ms |
4444 KB |
n = 86, m = 2 |
50 |
Correct |
1 ms |
4440 KB |
n = 90, m = 2 |
51 |
Correct |
1 ms |
4544 KB |
n = 87, m = 2 |
52 |
Correct |
1 ms |
4444 KB |
n = 97, m = 2 |
53 |
Correct |
1 ms |
4444 KB |
n = 85, m = 2 |
54 |
Correct |
1 ms |
4444 KB |
n = 88, m = 7 |
55 |
Correct |
1 ms |
4440 KB |
n = 96, m = 7 |
56 |
Correct |
1 ms |
4444 KB |
n = 85, m = 7 |
57 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
58 |
Correct |
1 ms |
4444 KB |
n = 92, m = 7 |
59 |
Correct |
1 ms |
4444 KB |
n = 86, m = 7 |
60 |
Correct |
1 ms |
4444 KB |
n = 87, m = 7 |
61 |
Correct |
1 ms |
4444 KB |
n = 100, m = 7 |
62 |
Correct |
1 ms |
4536 KB |
n = 100, m = 7 |
63 |
Correct |
1 ms |
4444 KB |
n = 92, m = 21 |
64 |
Correct |
1 ms |
4444 KB |
n = 93, m = 22 |
65 |
Correct |
1 ms |
4440 KB |
n = 95, m = 22 |
66 |
Correct |
1 ms |
4444 KB |
n = 98, m = 22 |
67 |
Correct |
1 ms |
4444 KB |
n = 94, m = 22 |
68 |
Correct |
1 ms |
4440 KB |
n = 93, m = 22 |
69 |
Correct |
1 ms |
4444 KB |
n = 88, m = 21 |
70 |
Correct |
1 ms |
4444 KB |
n = 83, m = 20 |
71 |
Correct |
1 ms |
4544 KB |
n = 99, m = 23 |
72 |
Correct |
1 ms |
4444 KB |
n = 96, m = 19 |
73 |
Correct |
2 ms |
6492 KB |
n = 4825, m = 5 |
74 |
Correct |
1 ms |
6492 KB |
n = 4384, m = 5 |
75 |
Correct |
1 ms |
6740 KB |
n = 4528, m = 5 |
76 |
Correct |
1 ms |
6492 KB |
n = 4980, m = 5 |
77 |
Correct |
1 ms |
6488 KB |
n = 4730, m = 5 |
78 |
Correct |
1 ms |
6492 KB |
n = 4784, m = 5 |
79 |
Correct |
1 ms |
6488 KB |
n = 4875, m = 5 |
80 |
Correct |
1 ms |
6492 KB |
n = 4576, m = 5 |
81 |
Correct |
1 ms |
6492 KB |
n = 4297, m = 5 |
82 |
Correct |
3 ms |
6748 KB |
n = 4662, m = 48 |
83 |
Correct |
3 ms |
6488 KB |
n = 4753, m = 49 |
84 |
Correct |
3 ms |
6688 KB |
n = 4148, m = 46 |
85 |
Correct |
4 ms |
6488 KB |
n = 4906, m = 50 |
86 |
Correct |
4 ms |
6492 KB |
n = 4967, m = 50 |
87 |
Correct |
3 ms |
6492 KB |
n = 4828, m = 49 |
88 |
Correct |
2 ms |
6492 KB |
n = 4105, m = 45 |
89 |
Correct |
4 ms |
6488 KB |
n = 4954, m = 50 |
90 |
Correct |
3 ms |
6492 KB |
n = 4884, m = 49 |
91 |
Correct |
3 ms |
6492 KB |
n = 4307, m = 100 |
92 |
Correct |
4 ms |
6492 KB |
n = 4668, m = 100 |
93 |
Correct |
4 ms |
6708 KB |
n = 4647, m = 100 |
94 |
Correct |
4 ms |
6492 KB |
n = 4372, m = 100 |
95 |
Correct |
4 ms |
6708 KB |
n = 4791, m = 100 |
96 |
Correct |
5 ms |
6744 KB |
n = 4029, m = 100 |
97 |
Correct |
4 ms |
6492 KB |
n = 4439, m = 100 |
98 |
Correct |
3 ms |
6492 KB |
n = 4018, m = 100 |
99 |
Correct |
4 ms |
6492 KB |
n = 4979, m = 100 |
100 |
Correct |
4 ms |
6488 KB |
n = 4996, m = 89 |
101 |
Correct |
37 ms |
78780 KB |
n = 178952, m = 10 |
102 |
Correct |
41 ms |
78784 KB |
n = 180674, m = 10 |
103 |
Correct |
36 ms |
74320 KB |
n = 167639, m = 10 |
104 |
Correct |
44 ms |
76480 KB |
n = 172892, m = 10 |
105 |
Correct |
40 ms |
74428 KB |
n = 168125, m = 10 |
106 |
Correct |
37 ms |
74436 KB |
n = 166514, m = 10 |
107 |
Correct |
65 ms |
80800 KB |
n = 183874, m = 10 |
108 |
Correct |
47 ms |
82876 KB |
n = 194560, m = 10 |
109 |
Correct |
52 ms |
76432 KB |
n = 171994, m = 10 |
110 |
Correct |
126 ms |
72436 KB |
n = 165207, m = 100 |
111 |
Correct |
188 ms |
82876 KB |
n = 188459, m = 100 |
112 |
Correct |
138 ms |
72520 KB |
n = 162137, m = 100 |
113 |
Correct |
126 ms |
74492 KB |
n = 169691, m = 100 |
114 |
Correct |
159 ms |
83048 KB |
n = 187642, m = 100 |
115 |
Correct |
132 ms |
74428 KB |
n = 168456, m = 100 |
116 |
Correct |
129 ms |
78780 KB |
n = 180980, m = 100 |
117 |
Correct |
148 ms |
82880 KB |
n = 191687, m = 100 |
118 |
Correct |
154 ms |
74340 KB |
n = 166437, m = 100 |
119 |
Correct |
143 ms |
82988 KB |
n = 186520, m = 100 |
120 |
Correct |
126 ms |
74344 KB |
n = 166675, m = 100 |
121 |
Correct |
152 ms |
83020 KB |
n = 187725, m = 100 |
122 |
Correct |
114 ms |
70428 KB |
n = 161455, m = 100 |
123 |
Correct |
156 ms |
83132 KB |
n = 192977, m = 100 |
124 |
Correct |
198 ms |
83096 KB |
n = 192612, m = 100 |
125 |
Correct |
148 ms |
83132 KB |
n = 196512, m = 100 |
126 |
Correct |
193 ms |
83672 KB |
n = 198968, m = 100 |
127 |
Correct |
132 ms |
74428 KB |
n = 166659, m = 100 |
128 |
Correct |
65 ms |
83968 KB |
n = 199997, m = 34 |
129 |
Correct |
26 ms |
83904 KB |
n = 200000, m = 1 |
130 |
Correct |
30 ms |
83976 KB |
n = 200000, m = 1 |
131 |
Correct |
182 ms |
83760 KB |
n = 199999, m = 100 |
132 |
Correct |
130 ms |
83904 KB |
n = 199999, m = 100 |
133 |
Correct |
20 ms |
44232 KB |
n = 200000, m = 1 |