제출 #892517

#제출 시각아이디문제언어결과실행 시간메모리
892517vjudge1Arcade (NOI20_arcade)C++17
100 / 100
191 ms9796 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 <= m; 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...