Submission #66109

# Submission time Handle Problem Language Result Execution time Memory
66109 2018-08-09T15:04:38 Z bazsi700 Nuclearia (CEOI15_nuclearia) C++14
10 / 100
1000 ms 151380 KB
#include <bits/stdc++.h>

using namespace std;
#define ll long long

//14:20

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w,n,q;
    cin >> w >> h >> n;
    vector<pair<pair<int,int>,pair<ll,ll> > > plant(n);
    for(int i = 0; i < n; i++) {
        cin >> plant[i].first.first >> plant[i].first.second >> plant[i].second.first >> plant[i].second.second;
    }
    vector<vector<ll> > table(w+2,vector<ll>(h+2,0));
    for(int i = 1; i <= w; i++) {
        for(int j = 1; j <= h; j++) {
            for(int p = 0; p < n; p++) {
                table[i][j]+= max(0LL,plant[p].second.first-plant[p].second.second*(max(abs(i-plant[p].first.first),abs(j-plant[p].first.second))));
            }
        }
    }
    //vector<vector<ll> > table(h+2,vector<ll>(w+2));
    cin >> q;
    while(q--) {
        int x1,x2,y1,y2;
        cin >> x1 >> y1 >> x2 >> y2;
        ll ans = 0;
        for(int i = x1; i <= x2; i++) {
            for(int j = y1; j <= y2; j++) {
                ans+= table[i][j];
            }
        }
        ll are = (y2-y1+1)*(x2-x1+1);
        ll an = ans/are;
        if(ans-an*are >= (an+1)*are-ans) {
            an++;
        }
        cout << an << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 847 ms 137336 KB Output is correct
2 Correct 103 ms 137336 KB Output is correct
3 Correct 95 ms 137336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 940 ms 140976 KB Output is correct
2 Correct 129 ms 140976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 410 ms 140976 KB Output is correct
2 Correct 103 ms 140976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 449 ms 140976 KB Output is correct
2 Correct 92 ms 140976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 146748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 146748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 146748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 146748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1107 ms 151380 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 151380 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 151380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 151380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 151380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 151380 KB Time limit exceeded
2 Halted 0 ms 0 KB -