Submission #1024847

#TimeUsernameProblemLanguageResultExecution timeMemory
1024847MohamedFaresNebiliAdvertisement 2 (JOI23_ho_t2)C++14
23 / 100
93 ms3420 KiB
#include <bits/stdc++.h> using namespace std; int N; int X[500005], E[500005]; vector<int> C; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; for(int l = 0; l < N; l++) cin >> X[l] >> E[l]; int res = 1e9 + 7; for(int l = 0; l < (1 << N); l++) { vector<int> B(N, 0); for(int i = 0; i < N; i++) { if(!(l & (1 << i))) continue; B[i] = 1; for(int j = 0; j < N; j++) { if(B[j]) continue; if(abs(X[i] - X[j]) <= E[i] - E[j]) B[j] = 1; } } bool ok = true; for(int i = 0; i < N; i++) ok &= (B[i] == 1); if(ok) res = min(res, __builtin_popcount(l)); } cout << res << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...