# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
705711 | Mathandski | Rabbit Carrot (LMIO19_triusis) | C++14 | 79 ms | 6836 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define is insert
#define ll long long
#define f0r(i, begin, n) for (ll i = begin; i < n; i ++)
#define len(x) x.length()
#define sz(x) x.size()
#include <bits/stdc++.h>
using namespace std;
int main () {
ifstream fin; ofstream fout;
fin.open("cowjog.in"); fout.open("cowjog.out");
ll N, M; cin >> N >> M;
vector<ll> lis = {0};
f0r (i, 1, N + 1) {
ll a; cin >> a;
a -= M * i;
lis.pb(-a);
}
vector<ll> dp;
for (ll i : lis) {
if(i < 0) {
continue;
}
ll pos = upper_bound(dp.begin(), dp.end(), i) - dp.begin();
if (pos == dp.size()) {
// we can have a new, longer increasing subsequence!
dp.push_back(i);
} else {
// oh ok, at least we can make the ending element smaller
dp[pos] = i;
}
}
cout << N - dp.size() + 1 << endl;
}
컴파일 시 표준 에러 (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... |