제출 #622733

#제출 시각아이디문제언어결과실행 시간메모리
622733ipaljakRabbit Carrot (LMIO19_triusis)C++14
100 / 100
91 ms12308 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e5 + 10;

int n, m;
int a[MAXN];

int lis() {
  multiset<int> s;
  multiset<int>::iterator it;
  for (int i = 1; i <= n; ++i) {
    if (a[i] > 0) continue;
    s.insert(-a[i]);
    it = s.upper_bound(-a[i]);
    if (it != s.end()) s.erase(it);
  }
  return s.size();
}

int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i] -= m * i;
  }

  //for (int i = 0; i <= n; ++i)
    //cerr << a[i] << " ";
  //cerr << endl;

  printf("%d\n", n - lis());
  return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

triusis.cpp: In function 'int main()':
triusis.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
triusis.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     scanf("%d", &a[i]);
      |     ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...