Submission #151678

# Submission time Handle Problem Language Result Execution time Memory
151678 2019-09-04T06:26:05 Z phillip Strah (COCI18_strah) C++14
66 / 110
1000 ms 71096 KB
#include <bits/stdc++.h>

using namespace std;
int n,m;
long double l[2009][2009];
char gr[2009][2009];
long long ans;
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>gr[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=m-1;j>=0;j--)
        {
            if(gr[i][j]=='#')continue;
            l[i][j]=1+l[i][j+1];
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(l[i][j]==0)continue;
            long double mn=l[i][j];
            for(int k=i;k<n;k++)
            {
                mn=min(mn,l[k][j]);
                if(mn==0)break;
                long double r=(k-i+1);
                //if(r==1)ans+=(mn*(mn+1))/2;
                 ans+=(((mn*r)+r)/2.0)*mn;
            }
     //       cout<<i<<" "<<j<<"-> "<<ans<<"\n";
        }
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3576 KB Output is correct
2 Correct 31 ms 3708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3604 KB Output is correct
2 Correct 27 ms 3576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 168 ms 3672 KB Output is correct
2 Correct 28 ms 3576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 22788 KB Output is correct
2 Correct 767 ms 49100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 336 ms 47224 KB Output is correct
2 Execution timed out 1059 ms 68604 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 30348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 49 ms 15608 KB Output is correct
2 Execution timed out 1076 ms 60328 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 71096 KB Time limit exceeded
2 Halted 0 ms 0 KB -