# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
386949 | 2021-04-07T16:40:33 Z | FatihSolak | Nuclearia (CEOI15_nuclearia) | C++17 | 1000 ms | 237744 KB |
#include <bits/stdc++.h> using namespace std; int main(){ #ifdef Local freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif bool swp = 0; int w,h; scanf("%d %d",&w,&h); if(w < h){ swp = 1; swap(w,h); } long long arr[h+5][w+5]; long long pre[h+5][w+5]; for(int i=0;i<h+5;i++){ for(int j = 0;j<w+5;j++){ arr[i][j] = pre[i][j] = 0; } } int n; scanf("%d ",&n); for(int i=0;i<n;i++){ int x,y,a,b; scanf("%d %d %d %d",&x,&y,&a,&b); if(swp)swap(x,y); for(int i=1;i<=h;i++){ int dif = abs(y-i); if(dif * b >= a)continue; arr[i][max(1,x-dif+1)] -= b; arr[i][max(1,x-((a+b-1)/b))] += b; arr[i][max(1,x-((a+b-1)/b))] += a - b*(x - max(1,x-((a+b-1)/b)) + 1); arr[i][max(1,x-((a+b-1)/b)) + 1] -= a - b*(x - max(1,x-((a+b-1)/b)) + 1); arr[i][min(w+1,x+dif+1)] -= b; arr[i][min(w+1,x+((a+b-1)/b)+1)] += b; arr[i][min(w+1,x+((a+b-1)/b))] += (b - a%b)%b; arr[i][min(w+1,x+((a+b-1)/b)+1)] -= (b - a%b)%b; } } for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ arr[i][j] += arr[i][j-1]; } for(int j=1;j<=w;j++){ arr[i][j] += arr[i][j-1]; } } for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ pre[i][j] = pre[i-1][j] + pre[i][j-1] - pre[i-1][j-1]+arr[i][j]; } } int q; scanf("%d",&q); while(q--){ int x1,y1,x2,y2; scanf("%d %d %d %d",&x1,&y1,&x2,&y2); if(!swp)swap(x1,y1),swap(x2,y2); long double cnt = (x2-x1+1) * (y2 -y1+1); long long x = ((pre[x2][y2] - pre[x2][y1-1] - pre[x1 -1][y2] + pre[x1-1][y1-1])/cnt + 0.5); printf("%lld\n",x); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 164 ms | 235116 KB | Output is correct |
2 | Correct | 92 ms | 2796 KB | Output is correct |
3 | Correct | 86 ms | 2532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 158 ms | 235100 KB | Output is correct |
2 | Incorrect | 92 ms | 2796 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 39916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 55 ms | 49260 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 294 ms | 237420 KB | Output is correct |
2 | Correct | 95 ms | 3052 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 210 ms | 96804 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 211 ms | 42348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 175 ms | 57452 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 409 ms | 237744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 411 ms | 237548 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1070 ms | 39916 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1087 ms | 39660 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 41068 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1089 ms | 39916 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |