#include <bits/stdc++.h>
using namespace std;
#define A first
#define B second
#define MP make_pair
#define ms(a, x) memset(a, x, sizeof(a))
#define boost() ios_base::sync_with_stdio(false); cin.tie(NULL)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pld;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const int mxN=1e4+1e3+5;
int dp[505][mxN], l, n;
vector <pii> v;
ll solve(int pos, int range){
if(pos == n)
return 0;
if(dp[pos][range] != -1)
return dp[pos][range];
ll ret = solve(pos+1, range);
if(v[pos].B < range)
ret = max(ret, solve(pos+1, v[pos].B)+1);
return dp[pos][range]=ret;
}
int main(){
ms(dp, -1);
cin >> l >> n;
for(int i=0; i<n; i++){
ld x, y;
cin >> x >> y;
v.push_back({x, round(l/y)+x});
}
sort(v.begin(), v.end());
cout << solve(0, mxN-5);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
21972 KB |
Output is correct |
2 |
Correct |
13 ms |
21972 KB |
Output is correct |
3 |
Correct |
11 ms |
22056 KB |
Output is correct |
4 |
Incorrect |
11 ms |
21972 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
21972 KB |
Output is correct |
2 |
Correct |
10 ms |
22052 KB |
Output is correct |
3 |
Correct |
10 ms |
21972 KB |
Output is correct |
4 |
Correct |
11 ms |
22044 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
22048 KB |
Output is correct |
2 |
Correct |
10 ms |
21972 KB |
Output is correct |
3 |
Correct |
10 ms |
21972 KB |
Output is correct |
4 |
Correct |
12 ms |
21948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
22052 KB |
Output is correct |
2 |
Correct |
12 ms |
21972 KB |
Output is correct |
3 |
Correct |
11 ms |
22052 KB |
Output is correct |
4 |
Correct |
13 ms |
22056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
22008 KB |
Output is correct |
2 |
Correct |
13 ms |
21972 KB |
Output is correct |
3 |
Correct |
14 ms |
22052 KB |
Output is correct |
4 |
Correct |
11 ms |
21972 KB |
Output is correct |