제출 #727918

#제출 시각아이디문제언어결과실행 시간메모리
727918rainboyOrchard (NOI14_orchard)C11
25 / 25
173 ms6108 KiB
#include <stdio.h> #define NM 1000000 int min(int a, int b) { return a < b ? a : b; } int main() { static int aa[NM]; int n, m, i, i1, i2, j, k, sum, ans; scanf("%d%d", &n, &m); k = 0; for (i = 0; i < n; i++) for (j = 0; j < m; j++) { int a; scanf("%d", &a); if (a == 1) aa[i * m + j] = -1, k++; else aa[i * m + j] = 1; } for (j = 0; j < m; j++) for (i = 1; i < n; i++) aa[i * m + j] += aa[(i - 1) * m + j]; ans = n * m; for (i1 = 0; i1 < n; i1++) for (i2 = i1; i2 < n; i2++) { sum = 0; for (j = 0; j < m; j++) { sum = min(sum + aa[i2 * m + j] - (i1 == 0 ? 0 : aa[(i1 - 1) * m + j]), 0); ans = min(ans, k + sum); } } printf("%d\n", ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

orchard.c: In function 'main':
orchard.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
orchard.c:17:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |    scanf("%d", &a);
      |    ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...