Submission #22809

#TimeUsernameProblemLanguageResultExecution timeMemory
22809dried chocochip on Daegu asphalt (#40)Donut-shaped Enclosure (KRIII5_DE)C++98
0 / 7
6 ms5028 KiB
// // 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)

DE.cpp: In function 'int main()':
DE.cpp:12:47: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N, L, R; scanf("%d %d %d", &N, &L, &R);
                                               ^
DE.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &r, &c, &x);
                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...