Submission #886872

#TimeUsernameProblemLanguageResultExecution timeMemory
886872ndoshNuclearia (CEOI15_nuclearia)C++17
0 / 100
177 ms61236 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int w, h, n, q, p[2500005], s[2500005], pre[2500005]; signed main(){ cin.tie(0); ios_base::sync_with_stdio(0); cin >> w >> h >> n; for (int i = 1; i <= n; i++){ int x, y, a, b; cin >> x >> y >> a >> b; int num = a/b + 1; if (num == 1){ s[x] += a; s[x+1] -= a; continue; } if ((x - num + 1) < (int)1){ s[1] += a - b*(x-1); s[2] -= (a - b*(x-1)); s[2] += b; s[x+1] -= b; } else{ s[x-num+1] += a%b; s[x-num+2] -= a%b; s[x-num+2] += b; s[x+1] -= b; } s[x+1] -= b; if (x + num <= w){ s[x + num] += b - a%b; s[x+num+1] += a%b; } } int cur = 0; for (int i = 1; i <= w; i++){ cur += s[i]; p[i] = p[i-1] + cur; pre[i] = pre[i-1] + p[i]; } cin >> q; for (int i = 1; i <= q; i++){ int x, skillissue, y, skillissue2; cin >> x >> skillissue >> y >> skillissue2; int sm = pre[y] - pre[x-1]; int d = y-x+1; long double ans = (long double)sm/d; cout << (int)(round(ans)); } }
#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...