제출 #1211933

#제출 시각아이디문제언어결과실행 시간메모리
1211933anuj걷기 (NOI12_walking)C++20
25 / 25
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int l, n; cin >> l >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } sort(a.begin(), a.end()); vector<double> b; for (auto &[t, v] : a) { b.push_back(t + (double)l / v); } vector<double> dp; for (double f : b) { auto it = lower_bound(dp.begin(), dp.end(), -f); if (it == dp.end()) dp.push_back(-f); else *it = -f; } cout << dp.size() << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); 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...