Submission #681091

# Submission time Handle Problem Language Result Execution time Memory
681091 2023-01-12T10:52:53 Z Cross_Ratio Nuclearia (CEOI15_nuclearia) C++14
21 / 100
1000 ms 280236 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<vector<int>> A, B;
array<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;
        int val = B[c][d] - B[a-1][d] - B[c][b-1] + B[a-1][b-1];
        //cout << val << '\n';
        int x = (c-a+1)* (d-b+1);
        int y = val / x;
        if(2*(val % x) >= x) y++;
        cout << y << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1105 ms 274316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 274300 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 307 ms 39852 KB Output is correct
2 Correct 53 ms 4280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 41556 KB Output is correct
2 Correct 54 ms 4624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 676 ms 280236 KB Output is correct
2 Correct 64 ms 5312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 115724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 345 ms 45248 KB Output is correct
2 Correct 65 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 670 ms 60912 KB Output is correct
2 Correct 55 ms 4280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 274244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1102 ms 274324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 39896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 39716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 40788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 39900 KB Time limit exceeded
2 Halted 0 ms 0 KB -