#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;
}
}
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;
float ans = (float)sm/d;
cout << (int)(round(ans));
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
41820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
45660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
43604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
23772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
57 ms |
2464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
11624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
149 ms |
61264 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
140 ms |
61264 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
4736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
92 ms |
2504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
91 ms |
2500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
92 ms |
4588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |