Submission #892754

# Submission time Handle Problem Language Result Execution time Memory
892754 2023-12-25T21:19:04 Z Kodik Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long  ll;
typedef long double ld;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()

int main(){
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    // freopen("cowjog.in", "r", stdin);
	// freopen("cowjog.out", "w", stdout);
    int pole_num, jump_height;
    cin >> pole_num >> jump_height;
    vector<int> poles(pole_num);
    for(int &i : poles) cin >> i;
    vector<int> poss_unchanged;
    for(int i = 1; i < pole_num; ++i){
        if(i*jump_height >= poles[i-1]){
            poss_unchanged.push_back(i*jump_height-poles[i-1]);
        }
    }
    vector<int> ans;
    for(int &i : poss_unchanged){
        int pos = upper_bound(ans.begin(), ans.end(), i) - ans.begin();
        if(pos == ans.size()){
            ans.push_back(i);
        }else{
            ans[pos] = i;
        }
    }
    cout << pole_num - ans.size() << '\n';
    return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if(pos == ans.size()){
      |            ~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -