Submission #1261435

#TimeUsernameProblemLanguageResultExecution timeMemory
1261435hoa208Rabbit Carrot (LMIO19_triusis)C++20
100 / 100
17 ms3400 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--) #define pa pair<ll, ll> #define fi first #define se second #define bit(mask, j) ((mask >> j) & 1) #define t_test int t;cin >> t;while(t--) const ll mod = 1e9 + 7; const ll INF = 1e18; inline void adm(ll &x){if(x>=mod)x%=mod;else if(x<0)x+=mod;} //-------------------------------------------------------------------- ll n, m; const ll N = 2e5 + 10; ll a[N], b[N]; void hbmt() { cin >> n >> m; vector<ll> vt; FOR(i, 1, n) { cin >> a[i]; a[i] = m * i - a[i]; } ll k = 0; FOR(i, 1, n) { if(a[i] < 0) continue; if(k == 0) { b[++k] = a[i]; continue; } ll vt = upper_bound(b + 1, b + k + 1, a[i]) - b; b[vt] = a[i]; k = max(vt, k); } cout << n - k; } int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); if(fopen("hbmt.inp", "r")) { freopen("hbmt.inp", "r", stdin); freopen("hbmt.out", "w", stdout); } // t_test hbmt(); return 0; }

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:46:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |         freopen("hbmt.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:47:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |         freopen("hbmt.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...