Submission #262643

#TimeUsernameProblemLanguageResultExecution timeMemory
262643CantfindmeArcade (NOI20_arcade)C++17
100 / 100
198 ms17172 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++) { int p = -plots[i].s; if (v.empty() or v.back() < p) v.push_back(p); else { int pos = lower_bound(v.begin(),v.end(),p) - v.begin(); v[pos] = p; } } 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...