제출 #941244

#제출 시각아이디문제언어결과실행 시간메모리
941244dsyzAdvertisement 2 (JOI23_ho_t2)C++17
33 / 100
250 ms38704 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAXN (1000005) int main() { ios_base::sync_with_stdio(false);cin.tie(0); ll N; cin>>N; pair<ll,ll> arr[N]; for(ll i = 0;i < N;i++){ cin>>arr[i].first>>arr[i].second; } if(N > 1000){ set<ll> s; for(ll i = 0;i < N;i++){ s.insert(arr[i].first); } cout<<s.size()<<'\n'; }else{ ll mini = 1e18; for(ll bitmask = 0;bitmask < (1ll<<N);bitmask++){ ll sum = 0; bool done[N]; memset(done,0,sizeof(done)); for(ll i = 0;i < N;i++){ if(bitmask & (1ll<<i)){ done[i] = 1; for(ll j = 0;j < N;j++){ if(abs(arr[i].first - arr[j].first) <= arr[i].second - arr[j].second){ done[j] = 1; } } sum++; } } bool ok = 1; for(ll i = 0;i < N;i++){ if(!done[i]){ ok = 0; } } if(ok){ mini = min(mini,sum); } } cout<<mini<<'\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...