제출 #1021654

#제출 시각아이디문제언어결과실행 시간메모리
1021654lHogAdvertisement 2 (JOI23_ho_t2)C++17
0 / 100
2040 ms3416 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; //set<long long> st; long long x[n], e[n]; for (long long i = 0; i < n; i++) cin >> x[i] >> e[i]; //long long s[n-1]; //for (long long i = 1; i < n; i++) s[i-1] = e[i-1]-e[i]; long long c[n]; long long t = 0; for (long long i = 0; i < n; i++) { for (long long j = 0; j < i; j++) { if (abs(x[i]-x[j]) <= e[i]-e[j]) t++; } for (long long j = i; j < n; j++) { if (abs(x[i]-x[j]) <= e[i]-e[j]) t++; } c[i] = t; t = 0; } sort(c, c+n, greater<int>()); long long as = 0; long long i = 0; for (i = 0; i < n; i++) { as += c[i]; if (as >= n) break; } //for (long long i: c) cout << i << " "; cout << i+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...