Submission #1115080

# Submission time Handle Problem Language Result Execution time Memory
1115080 2024-11-20T02:58:44 Z duytuandao21 Bob (COCI14_bob) C++17
0 / 120
1000 ms 40524 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 2e5 + 7;
typedef pair<int, int> pii;

int n, m;
int a[2000][2000], s[2000][2000];

int getSum(int i, int j, int u, int v) {
    return s[u][v] - s[u][j - 1] - s[i - 1][v] + s[i - 1][j - 1];
}
int getNum(int i, int j, int u, int v) {
    return (u - i + 1) * (v - j + 1);
}
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) 
        for (int j = 1; j <= m; j++) cin >> a[i][j];
    for (int i = 1; i <= n; i++) 
        for (int j = 1; j <= m; j++) s[i][j]= a[i][j] + s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
    
    int res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            for (int ki = i; ki <= n; ki++) {
                for (int kj = j; kj <= m; kj++) {
                    if (getSum(i, j, ki, kj) == getNum(i, j, ki, kj) * a[i][j]) res++;
                }
            }
        }
    }
    cout << res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 13136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 13392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 13652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 13684 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 37448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 40524 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 40276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 40520 KB Time limit exceeded
2 Halted 0 ms 0 KB -