# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22809 | dried chocochip on Daegu asphalt (#40) | Donut-shaped Enclosure (KRIII5_DE) | C++98 | 6 ms | 5028 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//
// Created by Acka on 2017. 4. 30..
//
#include <stdio.h>
#include <algorithm>
using namespace std;
int acc[1001][1001];
int main(){
int N, L, R; scanf("%d %d %d", &N, &L, &R);
for(int i = 0, r, c, x; i < N; i++){
scanf("%d %d %d", &r, &c, &x);
acc[r][c] += x;
}
for(int i = 1; i <= 1000; i++)
for(int j = 1; j <= 1000; j++)
acc[i][j] = acc[i - 1][j] + acc[i][j - 1] - acc[i - 1][j - 1] + acc[i][j];
int b1, r1, t2, l2, b2, r2, out, in, ans = -1;
for(int t1 = 1; t1 <= 1000; t1++) {
if(1000 < (b1 = (t1 + 2 * R))) break;
for (int l1 = 1; l1 <= 1000; l1++) {
if(1000 < (r1 = (l1 + 2 * R))) break;
t2 = t1 + R - L + 1, l2 = l1 + R - L + 1;
b2 = t1 + R + L - 1, r2 = l1 + R + L - 1;
out = acc[b1][r1] - acc[t1 - 1][r1] - acc[b1][l1 - 1] + acc[t1 - 1][l1 - 1];
in = acc[b2][r2] - acc[t2 - 1][r2] - acc[b2][l2 - 1] + acc[t2 - 1][l2 - 1];
ans = max(ans, out - in);
}
}
printf("%d\n", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |