| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 253214 | maximath_1 | Rabbit Carrot (LMIO19_triusis) | C++11 | 49 ms | 1532 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
* LMIO 2019 Rabbit Carrot
* Subtract the array with i * m
* A path is possible to cross if the array is
- non increasing
- starts with less than or equal to 0
* Find the longest non-increasing subsequence
* Alternatively additive inverse the array and
* Find LNDS in NlogN
*/
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <iomanip>
using namespace std;
int n, m, v;
vector<int> dp; //longest non-decreasing subsequence
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i ++){
cin >> v;
v = i * m - v;
if(v < 0) continue;
int id = upper_bound(dp.begin(), dp.end(), v) - dp.begin();
if(id == dp.size()) dp.push_back(v);
else dp[id] = v;
}
cout << n - dp.size() << endl;
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... | ||||
