Submission #692659

#TimeUsernameProblemLanguageResultExecution timeMemory
692659zeroesandonesLightning Rod (NOI18_lightningrod)C++17
19 / 100
2069 ms169248 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vi; typedef pair<ll, ll> pi; #define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i) #define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i) #define nl "\n" #define sp " " #define all(x) (x).begin(), (x).end() #define sc second #define fr first #define pb emplace_back void solve() { ll n; cin >> n; ll x[n], y[n]; FOR(i, 0, n) { cin >> x[i] >> y[i]; } ll ans = n; FOR(i, 1, (1<<n)) { vi subset; FOR(j, 0, n) { if(i & (1<<j)) { subset.pb(j); } } bool covered[n] = {}; FOR(j, 0, n) { for(auto k : subset) { if(y[k] < y[j]) continue; if(abs(x[j] - x[k]) <= y[k] - y[j]) { covered[j] = true; break; } } } bool valid = true; FOR(j, 0, n) { if(!covered[j]) { valid = false; break; } } if(valid) ans = min(ans, (ll) __builtin_popcountll(i)); } cout << ans << nl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t = 1; // cin >> t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...