Submission #822989

#TimeUsernameProblemLanguageResultExecution timeMemory
822989makravAdvertisement 2 (JOI23_ho_t2)C++14
0 / 100
2041 ms4600 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vei; typedef vector<vei> vevei; #define coa \ for (auto i : a) { \ cout << i << ' '; \ } \ cout << '\n'; #define cia \ for (auto& i : a) { \ cin >> a; \ } #define cna \ int n; \ cin >> n; \ vector<int> a(n); \ for (int i = 0; i < n; i++) { \ cin >> a[i]; \ } #define cnka \ int n, k; \ cin >> n >> k; \ vector<int> a(n); \ for (int i = 0; i < n; i++) { \ cin >> a[i]; \ } #define cnab \ int n; \ cin >> n; \ vector<int> a(n); \ for (int i = 0; i < n; i++) { \ cin >> a[i]; \ } \ vector<int> b(n); \ for (int i = 0; i < n; i++) { \ cin >> b[i]; \ } #define all(a) (a).begin(), (a).end() #define sz(a) (int) a.size() #define con cout << "NO\n" #define coe cout << "YES\n"; #define str string #define pb push_back #define ff first #define sc second #define pii pair<int, int> #define mxe max_element #define mne min_element #define stf shrink_to_fit #define f(i, l, r) for (int i = (l); i < (r); i++) #define double ld signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) cin >> a[i].ff >> a[i].sc; sort(all(a)); vector<int> cnt(n, 0), dp(n, 1); for (int i = 1; i < n; i++) { for (int j = 0; j < i; j++) { if (abs(a[i].sc - a[j].sc) < abs(a[i].ff - a[j].ff)) { cnt[j]++; dp[i] = max(dp[i], dp[j] + 1); } } } int M = 0; f(i, 0, n) { if (cnt[i] == 0) M = max(M, dp[i]); } cout << M << '\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...