# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124512 | 2019-07-03T13:08:12 Z | deinfreund | Orchard (NOI14_orchard) | C++14 | 476 ms | 112008 KB |
#include <bits/stdc++.h> using namespace std; int solve1D(vector<int> vals){ vector<int> sums(vals.size()); int totalTrees; for (int x= 0; x < vals.size(); x++){ /*cin >> vals[x][y]; totalTrees[y] += vals[x][y]; vals[x][y] = 2 * vals[x][y] - 1; if (x > 0) sums[x][y] += sums[x-1][y]; sums[x][y] += vals[x][y];*/ } } int main(){ int h, w; cin >> h >> w; vector<vector<int> > sums(w, vector<int>(h)); vector<int> totalTrees(h); vector<vector<int> > vals(w, vector<int>(h)); for (int y = 0; y< h; y++){ for (int x= 0; x < w; x++){ cin >> vals[x][y]; totalTrees[y] += vals[x][y]; vals[x][y] = 2 * vals[x][y] - 1; if (x > 0) sums[x][y] += sums[x-1][y]; sums[x][y] += vals[x][y]; } } for (int y = 0; y< h; y++){ int minv = 0; int minx = -1; int bests = 0; int beste = 0; int bestv = 0; for (int x= 0; x < w; x++){ if (sums[x][y] < minv){ minv = sums[x][y]; minx = x; } int v = sums[x][y] - minv; if (v > bestv){ bestv = v; bests = minx; beste = x; } } //cout << bests << " - " << beste << ": " << bestv << endl; cout << totalTrees[y] - bestv + beste - bests - bestv << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 2040 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 476 ms | 112008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 74 ms | 11640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 218 ms | 7976 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |