Submission #964381

# Submission time Handle Problem Language Result Execution time Memory
964381 2024-04-16T18:09:39 Z new_acc Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
0 ms 352 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define pitem item*
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=1e6+10;
const int SS=1<<19;
const int INFi=2e9;
const ll INFl=1e16;
const ll mod2=998244353;
const ll mod=1e9+7;
const ll mod3=2027865967;
const ll p=70032301;
const ull p2=913;
const int L=20;
ll t[N];
void solve(){
    ll m,n;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>t[i];
        t[i]-=m*i;
    }
    vl v;
    v.push_back(-INFl);
    for(int i=n;i>=1;i--){
        int it=upper_bound(v.begin(),v.end(),t[i])-v.begin();
        if(it==v.size()) v.push_back(t[i]);
        else v[it]=t[i];
    }
    cout<<n-v.size()+1<<"\n";
}
int main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    int tt=1;
    while(tt--) solve();
}

Compilation message

triusis.cpp: In function 'void solve()':
triusis.cpp:32:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         if(it==v.size()) v.push_back(t[i]);
      |            ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 352 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 352 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 352 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 352 KB Output isn't correct
3 Halted 0 ms 0 KB -