Submission #854769

#TimeUsernameProblemLanguageResultExecution timeMemory
854769annabeth9680Arcade (NOI20_arcade)C++17
100 / 100
200 ms26568 KiB
#include <bits/stdc++.h> #define int long long #define f first #define s second using namespace std; const int MAXN = 5*1e5+20; int arr[MAXN], t[MAXN]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N,M; cin >> N >> M; vector<pair<int,int>> vec; for(int i = 0;i<M;++i) cin >> t[i]; for(int i = 0;i<M;++i) cin >> arr[i]; for(int i = 0;i<M;++i) vec.push_back({t[i]-arr[i],t[i]+arr[i]}); sort(vec.begin(),vec.end()); set<int> sums; sums.insert((1LL<<60)); for(int i = 0;i<M;++i){ auto it = sums.upper_bound(vec[i].s); if(it != sums.begin()){ --it; sums.erase(it); sums.insert(vec[i].s); } else{ sums.insert(vec[i].s); } } cout << sums.size()-1 << "\n"; return 0; }
#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...