Submission #724595

#TimeUsernameProblemLanguageResultExecution timeMemory
724595awuArcade (NOI20_arcade)C++14
100 / 100
242 ms25800 KiB
#include <bits/extc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") #define int long long #define f first #define s second #define all(x) x.begin(), x.end() #define debug(x) do{auto __tmp__ = x; cerr << #x << " = " << __tmp__ << endl;}while(0) // #define endl "\n" #define unordered_map __gnu_pbds::gp_hash_table using pii = pair<int, int>; const int inf = 1ll << 60; // const int inf = 1 << 30; const int MOD = 1e9 + 7; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<int> t(m), a(m); for(int i = 0; i < m; i++) { cin >> t[i]; } for(int i = 0; i < m; i++) { cin >> a[i]; } vector<pii> p(m); for(int i = 0; i < m; i++) { p[i] = {t[i] + a[i], t[i] - a[i]}; } sort(all(p)); set<int> ws; for(auto i : p) { auto w = ws.upper_bound(i.s); if(w != ws.begin()) { w--; ws.erase(w); } ws.insert(i.s); } cout << ws.size() << endl; }
#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...