제출 #1019670

#제출 시각아이디문제언어결과실행 시간메모리
1019670crispxxAdvertisement 2 (JOI23_ho_t2)C++17
23 / 100
102 ms4948 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
		
#define int ll
#define nl '\n'
#define vt vector
#define ar array
#define ff first
#define ss second
#define all(x) x.begin(), x.end()

#define px cout << "YES\n"
#define py cout << "NO\n"

void _() {
	int n; cin >> n;
	vt<int> x(n), e(n);
	for(int i = 0; i < n; i++) {
		cin >> x[i] >> e[i];
	}
	int ans = n;
	for(int msk = 0; msk < (1 << n); msk++) {
		int ok = 0;
		for(int i = 0; i < n; i++) {
			if(((msk >> i) & 1) == 0) continue;
			for(int j = 0; j < n; j++) {
				if((msk >> j) & 1 || abs(x[i] - x[j]) <= e[i] - e[j]) {
					ok |= (1 << j);
				}
			}
		}
		if(ok == (1 << n) - 1) {
			int v = __builtin_popcountll(msk);
			ans = min(ans, v);
		}
	}
	cout << ans << nl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt = 1;
	// cin >> tt;
	while(tt--){_();}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...