제출 #810713

#제출 시각아이디문제언어결과실행 시간메모리
810713alextodoranAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
207 ms15840 KiB
/** _ _ __ _ _ _ _ _ _ |a ||t ||o d | |o | | __ _| | _ | __| _ | | __ |/_ | __ /__\ / _\| **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; int main () { ios_base::sync_with_stdio(false); cin.tie(0); int N; cin >> N; int X[N], Y[N]; for (int i = 0; i < N; i++) { int x, y; cin >> x >> y; X[i] = y + x; Y[i] = y - x; } int order[N]; iota(order, order + N, 0); sort(order, order + N, [&] (const int &i, const int &j) { return make_pair(X[i], Y[i]) < make_pair(X[j], Y[j]); }); int mx = INT_MIN; int answer = 0; for (int i = N - 1; i >= 0; i--) { if (Y[order[i]] > mx) { mx = Y[order[i]]; answer++; } } cout << answer << "\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...