# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
635145 | VasLemmy | Rabbit Carrot (LMIO19_triusis) | C++17 | 34 ms | 6924 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")*/
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ldb = long double;
const int N = 1e4;
const int maxN = 5e5 + 15;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infty = 1e17 + 7;
const int base = 4e5;
const int Block_size = 350;
void InputFile()
{
freopen("cowjog.in","r",stdin);
freopen("cowjog.out","w",stdout);
//freopen("test.out","r",stdin);
}
void FastInput()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int n,M;
int a[maxN];
ll e[maxN];
ll dp[maxN];
void Read()
{
cin >> n >> M;
for(int i = 1;i <= n;i++)
{
cin >> a[i];
a[i] -= i * M;
}
fill(e + 1,e + n + 1,infty);
ll res = 0;
for(int i = n;i >= 1;i--)
{
dp[i] = upper_bound(e + 1,e + n + 1,a[i]) - e;
e[dp[i]] = a[i];
if(a[i] <= 0) res = max(res,dp[i]);
}
cout << n - res;
}
void Solve()
{
}
void Debug()
{
}
int32_t main()
{
FastInput();
//InputFile();
//int sub_type;
//cin >> sub_type;
//Sieve();
//Prepare();
int test;
//cin >> test;
test = 1;
while(test--)
{
Read();
Solve();
//Debug();
}
}
컴파일 시 표준 에러 (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... |