Submission #262636

#TimeUsernameProblemLanguageResultExecution timeMemory
262636CantfindmeArcade (NOI20_arcade)C++17
0 / 100
0 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int,int> pi; #define f first #define s second #define FAST ios_base::sync_with_stdio(0); cin.tie(0); const int maxn = 500010; int n, buttons; int T[maxn], A[maxn]; pi plots[maxn]; int32_t main() { FAST cin >> n >> buttons; for (int i =0;i<buttons;i++) cin >> T[i]; for (int i =0;i<buttons;i++) cin >> A[i]; for (int i =0;i<buttons;i++) plots[i] = pi(T[i] + A[i], T[i] - A[i] - buttons); sort(plots,plots+buttons); //for (int i =0;i<buttons;i++) cout << plots[i].f << " " << plots[i].s << "\n"; vector <int> v; for (int i =0;i<buttons;i++) { if (v.empty() or v.back() < plots[i].s) v.push_back(-plots[i].s); else { int pos = lower_bound(v.begin(),v.end(),-plots[i].s) - v.begin(); v[pos] = -plots[i].s; } } cout << v.size() << "\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...