Submission #347898

#TimeUsernameProblemLanguageResultExecution timeMemory
347898oleksgRabbit Carrot (LMIO19_triusis)C++11
100 / 100
92 ms5984 KiB
#pragma GCC optimize("O2") #include <fstream> #include <string> #include <iostream> #include <bitset> #include <math.h> #include <string> #include <algorithm> #include <assert.h> #include<bits/stdc++.h> #include <vector> #include <queue> #include<stdio.h> #include<ctype.h> #define ll long long using namespace std; ll n, m; ll arr[200002]; vector<ll> dp; int main(){ cin >> n >> m; for (int x = 0; x < n; x++){ cin >> arr[x]; arr[x] = m * (x + 1) - arr[x]; } for (int x = 0; x < n; x++){ if (arr[x] >= 0){ int pos = upper_bound(dp.begin(), dp.end(), arr[x]) - dp.begin(); if (pos == dp.size()){ dp.push_back(arr[x]); } else{ dp[pos] = arr[x]; } } } cout << n - dp.size() << "\n"; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:31:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             if (pos == dp.size()){
      |                 ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...