Submission #66108

#TimeUsernameProblemLanguageResultExecution timeMemory
66108bazsi700Nuclearia (CEOI15_nuclearia)C++14
0 / 100
1106 ms150276 KiB
#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]; } } int are = (y2-y1+1)*(x2-x1+1); int an = ans/are; if(ans-an*are >= (an+1)*are-ans) { an++; } cout << an << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...