# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1228890 | Tony_Tung | Rabbit Carrot (LMIO19_triusis) | C++17 | 16 ms | 4548 KiB |
#include <bits/stdc++.h>
#define task ""
#define ll long long
using namespace std;
const int N = 2e5 + 5;
ll a[N], b[N];
vector<int> res;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
if (fopen(task".inp", "r"))
{
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int n; ll M; cin >> n >> M;
for (int i = 1; i <= n; i++) cin >> a[i];
int m = 0;
for (int i = 1; i <= n; i++)
if (a[i] <= M*i) b[++m] = M*i-a[i];
for (int i = 1; i <= m; i++)
{
auto it = upper_bound(res.begin(), res.end(), b[i]);
if (it == res.end()) res.push_back(b[i]);
else *it = b[i];
}
cout << n - res.size();
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... |