# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1115106 |
2024-11-20T04:17:30 Z |
duytuandao21 |
Bob (COCI14_bob) |
C++17 |
|
175 ms |
35304 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 7;
const int inf = 1e9 + 7;
typedef pair<int, int> pii;
int n, m;
int a[2000][2000], b[2000][2000];
int bit[2000][2000];
void update(int u, int v, int val) {
for (int i = u; i <= n; i += (i & (-i)))
for (int j = v; j <= m; j += (j & (-j))) bit[i][j] += val;
}
int get(int u, int v) {
int ans = 0;
for (int i = u; i > 0; i -= (i & (-i)))
for (int j = v; j > 0; j -= (j & (-j))) ans += bit[i][j];
return ans;
}
int cal(int x, int y, int u, int v) {
return get(u, v) - get(u, y - 1) - get(x - 1, v) + get(x - 1, y - 1);
}
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// freopen("test.inp","r",stdin);
// freopen("test.out","w",stdout);
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
int x;
scanf("%lld", &x);
a[i][j] = x;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
for (int k = j; k <= m + 1; k++) {
if (a[i][k] != a[i][j]) {
b[i][j] = k - 1;
break;
}
}
}
}
int res = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
int minCol = inf;
for (int k = i; k <= n; k++) {
if (a[k][j] != a[i][j]) break;
minCol = min(minCol, b[k][j]);
res += minCol - j + 1;
}
}
}
cout << res;
}
Compilation message
bob.cpp: In function 'int main()':
bob.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
35 | scanf("%lld", &x);
| ~~~~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
4432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
18768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
19084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
18768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
18768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
104 ms |
35292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
117 ms |
35144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
175 ms |
35304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
153 ms |
35144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |