| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 964331 | Andrey | Global Warming (CEOI18_glo) | C++14 | 60 ms | 6516 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
long long dude(vector<long long>& haha, long long x) {
long long l = 0,r = haha.size()-1;
while(l < r) {
long long m = (l+r+1)/2;
if(haha[m] < x) {
l = m;
}
else {
r = m-1;
}
}
return l;
}
vector<int> br(200001);
void calc(vector<int> haha) {
reverse(haha.begin(),haha.end());
for(int i = 0; i < haha.size(); i++) {
haha[i] = INT_MAX-haha[i];
}
vector<long long> bruh(haha.size()+1,INT_MAX);
bruh[0] = 0;
for(int i = 0; i < haha.size(); i++) {
int a = haha[i];
int c = dude(bruh,a);
bruh[c+1] = a;
br[haha.size()-i-1] = c+1;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,x,ans = 0;
cin >> n >> x;
vector<int> haha(n);
for(int i = 0; i < n; i++) {
cin >> haha[i];
}
calc(haha);
vector<long long> bruh(n+1,INT_MAX);
bruh[0] = 0;
for(int i = 0; i < n; i++) {
int a = haha[i];
int c = dude(bruh,a+x);
ans = max(ans,c+br[i]);
c = dude(bruh,a);
ans = max(ans,c+1);
bruh[c+1] = a;
}
cout << ans;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
