제출 #706683

#제출 시각아이디문제언어결과실행 시간메모리
706683Trisanu_Das과수원 (NOI14_orchard)C++17
25 / 25
214 ms13920 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, m, o = 0; cin >> n >> m; int a[n + 1][m + 1], pref[m + 1]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cin >> a[i][j]; if(a[i][j]) o++; else a[i][j] = -1; } } int ans = INT_MIN; for(int i = 1; i < n + 1; i++){ memset(pref, 0, sizeof(pref)); for(int j = i; j < n + 1; j++){ int s = 0; for(int k = 1; k <= m; k++){ pref[k] += a[j][k]; s = max(pref[k], s + pref[k]); ans = max(s, ans); } } } cout << o - ans << '\n'; }
#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...