Submission #731769

# Submission time Handle Problem Language Result Execution time Memory
731769 2023-04-28T00:35:37 Z Trunkty Walking (NOI12_walking) C++14
25 / 25
1 ms 408 KB
#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

walking.cpp: In function 'int main()':
walking.cpp:20:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;i<peeps.size();i++){
      |                 ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 252 KB Output is correct