Submission #922522

#TimeUsernameProblemLanguageResultExecution timeMemory
922522absolutePiRabbit Carrot (LMIO19_triusis)C++17
100 / 100
64 ms5316 KiB
#include <bits/stdc++.h> using namespace std; int nds(const vector<int> &unchanged){ vector<int> ans; for(auto i : unchanged){ int p=upper_bound(ans.begin(),ans.end(),i)-ans.begin(); if(p==ans.size()){ ans.push_back(i); } else{ ans[p]=i; } } return ans.size(); } int main(){ //ios::sync_with_stdio(false); //cin.tie(0); int n,m; cin >> n >> m; vector<int> v(n); for(auto &i : v){cin >> i;} vector<int> unchanged; for(int i=1;i<=n;i++){ if(i*m>=v[i-1]){ unchanged.push_back(i*m-v[i-1]); } } cout << n-nds(unchanged); }

Compilation message (stderr)

triusis.cpp: In function 'int nds(const std::vector<int>&)':
triusis.cpp:9:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         if(p==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...