Submission #1177793

#TimeUsernameProblemLanguageResultExecution timeMemory
1177793Omar_ElgedawyRabbit Carrot (LMIO19_triusis)C++20
0 / 100
274 ms114316 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define F first #define S second #define el '\n' #define cout(x) for(auto v:x)cout<<v<<' ';cout<<el #define coutp(x) for(auto v:x)cout<<v.F<<' '<<v.S<<el #define cin(x) for(auto &v:x)cin>>v; #define all(x) x.begin(),x.end() #define ll long long #define sz(x) (int)x.size() const int N = 2e6 + 5, M = 1e2 + 5, Mod = 1e9 + 7; int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1}; int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1}; void solve(int T) { int n, m; cin >> n >> m; vector<int> a, v; for (int i = 1; i <= n; i++) { int x; cin >> x; if (i * m >= x) a.push_back(m * i - x); } for (auto i : a) { int x = upper_bound(all(v), i) - v.begin(); if (x == v.size()) v.push_back(i); else v[x] = i; } cout << n - v.size() << el; } int32_t main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // freopen("cowjog.in", "r", stdin); // freopen("cowjog.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(NULL); int tc = 1; // cin >> tc; for (int i = 1; i <= tc; i++)solve(i); return 0; }

Compilation message (stderr)

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