# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
813207 | 2023-08-07T14:16:38 Z | JakobZorz | Nuclearia (CEOI15_nuclearia) | C++14 | 1000 ms | 33484 KB |
#include <stdio.h> #include <stdlib.h> #define MAXWH 10000000 #define MAXN 1000000 #define MAXQ 1000000 typedef long long int huge; int w, h, n, q; typedef struct NUCLEARIA { huge Info[MAXWH]; huge& operator () (int x, int y) {return Info[(y * w) + x];} } NUCLEARIA; typedef struct PLANT { int x; int y; int a; int b; } PLANT; typedef struct QUERY { int x1; int y1; int x2; int y2; } QUERY; NUCLEARIA Nuclearia; PLANT Plant[MAXN]; QUERY Query[MAXQ]; int max(int a, int b) { return (a > b) ? a : b; } int abs(int a) { return (a < 0) ? -a : a; } int dist(int x1, int y1, int x2, int y2) { return max(abs(x1 - x2), abs(y1 - y2)); } void Print(huge sum, int area) { huge rsl = sum / area; if((sum % area) * 2 >= area) { rsl++; } printf("%lld\n", rsl); } int main() { scanf("%d%d", &w, &h); scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%d%d%d%d", &(Plant[i].x), &(Plant[i].y), &(Plant[i].a), &(Plant[i].b)); Plant[i].x--; Plant[i].y--; } scanf("%d", &q); for(int i = 0; i < q; i++) { scanf("%d%d%d%d", &(Query[i].x1), &(Query[i].y1), &(Query[i].x2), &(Query[i].y2)); Query[i].x1--; Query[i].y1--; } for(int i = 0; i < n; i++) { PLANT& P = Plant[i]; for(int x = 0; x < w; x++) { for(int y = 0; y < h; y++) { int d = dist(x, y, P.x, P.y); if(P.a > huge(d) * P.b) { Nuclearia(x, y) += P.a - (d * P.b); } } } } for(int i = 0; i < q; i++) { QUERY& Q = Query[i]; huge rsl = 0; for(int x = Q.x1; x < Q.x2; x++) { for(int y = Q.y1; y < Q.y2; y++) { rsl += Nuclearia(x, y); } } Print(rsl, (Q.x2 - Q.x1) * (Q.y2 - Q.y1)); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 302 ms | 19860 KB | Output is correct |
2 | Correct | 61 ms | 7640 KB | Output is correct |
3 | Correct | 52 ms | 6936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 313 ms | 19860 KB | Output is correct |
2 | Correct | 62 ms | 7736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 231 ms | 19864 KB | Output is correct |
2 | Correct | 63 ms | 7368 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 691 ms | 19876 KB | Output is correct |
2 | Correct | 60 ms | 7728 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1092 ms | 26740 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1069 ms | 14752 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1068 ms | 26340 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1056 ms | 14620 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1050 ms | 33484 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1064 ms | 33472 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1072 ms | 33400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1071 ms | 33384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1075 ms | 33040 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 33072 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |