Submission #892510

#TimeUsernameProblemLanguageResultExecution timeMemory
892510adaawfArcade (NOI20_arcade)C++14
0 / 100
1 ms344 KiB
#include <iostream> #include <set> #include <algorithm> using namespace std; struct PUS { long long int x, y; } a[500005]; bool cmp(PUS aa, PUS bb) { if (aa.x + aa.y == bb.x + bb.y) return aa.x - aa.y < bb.x - bb.y; return aa.x + aa.y < bb.x + bb.y; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, m; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i].x; } for (int i = 1; i <= m; i++) { cin >> a[i].y; } sort(a + 1, a + m + 1, cmp); multiset<long long int> s; for (int i = 1; i <= n; i++) { auto h = s.upper_bound(a[i].x - a[i].y); if (h != s.begin()) { s.erase(prev(h)); } s.insert(a[i].x - a[i].y); } cout << s.size(); }
#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...