Submission #737140

#TimeUsernameProblemLanguageResultExecution timeMemory
737140Ronin13Arcade (NOI20_arcade)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back #define ull unsigned ll using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int m; cin >> m; int t[m + 1], x[m + 1]; for(int i= 1; i <= m; i++){ cin >> t[i]; } for(int i = 1; i <= m; i++){ cin >> x[i]; } pair<pll, ll> c[m + 1]; for(int i= 1; i <= m; ++i){ c[i].f.f = x[i] - t[i]; c[i].f.s = -x[i] - t[i]; c[i].s = i; } sort(c + 1, c + 1 + m); set <pll> st; for(int i = 1; i <= m; i++){ int ind = c[i].s; auto it = st.lower_bound({x[ind] + t[ind], -1}); if(it != st.end())st.erase(it); st.insert({x[ind] + t[ind], ind}); cout << st.size() << ' '; } cout << st.size(); 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...