# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
17432 |
2015-12-11T07:13:25 Z |
choyi0521 |
Bob (COCI14_bob) |
C++ |
|
572 ms |
9536 KB |
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX_N=1000;
int n,m,a[MAX_N][MAX_N],h[MAX_N][MAX_N+1];
long long int ans;
int main(){
cin >> m >> n;
for(int i=0; i<n; i++)
for(int j=0; j<m; j++)
cin >> a[i][j];
fill(h[0],h[0]+m,1);
for(int i=1; i<n; i++)
for(int j=0; j<m; j++)
h[i][j]=(a[i][j]==a[i-1][j])*h[i-1][j]+1;
int st1[MAX_N],st2[MAX_N];
for(int i=0; i<n; i++){
for(int j=0,top=0; j<=n; j++){
while(top&&(st1[top-1]>h[i][j]||a[i][st2[top-1]]!=a[i][j]))
ans+=st1[--top]*(j-st2[top]);
st1[top]=h[i][j];
st2[top++]=j;
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
9536 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
9536 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
9536 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
79 ms |
9536 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
9536 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
9536 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
428 ms |
9536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
572 ms |
9536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
541 ms |
9536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
514 ms |
9536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |