| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1304120 | dex111222333444555 | Rabbit Carrot (LMIO19_triusis) | C++20 | 23 ms | 2364 KiB |
#include <bits/stdc++.h>
#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ii pair<int, int>
#define fi first
#define se second
#define all(v) begin(v), end(v)
#define siz(v) (int)(v).size()
using namespace std;
const int MAXN = 2e5 + 4, mod = 1e9 + 7, MAXB = 20;
template<class X, class Y> bool minimize(X &x, const Y &y){return x > y ? x = y, 1: 0;}
template<class X, class Y> bool maximize(X &x, const Y &y){return x < y ? x = y, 1: 0;}
void add(int &a, const int &b){
a += b;
if (a >= mod) a -= mod;
}
void sub(int &a, const int &b){
a -= b;
if (a < 0) a += mod;
}
int mul(const int &a, const int &b){
return 1LL * a * 1LL * b % mod;
}
int numHeight, height[MAXN], change;
bool mark[MAXN];
void input(){
cin >> numHeight >> change;
for(int i = 1; i <= numHeight; i++) cin >> height[i];
}
void solve(){
vector<int> lis;
for(int i = numHeight; i >= 1; i--){
vector<int>::iterator it = upper_bound(all(lis), height[i] - i * change);
if (it == end(lis)) lis.push_back(height[i] - i * change);
else *it = height[i] - i * change;
}
cout << numHeight - (upper_bound(all(lis), 0) - begin(lis)) << '\n';
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define task "test"
if (fopen(task".inp", "r")){
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
input();
solve();
}
컴파일 시 표준 에러 (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... | ||||
