Submission #77035

# Submission time Handle Problem Language Result Execution time Memory
77035 2018-09-20T08:06:03 Z win11905 Orchard (NOI14_orchard) C++11
0 / 25
206 ms 12592 KB
#include <bits/stdc++.h>
using namespace std;

int n, m, ans = 1e9;

int main() {
    scanf("%d %d", &n, &m);
    vector<vector<int>> dp(n+1, vector<int>(m+1));
    for(int i = 1; i <= n; ++i) for(int j = 1, ret; j <= m; ++j) scanf("%d", &ret), dp[i][j] = ret + dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
    for(int i = 0 ; i < n; ++i) for(int j = i+1; j <= n; ++j) {
        int mn = 1e9;
        for(int k = 1; k <= m; ++k) {
            mn = min(mn, 2 * (dp[j][k-1] - dp[i][k-1]) + (j - i) * (k-1));
            ans = min(ans, dp[n][m] - 2 * (dp[j][k] - dp[i][k]) + (j - i) * k + mn);
        }
    }
}

Compilation message

orchard.cpp: In function 'int main()':
orchard.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
orchard.cpp:9:83: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; ++i) for(int j = 1, ret; j <= m; ++j) scanf("%d", &ret), dp[i][j] = ret + dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 12592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 12592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 12592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 206 ms 12592 KB Output isn't correct
2 Halted 0 ms 0 KB -