제출 #1322928

#제출 시각아이디문제언어결과실행 시간메모리
1322928aaaaaaaaAdvertisement 2 (JOI23_ho_t2)C++20
0 / 100
0 ms332 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() const int inf = 1e18; signed main(){ ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<pair<int, int>> v; for(int i = 1, x, e; i <= n; ++i){ cin >> x >> e; v.push_back({x - e, x + e}); } sort(all(v)); vector<int> dp(n + 5, 1); for(int i = 0; i < n; ++i){ for(int j = i - 1; j >= 0; --j){ if(v[j].second > v[i].second){ dp[i] = max(dp[i], dp[j] + 1); } } } cout << *max_element(all(dp)) << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...