Submission #1110519

#TimeUsernameProblemLanguageResultExecution timeMemory
1110519luvnaRabbit Carrot (LMIO19_triusis)C++14
100 / 100
21 ms5320 KiB
#include<bits/stdc++.h> #define all(v) v.begin(), v.end() #define endl "\n" using namespace std; const int N = 2e5 + 15; int n, m; int a[N]; int lis(vector<int>& potential){ vector<int> vec; for(int x : potential){ int pos = upper_bound(all(vec), x) - vec.begin(); if(pos == (int)vec.size()) vec.push_back(x); else vec[pos] = x; } return (int)vec.size(); } void solve(){ cin >> n >> m; vector<int> potential; for(int i = 1; i <= n; i++){ cin >> a[i]; if(a[i] <= i*m) potential.push_back(i*m - a[i]); } cout << n - lis(potential) << endl; } signed main(){ ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); #define task "task" if(fopen(task".INP", "r")){ freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout); } int t; t = 1; //cin >> t; while(t--) solve(); }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:43:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |         freopen(task".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:44:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |         freopen(task".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...