Submission #433285

#TimeUsernameProblemLanguageResultExecution timeMemory
433285fvogel499Rabbit Carrot (LMIO19_triusis)C++14
100 / 100
100 ms2616 KiB
/* File created on 06/19/2021 at 14:09:08. Link to problem: https://oj.uz/problem/view/LMIO19_triusis Description: Time complexity: O() Space complexity: O() Status: DEV Copyright: Ⓒ 2021 Francois Vogel */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; #define pii pair<int, int> #define f first // #define s second #define pb push_back #define ins insert #define cls clear #define ll long long typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; signed main() { cin.tie(0); // ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; vector<int> b; for (int i = 0; i < n; i++) { int v; cin >> v; int x = m*(i+1)-v; if (x >= 0) b.pb(x); } vector<int> s; for (int i : b) { int p = upper_bound(s.begin(), s.end(), i)-s.begin(); if (p == s.size()) s.pb(i); else s[p] = i; } cout << n-s.size(); int d = 0; d++; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:47:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         if (p == s.size()) s.pb(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...