# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
499612 |
2021-12-29T04:39:15 Z |
ac2hu |
Walking (NOI12_walking) |
C++14 |
|
1 ms |
308 KB |
#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 |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |