# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
676469 | 2022-12-31T03:32:42 Z | penguin133 | Orchard (NOI14_orchard) | C++17 | 191 ms | 10060 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int r,c; cin >> r >> c; int g[r][c]; long long a=0,b=0; string s; for(int i=0;i<r;i++){ for(int j=0;j<c;j++){ cin >> g[i][j]; if(g[i][j] == 1){ b++; } else{ g[i][j] = -1; } } } long long cnt= 0; long long maxi = 0; int d = -1; int e = -1; int d1=-1, e1 = -1; long long mini = 1e18 + 5; for(int i=0;i<r;i++){ int cnt2[c]; for(int x=0;x<c;x++){ cnt2[x] = g[i][x]; } for(int j=i;j<r;j++){ if(j != i){ for(int x=0;x<c;x++){ cnt2[x] += g[j][x]; } } cnt = 0; for(int k=0;k<c;k++){ cnt += cnt2[k]; if(cnt > maxi){ maxi = cnt; } if(cnt < 0){ cnt = 0; } } } } cout << b - maxi; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 3 ms | 340 KB | Output is correct |
3 | Correct | 3 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 138 ms | 10060 KB | Output is correct |
2 | Correct | 141 ms | 10060 KB | Output is correct |
3 | Correct | 136 ms | 10060 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 1816 KB | Output is correct |
2 | Correct | 28 ms | 1824 KB | Output is correct |
3 | Correct | 27 ms | 1816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 308 KB | Output is correct |
2 | Correct | 6 ms | 340 KB | Output is correct |
3 | Correct | 6 ms | 416 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 189 ms | 4600 KB | Output is correct |
2 | Correct | 191 ms | 4604 KB | Output is correct |
3 | Correct | 185 ms | 4692 KB | Output is correct |