#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 time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
41816 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 |
92 ms |
44004 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
23624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
2636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
11632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
177 ms |
61236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
143 ms |
61236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
4436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
96 ms |
2388 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
107 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
96 ms |
4688 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |