Submission #681093

# Submission time Handle Problem Language Result Execution time Memory
681093 2023-01-12T10:54:39 Z Cross_Ratio Nuclearia (CEOI15_nuclearia) C++14
21 / 100
1000 ms 276584 KB
#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int>> A, B;
array<long long int, 4> C[200005];
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int W, H;
    cin >> W >> H;
    A.resize(W+1);
    B.resize(W+1);
    int i, j;
    for(i=0;i<W+1;i++) {
        A[i].resize(H+1);
        B[i].resize(H+1);
    }
    int N;
    cin >> N;
    for(i=0;i<N;i++) {
        cin >> C[i][0] >> C[i][1] >> C[i][2] >> C[i][3];
        for(j=1;j<=W;j++) {
            for(int k = 1; k <= H; k++) {
                A[j][k] += max(0LL, C[i][2] - max(abs(j-C[i][0]),abs(k-C[i][1])) * C[i][3]);
            }
        }
    }
    for(i=1;i<=W;i++) {
        for(j=1;j<=H;j++) {
            B[i][j] = B[i-1][j] + B[i][j-1] - B[i-1][j-1] + A[i][j];
        }
    }
    int Q;
    cin >> Q;
    while(Q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        long long int val = B[c][d] - B[a-1][d] - B[c][b-1] + B[a-1][b-1];
        //cout << val << '\n';
        long long int x = (c-a+1)* (d-b+1);
        long long int y = val / x;
        if(2*(val % x) >= x) y++;
        cout << y << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 274324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 274316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 271 ms 39844 KB Output is correct
2 Correct 57 ms 2672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 227 ms 41556 KB Output is correct
2 Correct 54 ms 2728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 604 ms 276584 KB Output is correct
2 Correct 61 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 112292 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 326 ms 41976 KB Output is correct
2 Correct 60 ms 2928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 591 ms 57452 KB Output is correct
2 Correct 58 ms 2628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1104 ms 274368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1103 ms 274244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 39844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 39660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1102 ms 40716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 39852 KB Time limit exceeded
2 Halted 0 ms 0 KB -