This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
signed main(){
iostream::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int l,n;cin >> l >> n;
vector<pair<int,int>> inp(n);
for(int i = 0;i<n;i++){
cin >> inp[i].first >> inp[i].second;
}
sort(inp.begin(),inp.end());
vector<double> finish(n);
for(int i = 0;i<n;i++){
finish[i] = (double)l/(double)inp[i].second + (double)inp[i].first;
}
vector<int> dp(n);
for(int i = 0;i<n;i++){
dp[i] = 1;
for(int j = i-1;j>=0;j--){
if(finish[j] > finish[i])
dp[i] = max(dp[j] + 1,dp[i]);
}
}
cout << *max_element(dp.begin(),dp.end()) << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |