# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
892151 |
2023-12-25T02:03:32 Z |
vjudge1 |
Bob (COCI14_bob) |
C++17 |
|
571 ms |
10340 KB |
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+7, inf=1e9+7;
int m, n, a[N][N], b[N][N];
long long res=0;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>m>>n;
for(int i=1; i<=m; i++)
for(int j=1; j<=n; j++)
cin>>a[i][j];
for(int i=1; i<=m; i++)
for(int j=1; j<=n; j++) b[i][j]=1;
for(int i=1; i<=m; i++)
for(int j=1; j<=n; j++)
{
if(a[i][j]==a[i-1][j]) b[i][j]=b[i-1][j]+1;
}
for(int i=1; i<=m; i++)
for(int j=1; j<=n; j++)
{
int tmp=inf;
for(int k=j; k>=1; k--)
{
if(a[i][k]!=a[i][k+1]&&k!=j) break;
tmp=min(tmp, b[i][k]);
res+=tmp;
}
}
cout<<res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
6748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
6748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
6620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
6748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
79 ms |
8288 KB |
Output is correct |
2 |
Correct |
515 ms |
8360 KB |
Output is correct |
3 |
Correct |
570 ms |
10340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
8148 KB |
Output is correct |
2 |
Correct |
233 ms |
8284 KB |
Output is correct |
3 |
Correct |
566 ms |
10304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
150 ms |
8276 KB |
Output is correct |
2 |
Correct |
565 ms |
10308 KB |
Output is correct |
3 |
Correct |
568 ms |
10304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
117 ms |
8352 KB |
Output is correct |
2 |
Correct |
549 ms |
8352 KB |
Output is correct |
3 |
Correct |
571 ms |
10300 KB |
Output is correct |