Submission #892755

#TimeUsernameProblemLanguageResultExecution timeMemory
892755KodikRabbit Carrot (LMIO19_triusis)C++17
100 / 100
26 ms5460 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...