#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
int dp[505], l, n;
pi a[505];
bool ok(int p, int q){
return (a[p].first < a[q].first) &&
(l * a[q].second + a[p].first * a[p].second * a[q].second > l * a[p].second + a[q].first * a[p].second * a[q].second);
}
int main(){
scanf("%d %d",&l,&n);
for(int i=0; i<n; i++){
scanf("%d %d",&a[i].first, &a[i].second);
}
sort(a, a+n);
for(int i=n-1; i>=0; i--){
dp[i] = 1;
for(int j=i+1; j<n; j++){
if(ok(i,j)) dp[i] = max(dp[i], dp[j] + 1);
}
}
printf("%d",*max_element(dp, dp+n));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1728 KB |
Output is correct |
2 |
Correct |
0 ms |
1728 KB |
Output is correct |
3 |
Correct |
0 ms |
1728 KB |
Output is correct |
4 |
Correct |
0 ms |
1728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1728 KB |
Output is correct |
2 |
Correct |
0 ms |
1728 KB |
Output is correct |
3 |
Correct |
0 ms |
1728 KB |
Output is correct |
4 |
Correct |
0 ms |
1728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1728 KB |
Output is correct |
2 |
Correct |
0 ms |
1728 KB |
Output is correct |
3 |
Correct |
0 ms |
1728 KB |
Output is correct |
4 |
Correct |
0 ms |
1728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1728 KB |
Output is correct |
2 |
Correct |
0 ms |
1728 KB |
Output is correct |
3 |
Correct |
0 ms |
1728 KB |
Output is correct |
4 |
Correct |
0 ms |
1728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1728 KB |
Output is correct |
2 |
Correct |
0 ms |
1728 KB |
Output is correct |
3 |
Correct |
0 ms |
1728 KB |
Output is correct |
4 |
Correct |
0 ms |
1728 KB |
Output is correct |