| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 625954 | EthanKim8683 | Rabbit Carrot (LMIO19_triusis) | C++17 | 27 ms | 4104 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
using I=int;
/*
Firstly, each pole must be subtracted
by the jump height multiplied by their
index because:
let x=current pole height
let y=next pole height
let j=jump height
x+j>=y, therefore x>=y-j
Then, subtract the length of the LDS
from the total length, representing the
amount of poles needing adjustment to
conform to x>=y-j.
Though, note that the LDS must start
with 0, representing the unadjustable
starting point.
*/
const I N=200000;
I a_arr[N];
vector<I>dp;
I main(){
cin.tie(0)->sync_with_stdio(0);
I n,m;cin>>n>>m;
for(I i=0;i<n;i++)cin>>a_arr[i];
for(I i=0;i<n;i++)a_arr[i]-=(i+1)*m;
reverse(a_arr,a_arr+n);
for(I i=0;i<n;i++){
I a=a_arr[i];
if(a>0)continue;
auto it=upper_bound(dp.begin(),dp.end(),a);
if(it==dp.end())dp.push_back(a);
else *it=a;
}
printf("%i\n",n-dp.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... | ||||
