Submission #700219

#TimeUsernameProblemLanguageResultExecution timeMemory
700219LucasLeRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); //freopen("cowjog.out", "w", stdout); #endif int N, M; cin >> N >> M; vector<int> b; for (int i = 1; i <= N; ++i) { int x; cin >> x; if (x <= M * i) { b.push_back(M * i - x); } } vector<int> lis; for (int x : b) { int pos = upper_bound(lis.begin(), lis.end(), x) - lis.begin(); if (pos == lis.size()) lis.push_back(x); else lis[pos] = x; } cout << N - lis.size(); }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if (pos == lis.size()) lis.push_back(x);
      |             ~~~~^~~~~~~~~~~~~
triusis.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...