Submission #917150

#TimeUsernameProblemLanguageResultExecution timeMemory
917150sanoRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms348 KiB
#include <iostream> #include <string> #include <string.h> #include <fstream> #include <algorithm> #include <vector> #include <iomanip> #include <queue> #include<map> #include <stack> #include <unordered_map> #include <set> #include <math.h> #include <cstdlib> #include <time.h> #define ll long long #define For(i, n) for(int i = 0; i < n; ++i) #define ffor(i, a, n) for(int i = a; i < n; ++i) #define pb push_back #define vec vector #define ff first #define ss second #define pairs pair<sui, sui> #define NEK 1000000000 #define mod 1000000007 #define vel 1000 using namespace std; typedef unsigned short int sui; int lis(vec<int> a) { vec<int> dp; For(i, a.size()) { auto x = upper_bound(dp.begin(), dp.end(), a[i]*(-1)); if (x == dp.end()) { dp.push_back(a[i] * (-1)); } else { *x = a[i]*(-1); } } return dp.size(); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //ifstream cin("cowjog.in"); //ofstream cout("cowjog.out"); int n, m; cin >> n >> m; vec<int> a; For(i, n) { int x; cin >> x; if(x - m*i <= 0) { a.push_back(x - m * i); } } cout << n - lis(a) << '\n'; return 0; }

Compilation message (stderr)

triusis.cpp: In function 'int lis(std::vector<int>)':
triusis.cpp:17:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 | #define For(i, n) for(int i = 0; i < n; ++i)
......
   32 |  For(i, a.size()) {
      |      ~~~~~~~~~~~                    
triusis.cpp:32:2: note: in expansion of macro 'For'
   32 |  For(i, a.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...