# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
919024 |
2024-01-31T05:07:56 Z |
hungtien2202 |
Bob (COCI14_bob) |
C++14 |
|
1000 ms |
8536 KB |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m;
ll grid[1005][1005];
ll solve(int target) {
ll cnt = 0;
for (int l=1;l<=m;l++) {
vector<ll> heights(n, 0);
for (int r=l;r<=m;r++) {
for (int i=1;i<=n;i++) {
if (grid[i][r] == target) {
heights[i-1]++;
} else {
heights[i-1] = 0;
}
}
ll cur = 0;
for (int i=1;i<=n;i++) {
if (heights[i-1] == r - l + 1) {
cur++;
}
else {
cnt += cur*(cur+1) /2;
cur = 0;
}
}
cnt += cur*(cur+1) / 2;
}
}
return cnt;
}
int main() {
cin >> n >> m;
for (int i=1;i<=n;i++) {
for (int j=1;j<=m;j++) {
cin >> grid[i][j];
}
}
cout << solve(1) + solve(2);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
200 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
205 ms |
4952 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
213 ms |
4704 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
222 ms |
4944 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1022 ms |
8536 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
8272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1026 ms |
8272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1026 ms |
8528 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |