#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;
float ans = (float)sm/d;
cout << (int)(round(ans));
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
41820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 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 |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
79 ms |
43688 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
23716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
11604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
156 ms |
61236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
139 ms |
61264 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
4436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
94 ms |
2520 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
4924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |