Submission #897784

#TimeUsernameProblemLanguageResultExecution timeMemory
897784blackslexRabbit Carrot (LMIO19_triusis)C++17
100 / 100
25 ms5276 KiB
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, m, a[N]; vector<int> v, u; int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) if (a[i] <= m * i) v.emplace_back(m * i - a[i]); for (auto &e: v) { auto upper = upper_bound(u.begin(), u.end(), e); if (upper == u.end()) u.emplace_back(e); else *upper = e; } printf("%d", n - u.size()); }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:18:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   18 |     printf("%d", n - u.size());
      |             ~^   ~~~~~~~~~~~~
      |              |     |
      |              int   std::vector<int>::size_type {aka long unsigned int}
      |             %ld
triusis.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
triusis.cpp:11:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 1; i <= n; i++) 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...