Submission #655668

# Submission time Handle Problem Language Result Execution time Memory
655668 2022-11-05T08:15:58 Z tunay_kerem Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
0 ms 212 KB
// author : tunay_ke
#include <bits/stdc++.h>
#define ii pair<int,int>
#define PB push
#define pb push_back
#define st first 
#define nd second
#define all(a) a.begin(),a.end()
#define iii pair<ii,int>
#define mid ((l+r)/2)
#define endl "\n"
using namespace std;

int n,a,k;
vector<int> v;
int main() {
    
    cin>>n>>k;
        
    for (int i = 0; i < n; ++i)
        {
            cin>>a;
            v.pb(a);
        }    
    
    vector<long long int> fx;
    
    for (int i = 1; i <= n; ++i)
    {
        if(i*k-v[i-1]<0)continue;
        fx.pb(i*k-v[i-1]);   

    }
    for (int i = 0; i < n; ++i)
    {
        cout<<fx[i]<<" ";
    }
    cout<<endl; 
    vector<long long int> lis;

    for (int i = 0; i < n; ++i)
    {
        int sonra=upper_bound(lis.begin(),lis.end(),fx[i])-lis.begin();
        //cout<<sonra<<endl;  
        if(sonra==lis.size()){
            lis.pb(fx[i]);
        }
        else lis[sonra]=fx[i];
    }
    cout<<n-lis.size();
}   

Compilation message

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