Submission #1005276

# Submission time Handle Problem Language Result Execution time Memory
1005276 2024-06-22T09:35:48 Z Valaki2 Nuclearia (CEOI15_nuclearia) C++14
0 / 100
1000 ms 284564 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

struct plant {
    int x, y, a, b;
};

int w, h;
int n;
int q;

vector<vector<int> > rad;
vector<vector<int> > pref;
vector<plant> plants;

void solve() {
    cin >> w >> h;
    rad.assign(1 + w, vector<int> (1 + h, 0));
    pref.assign(1 + w, vector<int> (1 + h, 0));
    cin >> n;
    plants.resize(n);
    for(int i = 0; i < n; i++) {
        cin >> plants[i].x >> plants[i].y >> plants[i].a >> plants[i].b;
    }
    for(plant p : plants) {
        for(int i = 1; i <= w; i++) {
            for(int j = 1; j <= h; j++) {
                rad[i][j] += max(0ll, p.a - p.b * max(abs(i - p.x), abs(j - p.y)));
            }
        }
    }
    for(int i = 1; i <= w; i++) {
        for(int j = 1; j <= h; j++) {
            pref[i][j] = rad[i][j] + pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1];
        }
    }
    cin >> q;
    for(int i = 0; i < q; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        int total = pref[x2][y2] - pref[x2][y1 - 1] - pref[x1 - 1][y2] + pref[x1 - 1][y1 - 1];
        int area = (y2 - y1 + 1) * (x2 - x1 + 1);
        cout << round((double) total / (double) area) << "\n";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 404 ms 274256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 423 ms 274280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 40144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 42376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 417 ms 280400 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 508 ms 115696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 331 ms 45388 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 364 ms 61036 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 284332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 284564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 50472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 50164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 50608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 50000 KB Time limit exceeded
2 Halted 0 ms 0 KB -