이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i,x,n) for(int i=x; i<n; i++)
#define F0R(i,n) FOR(i,0,n)
#define ROF(i,x,n) for(int i=n-1; i>=x; i--)
#define R0F(i,n) ROF(i,0,n)
#define WTF cout << "WTF" << endl
#define IOS ios::sync_with_stdio(false); cin.tie(0)
#define F first
#define S second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
const int MAXN = 2e5 + 7;
const int ALPHA = 27;
const LL INF = 1e18 + 7;
const int MOD = 1e9 + 7;
const int LOG = 22;
LL n, ns[MAXN], lis[MAXN], m;
int main() {
IOS;
cin >> n >> m;
F0R(i, n) {
cin >> ns[i];
ns[i] -= m * (i + 1);
if (ns[i] > 0) ns[i] = INF;
}
fill(lis + 1, lis + n + 1, INF);
lis[0] = -INF;
R0F(i, n) {
int place = upper_bound(lis, lis + n, ns[i]) - lis;
lis[place] = min(lis[place], ns[i]);
}
int ans = 0;
F0R(i, n + 1) if (lis[i] != INF) ans = i;
cout << n - ans;
}
| # | 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... |