This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |