# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
731769 | Trunkty | Walking (NOI12_walking) | C++14 | 1 ms | 408 KiB |
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/extc++.h>
using namespace std;
typedef long long ll;
#define int ll
int l,n,ans;
vector<vector<int>> peeps;
int dp[505];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> l >> n;
for(int i=1;i<=n;i++){
int a,b;
cin >> a >> b;
peeps.push_back({a,b});
}
sort(peeps.begin(),peeps.end());
for(int i=0;i<peeps.size();i++){
int x = peeps[i][0], y = peeps[i][1];
dp[i] = 1;
for(int j=0;j<i;j++){
if(l*y+peeps[j][0]*peeps[j][1]*y>l*peeps[j][1]+x*peeps[j][1]*y){
dp[i] = max(dp[i],dp[j]+1);
}
}
ans = max(ans,dp[i]);
}
cout << ans << "\n";
return 0;
}
Compilation message (stderr)
# | 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... |