제출 #1120047

#제출 시각아이디문제언어결과실행 시간메모리
1120047sunboiAdvertisement 2 (JOI23_ho_t2)C++17
59 / 100
2077 ms4112 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++){ cin >> a[i].second >> a[i].first; } sort(a.begin(), a.end()); reverse(a.begin(), a.end()); vector<int> color(n); int cnt = 1; for (int i = 0; i < n; i++){ if (color[i]) continue; color[i] = cnt; for (int j = i + 1; j < n; j++){ if (color[j]) continue; if (abs(a[i].second - a[j].second) <= abs(a[i].first - a[j].first)){ color[j] = cnt; } } cnt++; } /*for (int i = 0; i < n; i++){ cout << color[i] << ' '; } cout << endl;*/ cout << cnt - 1 << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...