제출 #701603

#제출 시각아이디문제언어결과실행 시간메모리
701603Jarif_RahmanArcade (NOI20_arcade)C++17
100 / 100
274 ms15872 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int N, n; cin >> N >> n; vector<pair<int, int>> v(n); for(int i = 0; i < n; i++) cin >> v[i].f; for(int i = 0; i < n; i++) cin >> v[i].sc; sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){ return make_pair(a.f-a.sc, a.f+a.sc) > make_pair(b.f-b.sc, b.f+b.sc); }); vector<int> o(n); for(int i = 0; i < n; i++) o[i] = i; sort(o.begin(), o.end(), [&](int a, int b){ return make_pair(v[a].f+v[a].sc, -a) > make_pair(v[b].f+v[b].sc, -b); }); set<int> s; for(int i = 0; i < n; i++){ if(!s.empty() && *s.begin() < o[i]) s.erase(prev(s.lower_bound(o[i]))); s.insert(o[i]); } cout << s.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...