Submission #1078594

#TimeUsernameProblemLanguageResultExecution timeMemory
1078594avighnaArcade (NOI20_arcade)C++17
100 / 100
149 ms8660 KiB
#include <bits/stdc++.h> typedef long long ll; struct Point { ll x, y; void transform() { ll u = y + x, v = y - x; x = u, y = v; } }; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); ll n, m; std::cin >> n >> m; std::vector<Point> pts(m); for (ll i = 0; i < m; ++i) { std::cin >> pts[i].x; } for (ll i = 0; i < m; ++i) { std::cin >> pts[i].y; } for (auto &i : pts) { i.transform(); } std::sort(pts.begin(), pts.end(), [](Point a, Point b) { if (a.x != b.x) { return a.x < b.x; } return a.y > b.y; }); std::vector<ll> dp; for (ll i = 0; i < m; ++i) { auto it = std::lower_bound(dp.begin(), dp.end(), pts[i].y); if (it == dp.end()) { dp.push_back(pts[i].y); } else { dp[it - dp.begin()] = pts[i].y; } } std::cout << dp.size() << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...