QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#726390#5476. Remodeling the Dungeonshstyle#AC ✓243ms112560kbC++233.5kb2024-11-08 23:36:262024-11-08 23:36:27

Judging History

This is the latest submission verdict.

  • [2024-11-08 23:36:27]
  • Judged
  • Verdict: AC
  • Time: 243ms
  • Memory: 112560kb
  • [2024-11-08 23:36:26]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PII;
const int N=1e6+10;

ll n,m,k;

vector<int> e[N];
vector<PII> v;
char s[1010][1010];
int id[1010][1010];
int dep[N];
bool tf[N];
ll cnt[N];
typedef struct{
    int fa,len,tf;
}Node;

Node fa[N][20];

ll ans;

void dfs(int x,int f){
    fa[x][0].fa=f;
    fa[x][0].len=1;
    for(auto j:e[x]){
        if(j==f) continue;
        dep[j]=dep[x]+1;
        dfs(j,x);
    }
}


int LCA(int u,int v){
    if(dep[u]<dep[v]) swap(u,v);
    for(int i=19;i>=0;i--){
        if(dep[fa[u][i].fa]>=dep[v]) u=fa[u][i].fa;
    }
    // cout<<u<<" "<<v<<endl;
    if(u==v) return u;
    for(int i=19;i>=0;i--){
        if(fa[u][i].fa!=fa[v][i].fa){
            u=fa[u][i].fa;
            v=fa[v][i].fa;
        }
    }
    
    return fa[u][0].fa;
}



void HuangGuangsheng(int u,int v){
    // cout<<u<<" "<<v<<endl;
    int lca=LCA(u,v);
    // cout<<u<<" "<<v<<" "<<lca<<endl;
    int ru=u,rv=v;
    if(u!=lca)
    if(tf[ru]){
        ans=max(ans,dep[rv]+1+cnt[ru]);
        // cout<<"--"<<dep[rv]+1+cnt[ru]<<endl;
    }else
    {
        int len=0;
    for(int i=19;i>=0;i--){
        if(fa[u][i].tf||dep[fa[u][i].fa]<=dep[lca]) continue;
        len+=fa[u][i].len;
        u=fa[u][i].fa;
    }
    u=fa[u][0].fa;
    len++;
    if(u!=lca){
        ans=max(ans,dep[rv]+1+len+cnt[u]);
        // cout<<dep[rv]+1+len+cnt[u]<<endl;
    }
    }
    
    if(v!=lca)
    if(tf[rv]){
        ans=max(ans,dep[ru]+1+cnt[rv]);
        // cout<<dep[ru]<<" "<<1<<" "<<cnt[rv]<<endl;
    }else{
        int len=0;
    for(int i=19;i>=0;i--){
        if(fa[v][i].tf||dep[fa[v][i].fa]<=dep[lca]) continue;
        len+=fa[v][i].len;
        v=fa[v][i].fa;
    }
    v=fa[v][0].fa;
    len++;
    // cout<<" "<<v<<endl;
    if(v!=lca){
        ans=max(ans,dep[ru]+1+len+cnt[v]);
        // cout<<dep[ru]+1+len+cnt[v]<<endl;
    }
    }
}

int main(){
//    ios::sync_with_stdio(0);
//    cin.tie(0);
    memset(cnt,-0x3f,sizeof cnt);
    cin>>n>>m;
    for(int i=1;i<=n*2+1;i++){
        scanf("%s",s[i]+1);
    }
    int idx=0;
    dep[1]=1;
    for(int i=2;i<=2*n+1;i+=2){
        for(int j=2;j<=2*m+1;j+=2){
            id[i][j]=++idx;
        }
    }

    for(int i=2;i<=2*n+1;i+=2){
        for(int j=3;j<2*m+1;j+=2){
            int l=id[i][j-1],r=id[i][j+1];
            if(s[i][j]=='.'){
                e[l].push_back(r);
                e[r].push_back(l);
                // cout<<l<<" "<<r<<endl;
            }else{
                v.push_back({l,r});
            }
        }
    }
    for(int j=2;j<=2*m+1;j+=2){
        for(int i=3;i<2*n+1;i+=2){
            int l=id[i-1][j],r=id[i+1][j];
            if(s[i][j]=='.'){
                e[l].push_back(r);
                e[r].push_back(l);


                // cout<<l<<" "<<r<<endl;
            }else{
                v.push_back({l,r});
            }
        }
    }
    dfs(1,0);
    // ans=dep[n*m];
    // for(int i=1;i<=n;i++) cout<<dep[i]<<" ";
    // cout<<endl;
    int x=n*m;
    int res=0;
    while(x!=0){
        tf[x]=1;
        cnt[x]=res;
        res++;
        x=fa[x][0].fa;
    }
    for(int i=1;i<=n*m;i++){
        fa[i][0].tf=tf[fa[i][0].fa];
    }
    for(int i=1;i<20;i++){
        for(int j=1;j<=n*m;j++){
            int id1=j,id2=fa[j][i-1].fa;
            fa[j][i].fa=fa[id2][i-1].fa;
            fa[j][i].len=fa[id1][i-1].len+fa[id2][i-1].len;
            fa[j][i].tf=fa[id1][i-1].tf|fa[id2][i-1].tf;
        }
    }

    for(auto [x,y]:v){
        HuangGuangsheng(x,y);
    }
    assert(ans<=n*m);
    cout<<ans<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 20080kb

input:

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

output:

6

result:

ok single line: '6'

Test #2:

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

input:

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

output:

4

result:

ok single line: '4'

Test #3:

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

input:

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

output:

15

result:

ok single line: '15'

Test #4:

score: 0
Accepted
time: 148ms
memory: 98956kb

input:

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

output:

4693

result:

ok single line: '4693'

Test #5:

score: 0
Accepted
time: 157ms
memory: 96980kb

input:

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

output:

4191

result:

ok single line: '4191'

Test #6:

score: 0
Accepted
time: 161ms
memory: 99256kb

input:

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

output:

3846

result:

ok single line: '3846'

Test #7:

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

input:

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

output:

4856

result:

ok single line: '4856'

Test #8:

score: 0
Accepted
time: 145ms
memory: 97140kb

input:

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

output:

5829

result:

ok single line: '5829'

Test #9:

score: 0
Accepted
time: 7ms
memory: 26032kb

input:

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

output:

1147

result:

ok single line: '1147'

Test #10:

score: 0
Accepted
time: 7ms
memory: 27348kb

input:

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

output:

1388

result:

ok single line: '1388'

Test #11:

score: 0
Accepted
time: 7ms
memory: 27344kb

input:

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

output:

1046

result:

ok single line: '1046'

Test #12:

score: 0
Accepted
time: 13ms
memory: 25872kb

input:

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

output:

963

result:

ok single line: '963'

Test #13:

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

input:

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

output:

643

result:

ok single line: '643'

Test #14:

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

input:

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

output:

704

result:

ok single line: '704'

Test #15:

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

input:

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

output:

826

result:

ok single line: '826'

Test #16:

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

input:

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

output:

855

result:

ok single line: '855'

Test #17:

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

input:

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

output:

3

result:

ok single line: '3'

Test #18:

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

input:

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

output:

6

result:

ok single line: '6'

Test #19:

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

input:

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

output:

6

result:

ok single line: '6'

Test #20:

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

input:

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

output:

9

result:

ok single line: '9'

Test #21:

score: 0
Accepted
time: 165ms
memory: 102436kb

input:

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

output:

88013

result:

ok single line: '88013'

Test #22:

score: 0
Accepted
time: 175ms
memory: 103956kb

input:

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

output:

84655

result:

ok single line: '84655'

Test #23:

score: 0
Accepted
time: 169ms
memory: 104164kb

input:

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

output:

83534

result:

ok single line: '83534'

Test #24:

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

input:

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

output:

85862

result:

ok single line: '85862'

Test #25:

score: 0
Accepted
time: 169ms
memory: 103872kb

input:

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

output:

82727

result:

ok single line: '82727'

Test #26:

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

input:

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

output:

6917

result:

ok single line: '6917'

Test #27:

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

input:

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

output:

7130

result:

ok single line: '7130'

Test #28:

score: 0
Accepted
time: 7ms
memory: 26556kb

input:

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

output:

6342

result:

ok single line: '6342'

Test #29:

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

input:

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

output:

7093

result:

ok single line: '7093'

Test #30:

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

input:

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

output:

501

result:

ok single line: '501'

Test #31:

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

input:

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

output:

1012

result:

ok single line: '1012'

Test #32:

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

input:

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

output:

1144

result:

ok single line: '1144'

Test #33:

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

input:

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

output:

1273

result:

ok single line: '1273'

Test #34:

score: 0
Accepted
time: 196ms
memory: 103912kb

input:

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

output:

85163

result:

ok single line: '85163'

Test #35:

score: 0
Accepted
time: 197ms
memory: 103936kb

input:

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

output:

84679

result:

ok single line: '84679'

Test #36:

score: 0
Accepted
time: 187ms
memory: 104096kb

input:

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

output:

86302

result:

ok single line: '86302'

Test #37:

score: 0
Accepted
time: 190ms
memory: 103988kb

input:

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

output:

85720

result:

ok single line: '85720'

Test #38:

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

input:

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

output:

78639

result:

ok single line: '78639'

Test #39:

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

input:

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

output:

7005

result:

ok single line: '7005'

Test #40:

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

input:

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

output:

6640

result:

ok single line: '6640'

Test #41:

score: 0
Accepted
time: 13ms
memory: 25912kb

input:

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

output:

7616

result:

ok single line: '7616'

Test #42:

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

input:

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

output:

8025

result:

ok single line: '8025'

Test #43:

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

input:

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

output:

761

result:

ok single line: '761'

Test #44:

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

input:

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

output:

958

result:

ok single line: '958'

Test #45:

score: 0
Accepted
time: 5ms
memory: 22712kb

input:

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

output:

1446

result:

ok single line: '1446'

Test #46:

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

input:

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

output:

1599

result:

ok single line: '1599'

Test #47:

score: 0
Accepted
time: 243ms
memory: 107576kb

input:

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

output:

249999

result:

ok single line: '249999'

Test #48:

score: 0
Accepted
time: 183ms
memory: 112560kb

input:

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

output:

249999

result:

ok single line: '249999'

Test #49:

score: 0
Accepted
time: 186ms
memory: 106988kb

input:

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

output:

249500

result:

ok single line: '249500'

Test #50:

score: 0
Accepted
time: 196ms
memory: 110588kb

input:

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

output:

249500

result:

ok single line: '249500'

Test #51:

score: 0
Accepted
time: 236ms
memory: 108028kb

input:

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

output:

249001

result:

ok single line: '249001'

Test #52:

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

input:

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

output:

19999

result:

ok single line: '19999'

Test #53:

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

input:

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

output:

19594

result:

ok single line: '19594'

Test #54:

score: 0
Accepted
time: 13ms
memory: 26900kb

input:

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

output:

19998

result:

ok single line: '19998'

Test #55:

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

input:

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

output:

20497

result:

ok single line: '20497'

Test #56:

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

input:

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

output:

1999

result:

ok single line: '1999'

Test #57:

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

input:

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

output:

2500

result:

ok single line: '2500'

Test #58:

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

input:

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

output:

2994

result:

ok single line: '2994'

Test #59:

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

input:

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

output:

3493

result:

ok single line: '3493'

Test #60:

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

input:

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

output:

50349

result:

ok single line: '50349'

Test #61:

score: 0
Accepted
time: 179ms
memory: 111408kb

input:

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

output:

89603

result:

ok single line: '89603'

Test #62:

score: 0
Accepted
time: 186ms
memory: 110520kb

input:

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

output:

239186

result:

ok single line: '239186'

Test #63:

score: 0
Accepted
time: 174ms
memory: 108400kb

input:

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

output:

191538

result:

ok single line: '191538'

Test #64:

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

input:

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

output:

221145

result:

ok single line: '221145'

Test #65:

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

input:

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

output:

17473

result:

ok single line: '17473'

Test #66:

score: 0
Accepted
time: 7ms
memory: 26864kb

input:

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

output:

6372

result:

ok single line: '6372'

Test #67:

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

input:

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

output:

7444

result:

ok single line: '7444'

Test #68:

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

input:

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

output:

6107

result:

ok single line: '6107'

Test #69:

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

input:

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

output:

1537

result:

ok single line: '1537'

Test #70:

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

input:

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

output:

1502

result:

ok single line: '1502'

Test #71:

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

input:

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

output:

2000

result:

ok single line: '2000'

Test #72:

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

input:

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

output:

1923

result:

ok single line: '1923'

Test #73:

score: 0
Accepted
time: 152ms
memory: 98800kb

input:

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

output:

4523

result:

ok single line: '4523'

Test #74:

score: 0
Accepted
time: 150ms
memory: 99220kb

input:

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

output:

4717

result:

ok single line: '4717'

Test #75:

score: 0
Accepted
time: 148ms
memory: 97060kb

input:

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

output:

4026

result:

ok single line: '4026'

Test #76:

score: 0
Accepted
time: 157ms
memory: 99044kb

input:

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

output:

4690

result:

ok single line: '4690'

Test #77:

score: 0
Accepted
time: 156ms
memory: 99044kb

input:

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

output:

4787

result:

ok single line: '4787'

Test #78:

score: 0
Accepted
time: 7ms
memory: 27360kb

input:

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

output:

1129

result:

ok single line: '1129'

Test #79:

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

input:

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

output:

888

result:

ok single line: '888'

Test #80:

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

input:

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

output:

1038

result:

ok single line: '1038'

Test #81:

score: 0
Accepted
time: 7ms
memory: 27532kb

input:

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

output:

1355

result:

ok single line: '1355'

Test #82:

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

input:

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

output:

777

result:

ok single line: '777'

Test #83:

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

input:

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

output:

854

result:

ok single line: '854'

Test #84:

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

input:

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

output:

902

result:

ok single line: '902'

Test #85:

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

input:

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

output:

963

result:

ok single line: '963'

Test #86:

score: 0
Accepted
time: 146ms
memory: 99120kb

input:

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

output:

3031

result:

ok single line: '3031'

Test #87:

score: 0
Accepted
time: 152ms
memory: 99156kb

input:

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

output:

3882

result:

ok single line: '3882'

Test #88:

score: 0
Accepted
time: 152ms
memory: 99036kb

input:

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

output:

3126

result:

ok single line: '3126'

Test #89:

score: 0
Accepted
time: 149ms
memory: 98820kb

input:

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

output:

3153

result:

ok single line: '3153'

Test #90:

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

input:

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

output:

763

result:

ok single line: '763'

Test #91:

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

input:

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

output:

794

result:

ok single line: '794'

Test #92:

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

input:

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

output:

682

result:

ok single line: '682'

Test #93:

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

input:

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

output:

703

result:

ok single line: '703'

Test #94:

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

input:

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

output:

521

result:

ok single line: '521'

Test #95:

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

input:

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

output:

528

result:

ok single line: '528'

Test #96:

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

input:

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

output:

536

result:

ok single line: '536'

Test #97:

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

input:

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

output:

537

result:

ok single line: '537'

Test #98:

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

input:

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

output:

221

result:

ok single line: '221'

Test #99:

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

input:

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

output:

258

result:

ok single line: '258'

Test #100:

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

input:

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

output:

222

result:

ok single line: '222'

Test #101:

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

input:

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

output:

267

result:

ok single line: '267'

Test #102:

score: 0
Accepted
time: 5ms
memory: 18932kb

input:

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

output:

270

result:

ok single line: '270'

Test #103:

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

input:

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

output:

294

result:

ok single line: '294'