QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#104322#5476. Remodeling the DungeonNicolas125841AC ✓409ms46276kbC++143.1kb2023-05-10 07:06:562023-05-10 07:06:59

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-10 07:06:59]
  • Judged
  • Verdict: AC
  • Time: 409ms
  • Memory: 46276kb
  • [2023-05-10 07:06:56]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

vector<vi> treeJump(vi& P){
    int on = 1, d = 1;

    while(on < sz(P)) 
        on *= 2, d++;

    vector<vi> jmp(d, P);

    rep(i,1,d) 
        rep(j,0,sz(P))
            jmp[i][j] = jmp[i-1][jmp[i-1][j]];

    return jmp;
}

int jmp(vector<vi>& tbl, int nod, int steps){
    rep(i,0,sz(tbl))
        if(steps&(1<<i)) 
            nod = tbl[i][nod];

    return nod;
}

int lca(vector<vi>& tbl, vi& depth, int a, int b) {
    if (depth[a] < depth[b]) 
        swap(a, b);

    a = jmp(tbl, a, depth[a] - depth[b]);

    if (a == b) 
        return a;

    for (int i = sz(tbl); i--;) {
        int c = tbl[i][a], d = tbl[i][b];

        if (c != d) 
            a = c, b = d;
    }

    return tbl[0][a];
}

void assign_pd(vector<vi> &adj, vi &pv, vi &dv, int p, int n, int d){
    pv[n] = p;
    dv[n] = d;

    for(int v : adj[n]){
        if(v == p)
            continue;
        
        assign_pd(adj, pv, dv, n, v, d+1);
    }
}

void dfs_l(vector<vector<int>> &adj, vector<int> &l, int p, int n, int d){
    l[n] = d;

    for(int nxt : adj[n]){
        if(nxt == p)
            continue;

        dfs_l(adj, l, n, nxt, d+1);
    }
}

int main(){
    cin.tie(NULL)->sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

    string data, con;
    cin >> data;

    vector<vector<int>> adj(n*m, vector<int>());

    for(int i = 0; i < n; i++){
        cin >> data >> con;

        for(int j = 2; j < 2*m; j += 2){
            if(data[j] == '.'){
                adj[i*m + j/2 - 1].push_back(i*m + j/2);
                adj[i*m + j/2].push_back(i*m + j/2 - 1);
            }
        }

        if(i < n-1){
            for(int j = 1; j < 2*m; j += 2){
                if(con[j] == '.'){
                    adj[i*m + j/2].push_back((i+1)*m + j/2);
                    adj[(i+1)*m + j/2].push_back(i*m + j/2);
                }
            }
        }
    }

    vector<int> l(n*m), l_r(n*m);
    vi pv(n*m), dv(n*m);
    
    assign_pd(adj, pv, dv, 0, 0, 0);
    vector<vi> tbl = treeJump(pv);

    dfs_l(adj, l, -1, 0, 1);
    dfs_l(adj, l_r, -1, n*m-1, 1);

    int mx = l[n*m-1];

    for(int i = 0; i < n*m; i++){   
        int tn = lca(tbl, dv, n*m-1, i);

        if(i % m < m-1 && lca(tbl, dv, lca(tbl, dv, n*m-1, i+1), tn) != lca(tbl, dv, n*m-1, i+1))
            mx = max(mx, l[i] + l_r[i+1]);      



        if(i + m < n*m && lca(tbl, dv, lca(tbl, dv, n*m-1, i+m), tn) != lca(tbl, dv, n*m-1, i+m))
            mx = max(mx, l[i] + l_r[i+m]);
        


        if(i % m > 0 && lca(tbl, dv, lca(tbl, dv, n*m-1, i-1), tn) != lca(tbl, dv, n*m-1, i-1))
            mx = max(mx, l[i] + l_r[i-1]);    


        if(i - m >= 0 && lca(tbl, dv, lca(tbl, dv, n*m-1, i-m), tn) != lca(tbl, dv, n*m-1, i-m))
            mx = max(mx, l[i] + l_r[i-m]);
    }

    cout << mx << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3372kb

input:

2 3
+-+-+-+
|.....|
+.+.+.+
|.|.|.|
+-+-+-+

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

2 3
+-+-+-+
|...|.|
+.+.+.+
|.|...|
+-+-+-+

output:

4

result:

ok single line: '4'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

5 5
+-+-+-+-+-+
|...|...|.|
+-+.+.+.+.+
|...|.|.|.|
+.+.+.+-+.+
|.|...|.|.|
+.+.+-+.+.+
|.|.....|.|
+-+.+.+-+.+
|...|.....|
+-+-+-+-+-+

output:

15

result:

ok single line: '15'

Test #4:

score: 0
Accepted
time: 228ms
memory: 39360kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4693

result:

ok single line: '4693'

Test #5:

score: 0
Accepted
time: 207ms
memory: 39344kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4191

result:

ok single line: '4191'

Test #6:

score: 0
Accepted
time: 218ms
memory: 39084kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

3846

result:

ok single line: '3846'

Test #7:

score: 0
Accepted
time: 223ms
memory: 39176kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4856

result:

ok single line: '4856'

Test #8:

score: 0
Accepted
time: 194ms
memory: 39160kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

5829

result:

ok single line: '5829'

Test #9:

score: 0
Accepted
time: 12ms
memory: 5620kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

1147

result:

ok single line: '1147'

Test #10:

score: 0
Accepted
time: 11ms
memory: 5496kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

1388

result:

ok single line: '1388'

Test #11:

score: 0
Accepted
time: 11ms
memory: 5492kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.............|.......|.|...|...|.....|.|.|.|.|.....|.|...|.......|...|.|.|...|.|.....|....

output:

1046

result:

ok single line: '1046'

Test #12:

score: 0
Accepted
time: 18ms
memory: 5896kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|...|...|.|.|.|.|.|...|.............|.|...|...|...|...|.....|.....|...|................

output:

963

result:

ok single line: '963'

Test #13:

score: 0
Accepted
time: 3ms
memory: 3484kb

input:

2 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

643

result:

ok single line: '643'

Test #14:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

3 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

704

result:

ok single line: '704'

Test #15:

score: 0
Accepted
time: 3ms
memory: 3576kb

input:

499 4
+-+-+-+-+
|.|...|.|
+.+-+.+.+
|.......|
+-+.+-+.+
|.....|.|
+-+-+.+-+
|.......|
+.+-+-+-+
|.....|.|
+-+-+.+.+
|.......|
+.+.+-+.+
|.|.|.|.|
+-+.+.+.+
|.|.|.|.|
+.+-+.+.+
|...|.|.|
+.+-+.+.+
|.....|.|
+-+.+.+.+
|...|...|
+.+.+.+-+
|.|.|.|.|
+.+-+-+.+
|...|...|
+.+.+.+-+
|.|...|.|
+-+.+.+.+
|......

output:

826

result:

ok single line: '826'

Test #16:

score: 0
Accepted
time: 4ms
memory: 3688kb

input:

499 5
+-+-+-+-+-+
|.|...|...|
+.+.+-+.+.+
|.....|.|.|
+-+.+-+.+-+
|.......|.|
+.+-+.+.+.+
|.|.|.|...|
+-+.+-+.+-+
|...|.|.|.|
+.+-+.+.+.+
|.........|
+-+.+.+.+.+
|.|.|.|.|.|
+.+-+.+-+.+
|...|...|.|
+-+.+.+.+.+
|.|...|.|.|
+.+-+.+-+-+
|.....|...|
+-+-+.+-+.+
|.|.|.....|
+.+.+.+.+.+
|.....|.|.|
+.+-+....

output:

855

result:

ok single line: '855'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

2 2
+-+-+
|.|.|
+.+.+
|...|
+-+-+

output:

3

result:

ok single line: '3'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3420kb

input:

3 2
+-+-+
|.|.|
+.+.+
|...|
+.+-+
|...|
+-+-+

output:

6

result:

ok single line: '6'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

2 3
+-+-+-+
|.|...|
+.+-+.+
|.....|
+-+-+-+

output:

6

result:

ok single line: '6'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3364kb

input:

3 3
+-+-+-+
|.|...|
+.+-+.+
|.|...|
+.+.+.+
|...|.|
+-+-+-+

output:

9

result:

ok single line: '9'

Test #21:

score: 0
Accepted
time: 170ms
memory: 41932kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

88013

result:

ok single line: '88013'

Test #22:

score: 0
Accepted
time: 154ms
memory: 41672kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

84655

result:

ok single line: '84655'

Test #23:

score: 0
Accepted
time: 164ms
memory: 41728kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

83534

result:

ok single line: '83534'

Test #24:

score: 0
Accepted
time: 176ms
memory: 41832kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

85862

result:

ok single line: '85862'

Test #25:

score: 0
Accepted
time: 185ms
memory: 41748kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

82727

result:

ok single line: '82727'

Test #26:

score: 0
Accepted
time: 10ms
memory: 5760kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

6917

result:

ok single line: '6917'

Test #27:

score: 0
Accepted
time: 14ms
memory: 5888kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

7130

result:

ok single line: '7130'

Test #28:

score: 0
Accepted
time: 12ms
memory: 5784kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|..........................................................................................

output:

6342

result:

ok single line: '6342'

Test #29:

score: 0
Accepted
time: 11ms
memory: 5844kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|......................................................................................

output:

7093

result:

ok single line: '7093'

Test #30:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

2 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

501

result:

ok single line: '501'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

3 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

1012

result:

ok single line: '1012'

Test #32:

score: 0
Accepted
time: 3ms
memory: 3628kb

input:

499 4
+-+-+-+-+
|.......|
+-+.+-+-+
|.......|
+-+.+-+-+
|.......|
+-+.+-+-+
|.......|
+-+-+.+-+
|.......|
+.+-+-+-+
|.......|
+.+-+-+-+
|.......|
+-+-+-+.+
|.......|
+-+-+-+.+
|.......|
+.+-+-+-+
|.......|
+.+-+-+-+
|.......|
+-+-+-+.+
|.......|
+-+-+-+.+
|.......|
+.+-+-+-+
|.......|
+.+-+-+-+
|......

output:

1144

result:

ok single line: '1144'

Test #33:

score: 0
Accepted
time: 3ms
memory: 3688kb

input:

499 5
+-+-+-+-+-+
|.........|
+.+-+-+-+-+
|.........|
+-+-+-+.+-+
|.........|
+-+-+-+-+.+
|.........|
+-+-+.+-+-+
|.........|
+-+-+.+-+-+
|.........|
+-+.+-+-+-+
|.........|
+-+.+-+-+-+
|.........|
+-+-+.+-+-+
|.........|
+-+-+-+.+-+
|.........|
+-+-+-+-+.+
|.........|
+-+-+-+-+.+
|.........|
+-+-+....

output:

1273

result:

ok single line: '1273'

Test #34:

score: 0
Accepted
time: 396ms
memory: 41832kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

85163

result:

ok single line: '85163'

Test #35:

score: 0
Accepted
time: 409ms
memory: 41784kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

84679

result:

ok single line: '84679'

Test #36:

score: 0
Accepted
time: 388ms
memory: 41788kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

86302

result:

ok single line: '86302'

Test #37:

score: 0
Accepted
time: 385ms
memory: 41664kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

85720

result:

ok single line: '85720'

Test #38:

score: 0
Accepted
time: 384ms
memory: 41404kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

78639

result:

ok single line: '78639'

Test #39:

score: 0
Accepted
time: 17ms
memory: 5888kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

7005

result:

ok single line: '7005'

Test #40:

score: 0
Accepted
time: 12ms
memory: 5928kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

6640

result:

ok single line: '6640'

Test #41:

score: 0
Accepted
time: 10ms
memory: 5896kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|....

output:

7616

result:

ok single line: '7616'

Test #42:

score: 0
Accepted
time: 17ms
memory: 5828kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|....

output:

8025

result:

ok single line: '8025'

Test #43:

score: 0
Accepted
time: 3ms
memory: 3564kb

input:

2 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

761

result:

ok single line: '761'

Test #44:

score: 0
Accepted
time: 2ms
memory: 3568kb

input:

3 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

958

result:

ok single line: '958'

Test #45:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

499 4
+-+-+-+-+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|.|.|.|
+.+.+.+.+
|.|....

output:

1446

result:

ok single line: '1446'

Test #46:

score: 0
Accepted
time: 3ms
memory: 3748kb

input:

499 5
+-+-+-+-+-+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+.+.+.+
|.|.|.|.|.|
+.+.+....

output:

1599

result:

ok single line: '1599'

Test #47:

score: 0
Accepted
time: 232ms
memory: 43644kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

249999

result:

ok single line: '249999'

Test #48:

score: 0
Accepted
time: 224ms
memory: 46276kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

249999

result:

ok single line: '249999'

Test #49:

score: 0
Accepted
time: 237ms
memory: 44040kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

249500

result:

ok single line: '249500'

Test #50:

score: 0
Accepted
time: 223ms
memory: 44952kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

249500

result:

ok single line: '249500'

Test #51:

score: 0
Accepted
time: 264ms
memory: 43892kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

249001

result:

ok single line: '249001'

Test #52:

score: 0
Accepted
time: 8ms
memory: 6096kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

19999

result:

ok single line: '19999'

Test #53:

score: 0
Accepted
time: 17ms
memory: 6064kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

19594

result:

ok single line: '19594'

Test #54:

score: 0
Accepted
time: 16ms
memory: 6360kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|..........................................................................................

output:

19998

result:

ok single line: '19998'

Test #55:

score: 0
Accepted
time: 18ms
memory: 6160kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|......................................................................................

output:

20497

result:

ok single line: '20497'

Test #56:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

4 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

1999

result:

ok single line: '1999'

Test #57:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

5 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

2500

result:

ok single line: '2500'

Test #58:

score: 0
Accepted
time: 1ms
memory: 3768kb

input:

499 6
+-+-+-+-+-+-+
|...........|
+-+-+-+-+-+.+
|.........|.|
+.+-+-+-+.+.+
|.|.....|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
|.|.|...|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
|.|.|...|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
|.|.|...|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
...

output:

2994

result:

ok single line: '2994'

Test #59:

score: 0
Accepted
time: 4ms
memory: 3832kb

input:

499 7
+-+-+-+-+-+-+-+
|.............|
+-+-+-+-+-+-+.+
|...........|.|
+.+-+-+-+-+.+.+
|.|.......|.|.|
+.+.+-+-+.+.+.+
|.|.|...|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+....

output:

3493

result:

ok single line: '3493'

Test #60:

score: 0
Accepted
time: 213ms
memory: 46232kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

50349

result:

ok single line: '50349'

Test #61:

score: 0
Accepted
time: 220ms
memory: 45424kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

89603

result:

ok single line: '89603'

Test #62:

score: 0
Accepted
time: 238ms
memory: 44824kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

239186

result:

ok single line: '239186'

Test #63:

score: 0
Accepted
time: 254ms
memory: 43948kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

191538

result:

ok single line: '191538'

Test #64:

score: 0
Accepted
time: 277ms
memory: 43368kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

221145

result:

ok single line: '221145'

Test #65:

score: 0
Accepted
time: 9ms
memory: 6160kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

17473

result:

ok single line: '17473'

Test #66:

score: 0
Accepted
time: 15ms
memory: 6180kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

6372

result:

ok single line: '6372'

Test #67:

score: 0
Accepted
time: 11ms
memory: 6148kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|..........................................................................................

output:

7444

result:

ok single line: '7444'

Test #68:

score: 0
Accepted
time: 12ms
memory: 6160kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|......................................................................................

output:

6107

result:

ok single line: '6107'

Test #69:

score: 0
Accepted
time: 3ms
memory: 3648kb

input:

4 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

1537

result:

ok single line: '1537'

Test #70:

score: 0
Accepted
time: 3ms
memory: 3688kb

input:

5 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

1502

result:

ok single line: '1502'

Test #71:

score: 0
Accepted
time: 3ms
memory: 3720kb

input:

499 6
+-+-+-+-+-+-+
|...........|
+-+-+-+-+-+.+
|.........|.|
+.+-+-+-+.+.+
|.|.....|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
|.|.|...|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
|.|.|...|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
|.|.|...|.|.|
+.+.+-+.+.+.+
|.|.|...|.|.|
+.+.+.+-+.+.+
...

output:

2000

result:

ok single line: '2000'

Test #72:

score: 0
Accepted
time: 4ms
memory: 3768kb

input:

499 7
+-+-+-+-+-+-+-+
|.............|
+-+-+-+-+-+-+.+
|...........|.|
+.+-+-+-+-+.+.+
|.|.......|.|.|
+.+.+-+-+.+.+.+
|.|.|...|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|.|.|
+.+.+.+.+.+.+.+
|.|.|.|.|.|...|
+.+.+....

output:

1923

result:

ok single line: '1923'

Test #73:

score: 0
Accepted
time: 211ms
memory: 39372kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4523

result:

ok single line: '4523'

Test #74:

score: 0
Accepted
time: 192ms
memory: 39348kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4717

result:

ok single line: '4717'

Test #75:

score: 0
Accepted
time: 214ms
memory: 39180kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4026

result:

ok single line: '4026'

Test #76:

score: 0
Accepted
time: 204ms
memory: 39160kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4690

result:

ok single line: '4690'

Test #77:

score: 0
Accepted
time: 211ms
memory: 39164kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

4787

result:

ok single line: '4787'

Test #78:

score: 0
Accepted
time: 12ms
memory: 5648kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

1129

result:

ok single line: '1129'

Test #79:

score: 0
Accepted
time: 12ms
memory: 5528kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

888

result:

ok single line: '888'

Test #80:

score: 0
Accepted
time: 9ms
memory: 5632kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.........|.....|.........|.......|.|.....|.....|...|.|...|.....|.........|.|.|.|.|........

output:

1038

result:

ok single line: '1038'

Test #81:

score: 0
Accepted
time: 6ms
memory: 5848kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.....|.|.....|.....|...|.........|.....|...|.|.|...|.......|.|...|.|.|...|.....|......

output:

1355

result:

ok single line: '1355'

Test #82:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

4 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

777

result:

ok single line: '777'

Test #83:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

5 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

854

result:

ok single line: '854'

Test #84:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

499 6
+-+-+-+-+-+-+
|...|.......|
+.+-+.+-+.+-+
|...|.|.....|
+-+.+-+.+-+-+
|.|.....|.|.|
+.+-+.+-+.+.+
|...........|
+.+-+.+-+.+.+
|...|...|.|.|
+-+.+.+.+-+-+
|...|.|...|.|
+-+.+-+.+-+.+
|...|.|.....|
+-+.+.+-+.+-+
|...|.....|.|
+-+-+.+-+.+.+
|.......|...|
+-+.+-+.+-+.+
|.|.|...|.|.|
+.+.+.+.+.+.+
...

output:

902

result:

ok single line: '902'

Test #85:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

499 7
+-+-+-+-+-+-+-+
|.....|.|.....|
+-+-+.+.+.+.+.+
|.|.|.....|.|.|
+.+.+-+.+-+-+-+
|...|.........|
+.+.+.+.+-+-+-+
|.|...|...|.|.|
+-+.+.+-+-+.+.+
|.|.|.|...|...|
+.+-+.+.+-+-+.+
|.......|.....|
+-+.+-+-+-+.+-+
|.|.|...|.|...|
+.+.+.+-+.+.+.+
|.|.........|.|
+.+.+-+-+.+-+.+
|...|.|.|...|.|
+-+.+....

output:

963

result:

ok single line: '963'

Test #86:

score: 0
Accepted
time: 184ms
memory: 39372kb

input:

500 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

3031

result:

ok single line: '3031'

Test #87:

score: 0
Accepted
time: 200ms
memory: 39100kb

input:

499 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

3882

result:

ok single line: '3882'

Test #88:

score: 0
Accepted
time: 191ms
memory: 39124kb

input:

500 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

3126

result:

ok single line: '3126'

Test #89:

score: 0
Accepted
time: 178ms
memory: 39080kb

input:

499 499
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

3153

result:

ok single line: '3153'

Test #90:

score: 0
Accepted
time: 11ms
memory: 5648kb

input:

100 200
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

763

result:

ok single line: '763'

Test #91:

score: 0
Accepted
time: 14ms
memory: 5616kb

input:

97 202
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

output:

794

result:

ok single line: '794'

Test #92:

score: 0
Accepted
time: 9ms
memory: 5652kb

input:

198 101
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.......|...|.|...|.|.....|.....|.....|...|.|...........|.|...|.|.........|.|.|...|........

output:

682

result:

ok single line: '682'

Test #93:

score: 0
Accepted
time: 9ms
memory: 5892kb

input:

199 103
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.|.|...........|.....|.|...|.......|.....|...|...|...|.|.....|...|.|...|.|.|..........

output:

703

result:

ok single line: '703'

Test #94:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

4 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

521

result:

ok single line: '521'

Test #95:

score: 0
Accepted
time: 2ms
memory: 3692kb

input:

5 500
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...

output:

528

result:

ok single line: '528'

Test #96:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

499 6
+-+-+-+-+-+-+
|.......|...|
+.+.+.+-+-+.+
|.|.|.......|
+.+.+.+.+.+-+
|.|.|.|.|...|
+.+.+-+.+-+-+
|.|...|.....|
+.+-+.+-+-+.+
|...|.....|.|
+.+.+-+.+-+.+
|.|...|...|.|
+.+.+-+.+-+-+
|.|...|...|.|
+.+.+.+-+-+.+
|.|.|.....|.|
+.+-+-+.+.+.+
|...|.|.|.|.|
+.+.+.+.+-+.+
|.|.|...|...|
+.+-+-+.+.+-+
...

output:

536

result:

ok single line: '536'

Test #97:

score: 0
Accepted
time: 4ms
memory: 3700kb

input:

499 7
+-+-+-+-+-+-+-+
|...|.....|.|.|
+.+-+-+-+.+.+.+
|.|.|.....|...|
+.+.+-+.+-+-+.+
|.|...|...|.|.|
+.+.+.+-+.+.+.+
|.|.|.|.......|
+.+-+.+-+-+.+.+
|...|.....|.|.|
+.+-+.+-+-+.+-+
|.....|.|.|...|
+.+-+-+.+.+.+.+
|.|.|.....|.|.|
+.+.+.+-+-+.+-+
|...|...|...|.|
+.+.+.+.+.+.+.+
|.|...|.|.|...|
+.+-+-...

output:

537

result:

ok single line: '537'

Test #98:

score: 0
Accepted
time: 3ms
memory: 3724kb

input:

50 50
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|...|...|.....|...|.|...|.|.......|.......|...|.|.|.|.|.......|.|.....|.|.|.....|.....|.|.|.|.|.....|
+.+.+-+.+-+.+.+.+-+.+.+-+.+-+-+.+-+.+-+.+-+.+-+.+.+.+.+.+.+-+-+.+-+.+.+.+.+-+-+.+-+.+-+.+....

output:

221

result:

ok single line: '221'

Test #99:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

49 50
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|...........|.|...|.......|...|.........|.|.|...|.....|.|.|.......|.|.|.|...|.|.|.........|.........|
+.+-+.+-+.+.+.+.+.+.+.+-+.+.+-+.+-+.+-+.+.+.+-+.+-+.+-+.+.+-+.+.+-+.+.+.+.+-+.+.+-+-+-+-+....

output:

258

result:

ok single line: '258'

Test #100:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

50 49
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|...|...|.|.....|.|...|...|.....|.|...........|.|.....|.|.....|.|.....|.......|.|.........|.|...|.|
+.+.+-+.+.+.+-+.+.+.+.+-+.+.+-+-+.+.+-+-+-+.+-+.+-+-+.+.+-+-+.+.+.+.+-+.+.+-+-+.+.+-+-+.+.+.+-...

output:

222

result:

ok single line: '222'

Test #101:

score: 0
Accepted
time: 2ms
memory: 3708kb

input:

49 49
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.........|...|.............|...|...|.|.....|...|...|.....|...........|.|...|...|...|.......|.....|
+.+.+.+.+-+.+.+-+-+.+.+-+.+-+.+-+.+-+.+-+-+.+.+.+.+-+-+-+.+.+.+-+.+.+-+.+-+.+.+.+-+.+-+-+-+.+....

output:

267

result:

ok single line: '267'

Test #102:

score: 0
Accepted
time: 2ms
memory: 3704kb

input:

29 98
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|.......|.....|.|.......|.|.|.|...|.....|.|...|.........|.....|.|.....|.|.|.......|.|.....|........

output:

270

result:

ok single line: '270'

Test #103:

score: 0
Accepted
time: 3ms
memory: 3668kb

input:

97 32
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|...|.|...|...|...|.....|.|...........|.........|.|...|.......|.|
+.+.+.+-+.+.+-+-+.+.+.+-+.+.+-+-+-+-+-+-+-+.+-+-+.+-+.+.+-+-+.+.+
|.|.......|.|.......|.|...|...|.|...|...|.....|.|...|...|.......|
+.+.+-+-+.+.+.+.+-+.+-+-+.+.+-...

output:

294

result:

ok single line: '294'