# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
969691 | 2024-04-25T13:13:18 Z | vjudge1 | Global Warming (CEOI18_glo) | C++17 | 48 ms | 2528 KB |
#include<bits/stdc++.h> using namespace std; int arr[200007]; int main() { cin.tie(nullptr)->ios::sync_with_stdio(0); int n,d; cin>>n>>d; for(int i=0;i<n;i++)cin>>arr[i]; vector<int> dp; int ans=0,pref[200007]={}; for(int i=0;i<n;i++) { int idx=lower_bound(dp.begin(),dp.end(),arr[i])-dp.begin(); if(idx==dp.size())dp.push_back(arr[i]); else dp[idx]=arr[i]; pref[i]=idx+1; } ans=dp.size(); dp.clear(); for(int i=n-1;i>=0;i--) { int idx=lower_bound(dp.begin(),dp.end(),-arr[i]+d)-dp.begin(); ans=max(ans,pref[i]+idx); idx = upper_bound(dp.begin(),dp.end(),-arr[i])-dp.begin(); if(idx==dp.size())dp.push_back(-arr[i]); else dp[idx]=-arr[i]; } cout<<ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 2012 KB | Output is correct |
2 | Correct | 44 ms | 2004 KB | Output is correct |
3 | Correct | 44 ms | 1984 KB | Output is correct |
4 | Correct | 44 ms | 1884 KB | Output is correct |
5 | Incorrect | 21 ms | 2528 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1372 KB | Output is correct |
2 | Correct | 11 ms | 1372 KB | Output is correct |
3 | Correct | 10 ms | 1368 KB | Output is correct |
4 | Incorrect | 7 ms | 1628 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 1624 KB | Output is correct |
2 | Correct | 18 ms | 1636 KB | Output is correct |
3 | Correct | 38 ms | 2260 KB | Output is correct |
4 | Incorrect | 20 ms | 2528 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |