Submission #1099263

#TimeUsernameProblemLanguageResultExecution timeMemory
1099263DangKhoizzzzRabbit Carrot (LMIO19_triusis)C++14
100 / 100
22 ms8400 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 2e5 + 7; int n , m , a[maxn] ; void solve() { cin >> n >> m; for(int i = 1; i <= n; i++) cin >> a[i]; vector <int> b; for(int i = 1; i <= n; i++) { if(a[i] <= m*i) { b.push_back(a[i] - m*i); } } reverse(b.begin() , b.end()); vector <int> LIS; for(int i = 0; i < b.size(); i++) { int j = upper_bound(LIS.begin() , LIS.end() , b[i]) - LIS.begin(); if(j == LIS.size()) { LIS.push_back(b[i]); } else LIS[j] = b[i]; } cout << n - LIS.size() << '\n'; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); solve(); return 0; }

Compilation message (stderr)

triusis.cpp: In function 'void solve()':
triusis.cpp:30:22: 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]
   30 |     for(int i = 0; i < b.size(); i++)
      |                    ~~^~~~~~~~~~
triusis.cpp:34:14: 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]
   34 |         if(j == LIS.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...