Submission #1100356

# Submission time Handle Problem Language Result Execution time Memory
1100356 2024-10-13T15:07:19 Z jassu12345 Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define int long long

int mod = 1e9+7;

void solve() {
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0; i<n; i++)cin>>a[i];
    vector<int>temp,b;
    for(int i=0; i<n; i++){
        if(m*(i+1) >= a[i])
        b.pb((i+1)*m-a[i]);
    }
    for(int i=0; i<b.size(); i++){
        if(a[i]>0 && temp.empty())temp.pb(a[i]);
        else 
        if(a[i]>temp.back())temp.push_back(a[i]);
        else{
            int idx=upper_bound(temp.begin(),temp.end(),b[i])-temp.begin();
            temp[idx]=b[i];
        }
        
    }
    int sz;
    if(temp.empty())sz=0;
    else sz=temp.size();
    
   cout<<n-sz;
    
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

Compilation message

triusis.cpp: In function 'void solve()':
triusis.cpp:19:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0; i<b.size(); i++){
      |                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -