# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
294230 | 2020-09-08T17:32:27 Z | Lawliet | Nuclearia (CEOI15_nuclearia) | C++17 | 1000 ms | 280440 KB |
#include <bits/stdc++.h> using namespace std; typedef long long int lli; const int MAXN = 2500010; int n, m, k, q; vector<lli> v[MAXN], s[MAXN]; int main() { scanf("%d %d %d",&n,&m,&k); for(int i = 0 ; i <= n ; i++) v[i].resize( m + 1 , 0 ), s[i].resize( m + 1 , 0 ); for(int i = 1 ; i <= k ; i++) { int x, y, a, b; scanf("%d %d %d %d",&x,&y,&a,&b); for(int xa = 1 ; xa <= n ; xa++) { for(int ya = 1 ; ya <= m ; ya++) { lli dist = max( abs( x - xa ) , abs( y - ya ) ); lli value = a - b*dist; value = max( value , 0LL ); v[xa][ya] += value; } } } for(int i = 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + v[i][j]; scanf("%d",&q); while( q-- ) { int xa, ya, xb, yb; scanf("%d %d %d %d",&xa,&ya,&xb,&yb); lli sum = s[xb][yb] + s[xa - 1][ya - 1]; sum -= s[xb][ya - 1] + s[xa - 1][yb]; lli area = (xb - xa + 1)*(yb - ya + 1); lli ans = sum/area; if( (sum%area)*2 >= area ) ans++; printf("%lld\n",ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1064 ms | 274296 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1105 ms | 274424 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 359 ms | 157112 KB | Output is correct |
2 | Correct | 174 ms | 121864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 306 ms | 159096 KB | Output is correct |
2 | Correct | 181 ms | 122104 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 792 ms | 280440 KB | Output is correct |
2 | Correct | 192 ms | 122872 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1044 ms | 180344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 474 ms | 162808 KB | Output is correct |
2 | Correct | 183 ms | 122360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 779 ms | 155000 KB | Output is correct |
2 | Correct | 172 ms | 121780 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 274296 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 274552 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 157144 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 157048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1097 ms | 158112 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1087 ms | 157048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |