Submission #744651

# Submission time Handle Problem Language Result Execution time Memory
744651 2023-05-18T22:23:26 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"


using namespace std;

#define int long long
const int inf = 1e9;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int m;
  cin >> n >> m;

  vector<int> v;
  for(int i=0; i<n; i++){
    int a; cin >> a;
    if(m*(i+1) >=a ) v.push_back(m*(i+1) - a);
  }

  vector<int> lis;
  for(int i=0; i<v.size(); i++){
    int id = upper_bound(lis.begin(), lis.end(), v[i]) - lis.begin();
    if(id == lis.size()){
      lis.push_back(v[i]);
    }
    else lis[id] = v[i];
  }
  cout << n - lis.size() << endl;
  return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:13:10: error: 'n' was not declared in this scope
   13 |   cin >> n >> m;
      |          ^
triusis.cpp:22:17: 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]
   22 |   for(int i=0; i<v.size(); i++){
      |                ~^~~~~~~~~
triusis.cpp:24:11: 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]
   24 |     if(id == lis.size()){
      |        ~~~^~~~~~~~~~~~~