제출 #519702

#제출 시각아이디문제언어결과실행 시간메모리
519702ac2huArcade (NOI20_arcade)C++14
30 / 100
644 ms328 KiB
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10; struct mov{ int t,loc; } a[N]; int n,m; signed main(){ iostream::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); cin >> n >> m; vector<pair<int,int>> a(m); for(int i = 0;i<m;i++){ cin >> a[i].first; } for(int i =0 ;i<m;i++){ cin >> a[i].second; } sort(a.begin(),a.end(),[&](pair<int,int> a,pair<int,int> b){ return a.first < b.first||(a.first == b.first && a.second > b.second); }); a.erase(unique(a.begin(),a.end()), a.end()); m = a.size(); // int idxx[m]; // for(int i = 0;i<m;i++) // cout << a[i].first << " "; // cout << "\n"; // for(int i = 0;i<m;i++) // cout << a[i].second << " "; // cout << "\n"; int ans = 1e9; for(int i = 0;i<10000;i++){ vector<int> arms; for(int i = 0;i<m;i++){ int idx = -1; vector<int> vec; for(int j = 0;j<(int)arms.size();j++){ int e = arms[j]; if(abs(a[e].second - a[i].second) <= abs(a[e].first - a[i].first)){ vec.push_back(j); } } if(vec.size() == 0){ arms.push_back(i); } else{ idx = vec[(rng()%(int)vec.size())]; arms[idx] = i; } } ans = min(ans,(int)arms.size()); } cout << ans << "\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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...