# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
124529 | 2019-07-03T13:26:12 Z | johutha | 과수원 (NOI14_orchard) | C++14 | 278 ms | 15992 KB |
#include <iostream> #include <vector> #define int int64_t using namespace std; struct orchard { vector<vector<int>> orchard; int n, m; int calc() { for (int i = 0; i < n; i++) { int currsum = 0; int mmin = 0; int mp = -1; int mdiff = 0; int msp = 0; int me = 0; for (int j = 0; j < m; j++) { currsum += (orchard[i][j]) - (!orchard[i][j]); if (currsum < mmin) { mmin = currsum; mp = j; } if (currsum - mmin > mdiff) { msp = mp; mdiff = currsum - mmin; me = j; } } currsum = 0; for (int j = 0; j < m; j++) { if (j <= msp || j > me) currsum += (orchard[i][j]); else currsum += (!orchard[i][j]); } return currsum; } } }; signed main() { int n, m; cin >> n >> m; orchard orch; orch.n = n; orch.m = m; orch.orchard.resize(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> orch.orchard[i][j]; } } cout << orch.calc() << "\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 504 KB | Output is correct |
2 | Correct | 6 ms | 504 KB | Output is correct |
3 | Correct | 6 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 269 ms | 15992 KB | Output is correct |
2 | Correct | 278 ms | 15992 KB | Output is correct |
3 | Correct | 269 ms | 15992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 56 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 186 ms | 6276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |