제출 #748658

#제출 시각아이디문제언어결과실행 시간메모리
748658peraGlobal Warming (CEOI18_glo)C++14
100 / 100
61 ms6972 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define int ll const ll mod = 1e9 + 7; main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); int n , x;cin >> n >> x; vector<int> a(n) , s(n); vector<int> dp(n , LLONG_MAX); int ans = 0; for(int i = 0;i < n;i ++){ cin >> a[i]; int w = lower_bound(all(dp) , a[i]) - dp.begin(); dp[w] = a[i]; s[i] = w + 1; ans = max(ans , s[i]); } for(int i = 0;i < n;i ++) dp[i] = LLONG_MAX; for(int i = n - 1;i > -1;i --){ int j = lower_bound(all(dp) , x - a[i]) - dp.begin(); int y = lower_bound(all(dp) , -a[i]) - dp.begin(); //cout << s[i] << " " << j << endl; ans = max(ans , s[i] + j); dp[y] = -a[i]; } cout << ans << endl; }

컴파일 시 표준 에러 (stderr) 메시지

glo.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...