Submission #734434

# Submission time Handle Problem Language Result Execution time Memory
734434 2023-05-02T11:57:27 Z farica Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define div /
#define ll long long

#define fore(i, l, r) for(int i=int(l); i<int(r); i++)
#define sz(a) int((a).size())
#define mod 1000000007

using namespace std;

int main() {
    int n,m;
    cin >> n >> m;
    int h[n];
    vector<int>v;
    for(int i=0; i<n; ++i) {
        cin >> h[i];
        if(!i && h[i]>m) {
            h[i]=m;
        }
        v.insert(v.begin(), h[i]-m*i);
    }
    vector<int>dp;
    dp.push_back(v[0]);
    for(int i=1; i<n; ++i) {
        int pos=upper_bound(dp.begin(), dp.end(), v[i])-dp.begin();
        if(i==n-1) {
            if(pos==dp.size()) cout << n-dp.size()-1 << endl;
            else cout << n-pos << endl;
        }
        if(pos==dp.size()) dp.push_back(v[i]);
        else dp[pos]=v[i];
    }

    return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             if(pos==dp.size()) cout << n-dp.size()-1 << endl;
      |                ~~~^~~~~~~~~~~
triusis.cpp:31:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(pos==dp.size()) dp.push_back(v[i]);
      |            ~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -