# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
427253 | 2021-06-14T13:48:39 Z | model_code | Posters on the wall (CPSPC17_posters) | C++17 | 3500 ms | 1608 KB |
#include <bits/stdc++.h> using namespace std; #define inf 1023456789 #define linf 1023456789123456789ll #define pii pair<int,int> #define pipii pair<int, pii > #define pll pair<long long,long long> #define vint vector<int> #define vvint vector<vint > #define ll long long #define pdd pair<double, double> #define DEBUG #ifdef DEBUG #define db(x) cerr << #x << " = " << x << endl #else #define db(x) #endif int main() { int r, c, n, q; ll m; scanf("%d %d %d %d %lld", &r, &c, &n, &q, &m); vector<int> x1(n), y1(n), x2(n), y2(n); for(int i=0; i<n; i++) { scanf("%d %d %d %d", &x1[i], &y1[i], &x2[i], &y2[i]); if(x1[i] > x2[i]) swap(x1[i], x2[i]); if(y1[i] > y2[i]) swap(y1[i], y2[i]); } ll l = 0; for(int i=0; i<q; i++) { int xq1, yq1, xq2, yq2; ll v; scanf("%d %d %d %d %lld", &xq1, &yq1, &xq2, &yq2, &v); xq1 = (xq1 + l*v) % m; xq2 = (xq2 + l*v) % m; yq1 = (yq1 + l*v) % m; yq2 = (yq2 + l*v) % m; if(yq1 > yq2) swap(yq1, yq2); if(xq1 > xq2) swap(xq1, xq2); l = 0; for(int j=0; j<n; j++) { ll x_inter = max(0, min(x2[j], xq2) - max(x1[j], xq1)); ll y_inter = max(0, min(y2[j], yq2) - max(y1[j], yq1)); l += x_inter * y_inter; } printf("%lld\n", l); l %= m; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 204 KB | Output is correct |
4 | Correct | 77 ms | 368 KB | Output is correct |
5 | Correct | 80 ms | 372 KB | Output is correct |
6 | Correct | 71 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 204 KB | Output is correct |
4 | Correct | 77 ms | 368 KB | Output is correct |
5 | Correct | 80 ms | 372 KB | Output is correct |
6 | Correct | 71 ms | 332 KB | Output is correct |
7 | Execution timed out | 3593 ms | 1252 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 204 KB | Output is correct |
4 | Correct | 77 ms | 368 KB | Output is correct |
5 | Correct | 80 ms | 372 KB | Output is correct |
6 | Correct | 71 ms | 332 KB | Output is correct |
7 | Execution timed out | 3567 ms | 1608 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 2 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 204 KB | Output is correct |
4 | Correct | 77 ms | 368 KB | Output is correct |
5 | Correct | 80 ms | 372 KB | Output is correct |
6 | Correct | 71 ms | 332 KB | Output is correct |
7 | Execution timed out | 3593 ms | 1252 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3581 ms | 1348 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3581 ms | 1348 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |