# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
681108 | 2023-01-12T11:05:02 Z | Cross_Ratio | Nuclearia (CEOI15_nuclearia) | C++14 | 1000 ms | 80712 KB |
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") using namespace std; long long int A[2500002][2]; long long int B[2500002][2]; array<long long int, 4> C[200005]; signed main() { cin.sync_with_stdio(false); cin.tie(0); cout.tie(0); int W, H; cin >> W >> H; int i, j; int N; cin >> N; for(i=0;i<N;i++) { cin >> C[i][0] >> C[i][1] >> C[i][2] >> C[i][3]; C[i][0]--, C[i][1]--; for(j=0;j<W;j++) { for(register int k = 0; k < H; k++) { A[j][k] += max(0LL, C[i][2] - max(abs(j-C[i][0]),abs(k-C[i][1])) * C[i][3]); } } } for(i=0;i<W;i++) { for(j=0;j<H;j++) { B[i][j] = (i?B[i-1][j]:0) + (j?B[i][j-1]:0) - ((long long int)i*j?B[i-1][j-1]:0) + A[i][j]; } } int Q; cin >> Q; while(Q--) { long long int a, b, c, d; cin >> a >> b >> c >> d; a--, b--, c--, d--; long long int val = B[c][d] - (a?B[a-1][d]:0) - (b?B[c][b-1]:0) + (a*b?B[a-1][b-1]:0); //cout << val << '\n long long int x = (c-a+1)* (d-b+1); long long int y = val / x; if(2*(val % x) >= x) y++; cout << y << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 264 ms | 78556 KB | Output is correct |
2 | Correct | 55 ms | 4616 KB | Output is correct |
3 | Correct | 50 ms | 3888 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 292 ms | 78480 KB | Output is correct |
2 | Correct | 77 ms | 4660 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 163 ms | 396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 152 ms | 1236 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 203 ms | 80712 KB | Output is correct |
2 | Correct | 60 ms | 5324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 349 ms | 34024 KB | Output is correct |
2 | Correct | 54 ms | 4624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 207 ms | 1152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 258 ms | 18336 KB | Output is correct |
2 | Incorrect | 62 ms | 4300 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1089 ms | 39448 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1099 ms | 39452 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1059 ms | 404 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1093 ms | 496 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1077 ms | 476 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |