#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "paint.h"
#define pb push_back
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
const int N=200005,K=105;
bool dpPref[N][K],dpSuf[N][K];
int lastBlackPref[N],lastBlackSuf[N],lastDpPref[N][K],lastDpSuf[N][K],L,R;
string solve_puzzle(string s, vector<int> c) {
int n=s.size(); int k=c.size();
// build lastBlackPref;
if (s[0]=='X') lastBlackPref[0]=0;
else lastBlackPref[0]=-1e9;
for (int i=1; i<n; i++) {
lastBlackPref[i]=lastBlackPref[i-1];
if (s[i]=='X') lastBlackPref[i]=i;
}
// build lastBlackSuf;
if (s[n-1]=='X') lastBlackSuf[n-1]=n-1;
else lastBlackSuf[n-1]=1e9;
for (int i=n-2; i>=0; i--) {
lastBlackSuf[i]=lastBlackSuf[i+1];
if (s[i]=='X') lastBlackSuf[i]=i;
}
// build dpPref
int firstBlack=lastBlackSuf[0];
int lastWhite=-1;
for (int i=0; i<=min(n-1,firstBlack+c[0]-1); i++) {
if (s[i]=='_') lastWhite=i;
if (i-c[0]+1>lastWhite) dpPref[i][0]=1;
}
for (int ind=1; ind<k; ind++) {
lastWhite=-1e9;
for (int i=0; i<n; i++) {
if (s[i]=='_') lastWhite=i;
if (i-c[ind]+1<=lastWhite) continue;
if ((i-c[ind])-1<0) continue;
if (s[i-c[ind]]=='X') continue;
for (int j=max(0,lastBlackPref[(i-c[ind])-1]); j<=(i-c[ind])-1; j++) {
if (dpPref[j][ind-1]==1) dpPref[i][ind]=1;
}
}
}
// build dpSuf
int lastBlack=lastBlackPref[n-1];
lastWhite=n;
for (int i=n-1; i>=max(0,lastBlack-c[k-1]+1); i--) {
if (s[i]=='_') lastWhite=i;
if (i+c[k-1]-1<lastWhite) dpSuf[i][k-1]=1;
}
for (int ind=k-2; ind>=0; ind--) {
lastWhite=1e9;
for (int i=n-1; i>=0; i--) {
if (s[i]=='_') lastWhite=i;
if (i+c[ind]-1>=lastWhite) continue;
if ((i+c[ind])+1>n-1) continue;
if (s[(i+c[ind])]=='X') continue;
for (int j=min(n-1,lastBlackSuf[(i+c[ind])+1]); j>=(i+c[ind])+1; j--) {
if (dpSuf[j][ind+1]==1) dpSuf[i][ind]=1;
}
}
}
//build lastDpPref
for (int ind=0; ind<k; ind++) {
int last=-1;
for (int i=0; i<n; i++) {
if (dpPref[i][ind]==1) last=i;
lastDpPref[i][ind]=last;
}
}
//build lastDpSuf
for (int ind=0; ind<k; ind++) {
int last=-1;
for (int i=0; i<n; i++) {
if (dpSuf[i][ind]==1) last=i;
lastDpSuf[i][ind]=last;
}
}
// build answer
string ans=s;
for (int i=0; i<n; i++) {
if (s[i]!='.') continue;
bool canBeWhite=0,canBeBlack=0;
// can be '_'
if (lastBlackPref[i]<0) {
L=i+1; R=min(n-1,lastBlackSuf[i]);
if (L<=R && lastDpSuf[R][0]>=L) canBeWhite=1;
// for (int j=L; j<=R; j++) {
// if (dpSuf[j][0]==1) canBeWhite=1;
// }
// if (canBeWhite==1) cout<<"I "<<i<<" "<<"A"<<endl;
}
for (int ind=0; ind<k-1; ind++) {
bool B1=0,B2=0;
L=max(0,lastBlackPref[i]); R=i-1;
if (L<=R && lastDpPref[R][ind]>=L) B1=1;
// for (int j=L; j<=R; j++) {
// if (dpPref[j][ind]==1) B1=1;
// }
L=i+1; R=min(n-1,lastBlackSuf[i]);
if (L<=R && lastDpSuf[R][ind+1]>=L) B2=1;
// for (int j=L; j<=R; j++) {
// if (dpSuf[j][ind+1]==1) B2=1;
// }
if (B1 && B2) canBeWhite=1;
// if (canBeWhite==1) cout<<"I "<<i<<" "<<ind<<endl;
}
if (lastBlackSuf[i]>n-1) {
L=max(0,lastBlackPref[i]); R=i-1;
if (L<=R && lastDpPref[R][k-1]>=L) canBeWhite=1;
// for (int j=L; j<=R; j++) {
// if (dpPref[j][k-1]==1) canBeWhite=1;
// }
// if (canBeWhite==1) cout<<"I "<<i<<" "<<"B"<<endl;
}
// can be 'X'
int lb=-1,rb=n;
for (int j=i; j>=0; j--) {
if (s[j]=='_') {
lb=j; break;
}
}
for (int j=i; j<n; j++) {
if (s[j]=='_') {
rb=j; break;
}
}
for (int ind=0; ind<k; ind++) {
for (int o=0; o<c[ind]; o++) {
int l=(i-o),r=(i+c[ind]-o-1);
if (l<0 || r>n-1) continue;
if (dpPref[r][ind]==1 && dpSuf[l][ind]==1) canBeBlack=1;
}
}
if (canBeBlack==1 && canBeWhite==1) ans[i]='?';
else if (canBeBlack==1) ans[i]='X';
else ans[i]='_';
}
return ans;
}
Compilation message
paint.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
1 | #pragma GCC diagnostic warning "-std=c++11"
| ^~~~~~~~~~~~
paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:122:7: warning: variable 'lb' set but not used [-Wunused-but-set-variable]
122 | int lb=-1,rb=n;
| ^~
paint.cpp:122:13: warning: variable 'rb' set but not used [-Wunused-but-set-variable]
122 | int lb=-1,rb=n;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
6488 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
6492 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
6492 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
6492 KB |
n = 20, m = 2 |
12 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
13 |
Correct |
1 ms |
6492 KB |
n = 17, m = 6 |
14 |
Correct |
1 ms |
6488 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
6492 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
6492 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
6492 KB |
n = 19, m = 10 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
6488 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
6492 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
6492 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
6492 KB |
n = 20, m = 2 |
12 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
13 |
Correct |
1 ms |
6492 KB |
n = 17, m = 6 |
14 |
Correct |
1 ms |
6488 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
6492 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
6492 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
6492 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
6492 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
6492 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
6492 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
6492 KB |
n = 89, m = 10 |
25 |
Correct |
2 ms |
6492 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
6492 KB |
n = 86, m = 8 |
27 |
Correct |
1 ms |
6492 KB |
n = 53, m = 22 |
28 |
Correct |
1 ms |
6492 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
6492 KB |
n = 63, m = 25 |
30 |
Correct |
2 ms |
6492 KB |
n = 100, m = 50 |
31 |
Correct |
2 ms |
6492 KB |
n = 99, m = 50 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
6488 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
6492 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
6492 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
6492 KB |
n = 20, m = 2 |
12 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
13 |
Correct |
1 ms |
6492 KB |
n = 17, m = 6 |
14 |
Correct |
1 ms |
6488 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
6492 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
6492 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
6492 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
6492 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
6492 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
6492 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
6492 KB |
n = 89, m = 10 |
25 |
Correct |
2 ms |
6492 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
6492 KB |
n = 86, m = 8 |
27 |
Correct |
1 ms |
6492 KB |
n = 53, m = 22 |
28 |
Correct |
1 ms |
6492 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
6492 KB |
n = 63, m = 25 |
30 |
Correct |
2 ms |
6492 KB |
n = 100, m = 50 |
31 |
Correct |
2 ms |
6492 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
6492 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
6488 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
6492 KB |
n = 81, m = 6 |
37 |
Correct |
1 ms |
6488 KB |
n = 98, m = 7 |
38 |
Correct |
0 ms |
6644 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
6744 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
6492 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
6488 KB |
n = 98, m = 22 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
6488 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
6492 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
6492 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
6492 KB |
n = 20, m = 2 |
12 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
13 |
Correct |
1 ms |
6492 KB |
n = 17, m = 6 |
14 |
Correct |
1 ms |
6488 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
6492 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
6492 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
6492 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
6492 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
6492 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
6492 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
6492 KB |
n = 89, m = 10 |
25 |
Correct |
2 ms |
6492 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
6492 KB |
n = 86, m = 8 |
27 |
Correct |
1 ms |
6492 KB |
n = 53, m = 22 |
28 |
Correct |
1 ms |
6492 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
6492 KB |
n = 63, m = 25 |
30 |
Correct |
2 ms |
6492 KB |
n = 100, m = 50 |
31 |
Correct |
2 ms |
6492 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
6492 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
6488 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
6492 KB |
n = 81, m = 6 |
37 |
Correct |
1 ms |
6488 KB |
n = 98, m = 7 |
38 |
Correct |
0 ms |
6644 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
6744 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
6492 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
6488 KB |
n = 98, m = 22 |
42 |
Correct |
1 ms |
6492 KB |
n = 11, m = 2 |
43 |
Correct |
1 ms |
6492 KB |
n = 11, m = 2 |
44 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
45 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
46 |
Correct |
1 ms |
6492 KB |
n = 81, m = 2 |
47 |
Correct |
1 ms |
6492 KB |
n = 93, m = 2 |
48 |
Correct |
1 ms |
6492 KB |
n = 81, m = 2 |
49 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
50 |
Correct |
1 ms |
6488 KB |
n = 90, m = 2 |
51 |
Correct |
1 ms |
6492 KB |
n = 87, m = 2 |
52 |
Correct |
1 ms |
6492 KB |
n = 97, m = 2 |
53 |
Correct |
1 ms |
6492 KB |
n = 85, m = 2 |
54 |
Correct |
1 ms |
6488 KB |
n = 88, m = 7 |
55 |
Correct |
1 ms |
6492 KB |
n = 96, m = 7 |
56 |
Correct |
1 ms |
6492 KB |
n = 85, m = 7 |
57 |
Correct |
1 ms |
6492 KB |
n = 92, m = 7 |
58 |
Correct |
1 ms |
6492 KB |
n = 92, m = 7 |
59 |
Correct |
1 ms |
6488 KB |
n = 86, m = 7 |
60 |
Correct |
1 ms |
6492 KB |
n = 87, m = 7 |
61 |
Correct |
1 ms |
6492 KB |
n = 100, m = 7 |
62 |
Correct |
1 ms |
6492 KB |
n = 100, m = 7 |
63 |
Correct |
1 ms |
6492 KB |
n = 92, m = 21 |
64 |
Correct |
1 ms |
6744 KB |
n = 93, m = 22 |
65 |
Correct |
1 ms |
6492 KB |
n = 95, m = 22 |
66 |
Correct |
1 ms |
6492 KB |
n = 98, m = 22 |
67 |
Correct |
1 ms |
6492 KB |
n = 94, m = 22 |
68 |
Correct |
1 ms |
6492 KB |
n = 93, m = 22 |
69 |
Correct |
1 ms |
6492 KB |
n = 88, m = 21 |
70 |
Correct |
1 ms |
6492 KB |
n = 83, m = 20 |
71 |
Correct |
1 ms |
6492 KB |
n = 99, m = 23 |
72 |
Correct |
1 ms |
6492 KB |
n = 96, m = 19 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
6488 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
6492 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
6492 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
6492 KB |
n = 20, m = 2 |
12 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
13 |
Correct |
1 ms |
6492 KB |
n = 17, m = 6 |
14 |
Correct |
1 ms |
6488 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
6492 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
6492 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
6492 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
6492 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
6492 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
6492 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
6492 KB |
n = 89, m = 10 |
25 |
Correct |
2 ms |
6492 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
6492 KB |
n = 86, m = 8 |
27 |
Correct |
1 ms |
6492 KB |
n = 53, m = 22 |
28 |
Correct |
1 ms |
6492 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
6492 KB |
n = 63, m = 25 |
30 |
Correct |
2 ms |
6492 KB |
n = 100, m = 50 |
31 |
Correct |
2 ms |
6492 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
6492 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
6488 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
6492 KB |
n = 81, m = 6 |
37 |
Correct |
1 ms |
6488 KB |
n = 98, m = 7 |
38 |
Correct |
0 ms |
6644 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
6744 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
6492 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
6488 KB |
n = 98, m = 22 |
42 |
Correct |
1 ms |
6492 KB |
n = 11, m = 2 |
43 |
Correct |
1 ms |
6492 KB |
n = 11, m = 2 |
44 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
45 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
46 |
Correct |
1 ms |
6492 KB |
n = 81, m = 2 |
47 |
Correct |
1 ms |
6492 KB |
n = 93, m = 2 |
48 |
Correct |
1 ms |
6492 KB |
n = 81, m = 2 |
49 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
50 |
Correct |
1 ms |
6488 KB |
n = 90, m = 2 |
51 |
Correct |
1 ms |
6492 KB |
n = 87, m = 2 |
52 |
Correct |
1 ms |
6492 KB |
n = 97, m = 2 |
53 |
Correct |
1 ms |
6492 KB |
n = 85, m = 2 |
54 |
Correct |
1 ms |
6488 KB |
n = 88, m = 7 |
55 |
Correct |
1 ms |
6492 KB |
n = 96, m = 7 |
56 |
Correct |
1 ms |
6492 KB |
n = 85, m = 7 |
57 |
Correct |
1 ms |
6492 KB |
n = 92, m = 7 |
58 |
Correct |
1 ms |
6492 KB |
n = 92, m = 7 |
59 |
Correct |
1 ms |
6488 KB |
n = 86, m = 7 |
60 |
Correct |
1 ms |
6492 KB |
n = 87, m = 7 |
61 |
Correct |
1 ms |
6492 KB |
n = 100, m = 7 |
62 |
Correct |
1 ms |
6492 KB |
n = 100, m = 7 |
63 |
Correct |
1 ms |
6492 KB |
n = 92, m = 21 |
64 |
Correct |
1 ms |
6744 KB |
n = 93, m = 22 |
65 |
Correct |
1 ms |
6492 KB |
n = 95, m = 22 |
66 |
Correct |
1 ms |
6492 KB |
n = 98, m = 22 |
67 |
Correct |
1 ms |
6492 KB |
n = 94, m = 22 |
68 |
Correct |
1 ms |
6492 KB |
n = 93, m = 22 |
69 |
Correct |
1 ms |
6492 KB |
n = 88, m = 21 |
70 |
Correct |
1 ms |
6492 KB |
n = 83, m = 20 |
71 |
Correct |
1 ms |
6492 KB |
n = 99, m = 23 |
72 |
Correct |
1 ms |
6492 KB |
n = 96, m = 19 |
73 |
Correct |
11 ms |
10844 KB |
n = 4825, m = 5 |
74 |
Correct |
7 ms |
11096 KB |
n = 4384, m = 5 |
75 |
Correct |
12 ms |
10844 KB |
n = 4528, m = 5 |
76 |
Correct |
14 ms |
10840 KB |
n = 4980, m = 5 |
77 |
Correct |
9 ms |
14940 KB |
n = 4730, m = 5 |
78 |
Correct |
13 ms |
12952 KB |
n = 4784, m = 5 |
79 |
Correct |
12 ms |
14940 KB |
n = 4875, m = 5 |
80 |
Correct |
13 ms |
10728 KB |
n = 4576, m = 5 |
81 |
Correct |
11 ms |
10844 KB |
n = 4297, m = 5 |
82 |
Correct |
10 ms |
12984 KB |
n = 4662, m = 48 |
83 |
Correct |
16 ms |
12892 KB |
n = 4753, m = 49 |
84 |
Correct |
16 ms |
10844 KB |
n = 4148, m = 46 |
85 |
Correct |
16 ms |
13024 KB |
n = 4906, m = 50 |
86 |
Correct |
22 ms |
13076 KB |
n = 4967, m = 50 |
87 |
Correct |
31 ms |
13052 KB |
n = 4828, m = 49 |
88 |
Correct |
20 ms |
10844 KB |
n = 4105, m = 45 |
89 |
Correct |
40 ms |
13024 KB |
n = 4954, m = 50 |
90 |
Correct |
41 ms |
12892 KB |
n = 4884, m = 49 |
91 |
Correct |
14 ms |
12892 KB |
n = 4307, m = 100 |
92 |
Correct |
21 ms |
12892 KB |
n = 4668, m = 100 |
93 |
Correct |
26 ms |
13076 KB |
n = 4647, m = 100 |
94 |
Correct |
20 ms |
12892 KB |
n = 4372, m = 100 |
95 |
Correct |
30 ms |
12892 KB |
n = 4791, m = 100 |
96 |
Correct |
30 ms |
10908 KB |
n = 4029, m = 100 |
97 |
Correct |
33 ms |
12888 KB |
n = 4439, m = 100 |
98 |
Correct |
44 ms |
10708 KB |
n = 4018, m = 100 |
99 |
Correct |
96 ms |
12852 KB |
n = 4979, m = 100 |
100 |
Correct |
201 ms |
12888 KB |
n = 4996, m = 89 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
n = 13, m = 1 |
2 |
Correct |
1 ms |
6488 KB |
n = 18, m = 1 |
3 |
Correct |
2 ms |
6488 KB |
n = 17, m = 1 |
4 |
Correct |
1 ms |
6488 KB |
n = 1, m = 1 |
5 |
Correct |
1 ms |
6488 KB |
n = 20, m = 1 |
6 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
7 |
Correct |
1 ms |
6492 KB |
n = 20, m = 1 |
8 |
Correct |
1 ms |
6488 KB |
n = 20, m = 5 |
9 |
Correct |
1 ms |
6492 KB |
n = 18, m = 3 |
10 |
Correct |
1 ms |
6492 KB |
n = 17, m = 2 |
11 |
Correct |
1 ms |
6492 KB |
n = 20, m = 2 |
12 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
13 |
Correct |
1 ms |
6492 KB |
n = 17, m = 6 |
14 |
Correct |
1 ms |
6488 KB |
n = 17, m = 1 |
15 |
Correct |
1 ms |
6492 KB |
n = 17, m = 4 |
16 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
17 |
Correct |
1 ms |
6492 KB |
n = 18, m = 4 |
18 |
Correct |
1 ms |
6492 KB |
n = 20, m = 10 |
19 |
Correct |
1 ms |
6492 KB |
n = 19, m = 10 |
20 |
Correct |
1 ms |
6492 KB |
n = 100, m = 5 |
21 |
Correct |
1 ms |
6492 KB |
n = 90, m = 3 |
22 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
23 |
Correct |
1 ms |
6492 KB |
n = 81, m = 4 |
24 |
Correct |
1 ms |
6492 KB |
n = 89, m = 10 |
25 |
Correct |
2 ms |
6492 KB |
n = 81, m = 23 |
26 |
Correct |
1 ms |
6492 KB |
n = 86, m = 8 |
27 |
Correct |
1 ms |
6492 KB |
n = 53, m = 22 |
28 |
Correct |
1 ms |
6492 KB |
n = 89, m = 35 |
29 |
Correct |
1 ms |
6492 KB |
n = 63, m = 25 |
30 |
Correct |
2 ms |
6492 KB |
n = 100, m = 50 |
31 |
Correct |
2 ms |
6492 KB |
n = 99, m = 50 |
32 |
Correct |
1 ms |
6492 KB |
n = 13, m = 4 |
33 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
34 |
Correct |
1 ms |
6488 KB |
n = 88, m = 2 |
35 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
36 |
Correct |
1 ms |
6492 KB |
n = 81, m = 6 |
37 |
Correct |
1 ms |
6488 KB |
n = 98, m = 7 |
38 |
Correct |
0 ms |
6644 KB |
n = 92, m = 7 |
39 |
Correct |
1 ms |
6744 KB |
n = 88, m = 21 |
40 |
Correct |
1 ms |
6492 KB |
n = 90, m = 21 |
41 |
Correct |
1 ms |
6488 KB |
n = 98, m = 22 |
42 |
Correct |
1 ms |
6492 KB |
n = 11, m = 2 |
43 |
Correct |
1 ms |
6492 KB |
n = 11, m = 2 |
44 |
Correct |
1 ms |
6492 KB |
n = 13, m = 3 |
45 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
46 |
Correct |
1 ms |
6492 KB |
n = 81, m = 2 |
47 |
Correct |
1 ms |
6492 KB |
n = 93, m = 2 |
48 |
Correct |
1 ms |
6492 KB |
n = 81, m = 2 |
49 |
Correct |
1 ms |
6492 KB |
n = 86, m = 2 |
50 |
Correct |
1 ms |
6488 KB |
n = 90, m = 2 |
51 |
Correct |
1 ms |
6492 KB |
n = 87, m = 2 |
52 |
Correct |
1 ms |
6492 KB |
n = 97, m = 2 |
53 |
Correct |
1 ms |
6492 KB |
n = 85, m = 2 |
54 |
Correct |
1 ms |
6488 KB |
n = 88, m = 7 |
55 |
Correct |
1 ms |
6492 KB |
n = 96, m = 7 |
56 |
Correct |
1 ms |
6492 KB |
n = 85, m = 7 |
57 |
Correct |
1 ms |
6492 KB |
n = 92, m = 7 |
58 |
Correct |
1 ms |
6492 KB |
n = 92, m = 7 |
59 |
Correct |
1 ms |
6488 KB |
n = 86, m = 7 |
60 |
Correct |
1 ms |
6492 KB |
n = 87, m = 7 |
61 |
Correct |
1 ms |
6492 KB |
n = 100, m = 7 |
62 |
Correct |
1 ms |
6492 KB |
n = 100, m = 7 |
63 |
Correct |
1 ms |
6492 KB |
n = 92, m = 21 |
64 |
Correct |
1 ms |
6744 KB |
n = 93, m = 22 |
65 |
Correct |
1 ms |
6492 KB |
n = 95, m = 22 |
66 |
Correct |
1 ms |
6492 KB |
n = 98, m = 22 |
67 |
Correct |
1 ms |
6492 KB |
n = 94, m = 22 |
68 |
Correct |
1 ms |
6492 KB |
n = 93, m = 22 |
69 |
Correct |
1 ms |
6492 KB |
n = 88, m = 21 |
70 |
Correct |
1 ms |
6492 KB |
n = 83, m = 20 |
71 |
Correct |
1 ms |
6492 KB |
n = 99, m = 23 |
72 |
Correct |
1 ms |
6492 KB |
n = 96, m = 19 |
73 |
Correct |
11 ms |
10844 KB |
n = 4825, m = 5 |
74 |
Correct |
7 ms |
11096 KB |
n = 4384, m = 5 |
75 |
Correct |
12 ms |
10844 KB |
n = 4528, m = 5 |
76 |
Correct |
14 ms |
10840 KB |
n = 4980, m = 5 |
77 |
Correct |
9 ms |
14940 KB |
n = 4730, m = 5 |
78 |
Correct |
13 ms |
12952 KB |
n = 4784, m = 5 |
79 |
Correct |
12 ms |
14940 KB |
n = 4875, m = 5 |
80 |
Correct |
13 ms |
10728 KB |
n = 4576, m = 5 |
81 |
Correct |
11 ms |
10844 KB |
n = 4297, m = 5 |
82 |
Correct |
10 ms |
12984 KB |
n = 4662, m = 48 |
83 |
Correct |
16 ms |
12892 KB |
n = 4753, m = 49 |
84 |
Correct |
16 ms |
10844 KB |
n = 4148, m = 46 |
85 |
Correct |
16 ms |
13024 KB |
n = 4906, m = 50 |
86 |
Correct |
22 ms |
13076 KB |
n = 4967, m = 50 |
87 |
Correct |
31 ms |
13052 KB |
n = 4828, m = 49 |
88 |
Correct |
20 ms |
10844 KB |
n = 4105, m = 45 |
89 |
Correct |
40 ms |
13024 KB |
n = 4954, m = 50 |
90 |
Correct |
41 ms |
12892 KB |
n = 4884, m = 49 |
91 |
Correct |
14 ms |
12892 KB |
n = 4307, m = 100 |
92 |
Correct |
21 ms |
12892 KB |
n = 4668, m = 100 |
93 |
Correct |
26 ms |
13076 KB |
n = 4647, m = 100 |
94 |
Correct |
20 ms |
12892 KB |
n = 4372, m = 100 |
95 |
Correct |
30 ms |
12892 KB |
n = 4791, m = 100 |
96 |
Correct |
30 ms |
10908 KB |
n = 4029, m = 100 |
97 |
Correct |
33 ms |
12888 KB |
n = 4439, m = 100 |
98 |
Correct |
44 ms |
10708 KB |
n = 4018, m = 100 |
99 |
Correct |
96 ms |
12852 KB |
n = 4979, m = 100 |
100 |
Correct |
201 ms |
12888 KB |
n = 4996, m = 89 |
101 |
Execution timed out |
2078 ms |
164948 KB |
Time limit exceeded |
102 |
Halted |
0 ms |
0 KB |
- |