# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
433403 | idas | Rabbit Carrot (LMIO19_triusis) | C++11 | 40 ms | 4136 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define SZ(x) ((int)((x).size()))
#define LE(vec) vec[vec.size()-1]
#define TSTS int t; cin >> t; while(t--)solve()
const int INF = 1e9;
const long long LINF = 1e18;
const long double PI = asin(1)*2;
const int MOD = 1e9+7;
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef long long ll;
typedef long double ld;
void setIO()
{
FAST_IO;
}
void setIO (string s) {
setIO();
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
const int N = 4e5+100;
ll n, m, a[N];
int main()
{
setIO();
cin >> n >> m;
FOR(i, 0, n)
{
cin >> a[i+1];
a[i+1] -= (i+1)*m;
}
vector<ll> ls;
ls.PB(0);
FOR(i, 1, n+1)
{
ll l = 0, r = ls.size();
while(l<r)
{
int m = (l+r)/2;
if(ls[m]>=a[i]) l = m+1;
else r = m;
}
if(l == 0)
{
// if(ls[l+1]<a[i])
// ls[l+1] = a[i];
}
else
{
if(r == (int)ls.size())
{
ls.PB(a[i]);
}
else
{
ls[l] = a[i];
}
}
}
cout << n-(int)ls.size()+1;
}
컴파일 시 표준 에러 (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... |