Submission #1078572

#TimeUsernameProblemLanguageResultExecution timeMemory
1078572avighnaArcade (NOI20_arcade)C++17
51 / 100
420 ms1048576 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 + 1); std::vector<ll> t(m + 1), a(m + 1); for (ll i = 1; i <= m; ++i) { std::cin >> t[i]; pts[i].x = t[i]; } for (ll i = 1; i <= m; ++i) { std::cin >> a[i]; pts[i].y = a[i]; } for (auto &i : pts) { i.transform(); } std::sort(pts.begin(), pts.end(), [](Point a, Point b) { return a.x < b.x; }); pts[0].x = -1e15, pts[0].y = -1e15; std::vector<std::vector<ll>> dp(m + 2, std::vector<ll>(m + 2)); for (ll i = m; i >= 1; --i) { for (ll j = m; j >= 0; --j) { dp[i][j] = dp[i + 1][j]; if (pts[i].x > pts[j].x and pts[i].y > pts[j].y) { dp[i][j] = std::max(dp[i][j], dp[i + 1][i] + 1); } } } std::cout << dp[1][0] << '\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...