| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1338811 | ghassanhasan | Rabbit Carrot (LMIO19_triusis) | C++20 | 20 ms | 4176 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(v) v.begin(), v.end()
int find_lis(const vector<ll> &a) {
vector<ll> dp;
for (int i : a) {
if(i < 0) continue;
int pos = upper_bound(dp.begin(), dp.end(), i) - dp.begin();
if (pos == dp.size()) dp.push_back(i);
else dp[pos] = i;
}
return dp.size();
}
void doing(){
int n, m; cin >> n >> m;
vector<ll> a(n + 1);
for(int i = 1; i <= n; i++){
cin >> a[i];
a[i] = 1ll * m * i - a[i];
}
cout << n + 1 - find_lis(a) << '\n';
}
signed main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifdef GH
freopen("IN.txt", "r", stdin);
cout << string(60, '*') << endl;
#else
if (const string file = ""; !file.empty()) {
freopen((file + ".in").c_str(), "r", stdin);
freopen((file + ".out").c_str(), "w", stdout);
}
#endif
int tc = 1;
// cin >> tc;
while (tc--)
doing();
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
