# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85376 | 2018-11-19T14:07:34 Z | tjdgus4384 | None (KOI18_matrix) | C++14 | 9 ms | 1148 KB |
#include<cstdio> #include<vector> #include<algorithm> using namespace std; vector<pair<int, pair<int, int> > > v; vector<int> vf; vector<int> vs; int main() { int m, n, x; scanf("%d %d",&m, &n); v.resize(n); for(int i = 0;i < m;i++) { for(int j = 0;j < n;j++) { scanf("%d", &x); if(i == 0) v[j].first = x; if(i == 1) v[j].second.first = x; if(i == 2) v[j].second.second = x; if(i == 0 && m == 2) v[j].second.second = v[j].first; } } sort(v.begin(), v.end()); vf.push_back({-1000000000}); vs.push_back({-1000000000}); for(int i = 0;i < n;i++) { int f = v[i].second.first; int s = v[i].second.second; if(f > vf.back() && s > vs.back()) { vf.push_back(f); vs.push_back(s); } else if(f < vf.back() && s < vs.back()) { int fx = lower_bound(vf.begin(), vf.end(), f) - vf.begin(); int sx = lower_bound(vs.begin(), vs.end(), s) - vs.begin(); fx = max(fx, sx); sx = fx; vf[fx] = f; vs[sx] = s; } } printf("%d", vf.size() - 1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 660 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 1148 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 660 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 1148 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |