# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
469140 |
2021-08-30T21:47:21 Z |
ala2 |
Bob (COCI14_bob) |
C++14 |
|
527 ms |
24016 KB |
#include <bits/stdc++.h>
#define ff first
#define ss second
#define int long long
using namespace std;
int a[1010][1010];
int dpr[1010][1010];
int dpc[1010][1010];
signed main()
{
int n;
cin>>n;
int m;
cin>>m;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
cin>>a[i][j];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
dpc[i][j]=1;
dpr[i][j]=1;
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(i>0)
{
if(a[i][j]==a[i-1][j])
{
dpr[i][j]=dpr[i-1][j]+1;
}
}
if(j>0)
{
if(a[i][j]==a[i][j-1])
{
dpc[i][j]=dpc[i][j-1]+1;
}
}
}
}// ff for c ss for r
int ans=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{ //cout<<dpr[i][j]<<" ";
int mn=1e17;
ans+=dpr[i][j];
for(int k=j-1;k>=0;k--)
{
if(a[i][k]!=a[i][k+1])
break;
mn=min(mn,dpr[i][k]);
ans+=mn;
}
// cout<<" :"<<ans<<" ";
}
// cout<<endl;
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
844 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
844 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
12116 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
12140 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
12040 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
12020 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
378 ms |
23916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
459 ms |
24016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
527 ms |
23996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
482 ms |
23992 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |