Submission #78666

# Submission time Handle Problem Language Result Execution time Memory
78666 2018-10-07T01:19:25 Z thebes Orchard (NOI14_orchard) C++14
25 / 25
231 ms 13604 KB
#include <bits/stdc++.h>
using namespace std;

const int MN = 155;
int ans[MN][MN], n, m, i, j, k, x, y, tot, opt;
bitset<100005> arr[MN];

int main(){
    for(scanf("%d%d",&n,&m),i=1;i<=n;i++){
        for(j=1;j<=m;j++){
            scanf("%d",&x);
            arr[i][j] = (x);
            if(x) tot++;
        }
    }
    for(i=1;i<=m;i++){
        for(j=1;j<=n;j++){
            int tmp = 0;
            for(k=j;k<=n;k++){
                tmp+=(arr[k][i])? 1:-1;
                ans[j][k]=max(ans[j][k]+tmp,0);
                opt = max(opt, ans[j][k]);
            }
        }
    }
    printf("%d\n",tot-opt);
    return 0;
}

Compilation message

orchard.cpp: In function 'int main()':
orchard.cpp:9:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(scanf("%d%d",&n,&m),i=1;i<=n;i++){
         ~~~~~~~~~~~~~~~~~~~^~~~
orchard.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&x);
             ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Correct 2 ms 796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1036 KB Output is correct
2 Correct 4 ms 1036 KB Output is correct
3 Correct 3 ms 1036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 103 ms 3220 KB Output is correct
2 Correct 103 ms 5224 KB Output is correct
3 Correct 104 ms 7184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 7456 KB Output is correct
2 Correct 22 ms 7908 KB Output is correct
3 Correct 22 ms 8256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8692 KB Output is correct
2 Correct 9 ms 9112 KB Output is correct
3 Correct 8 ms 9112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 231 ms 10704 KB Output is correct
2 Correct 203 ms 12136 KB Output is correct
3 Correct 215 ms 13604 KB Output is correct