# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
991248 | ByeWorld | Rabbit Carrot (LMIO19_triusis) | C++14 | 72 ms | 4300 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
// #define int long long
#define fi first
#define se second
#define pb push_back
#define lf ((id<<1))
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> ipii;
const int MAXN = 2e5+10;
const ll MOD = 1e9+7;
const ll INF = 1e18+10;
const int LOG = 21;
int n, m;
int a[MAXN], b[MAXN];
signed main(){
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> m;
for(int i=1; i<=n; i++) cin >> a[i];
int ans = 0;
for(int i=1; i<=n; i++) a[i] -= i*m;
vector <int> vec;
for(int i=1; i<=n; i++){
a[i] = -a[i];
// cout << a[i] << ' ';
if(a[i] < 0) continue;
if(vec.empty()){
vec.pb(a[i]); continue;
}
int idx = upper_bound(vec.begin(), vec.end(), a[i])-vec.begin();
if(idx==vec.size()) vec.pb(a[i]);
else vec[idx] = a[i];
}
cout << n-vec.size() << '\n';
}
컴파일 시 표준 에러 (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... |