제출 #144230

#제출 시각아이디문제언어결과실행 시간메모리
144230SwanGlobal Warming (CEOI18_glo)C++14
25 / 100
2050 ms3724 KiB
#include <bits/stdc++.h> #define stop system("pause") #define INP freopen("input.txt","r",stdin) #define OUTP freopen("solve1.txt","w",stdout) using namespace std; typedef long long ll; const int maxn = 200123; ll dp[maxn]; void clean(int mx){ dp[0] = -1e16; for(int i(1);i <=mx;i++)dp[i] = 1e16; } int get_lis(vector<ll>& v){ clean(v.size()); int ans = 0; for(int i(0); i < v.size();i++){ int mx = upper_bound(dp,dp+i+1,v[i])-dp; //cout << mx << ' ' << v[mx-2] << ' ' << v[i] << endl; if(mx!=1 && dp[mx-1] >= v[i])continue; dp[mx] = min(dp[mx],v[i]); ans = max(ans,mx); } return ans; } main() { ios_base::sync_with_stdio(0); ll n,x; cin >> n >> x; vector<ll> v; for(int i(0); i < n;i++){ int w; cin >> w; v.push_back(w); } int ans = 0; if(x == 0){ cout << get_lis(v); return 0; } vector<ll> start; start = v; for(int i(0); i < n;i++){ for(int r(i); r < n;r++){ for(int pl(-x);pl<=-x;pl++){ for(int z(i);z<=r;z++){ v[z]=start[z]+pl; } ans = max(ans,get_lis(v)); } for(int z(i);z<=r;z++)v[z]=start[z]; } } cout << ans; return 0; } /* 6 2 1 2 1 3 2 1 1 0 */

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

glo.cpp: In function 'int get_lis(std::vector<long long int>&)':
glo.cpp:19:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < v.size();i++){
                   ~~^~~~~~~~~~
glo.cpp: At global scope:
glo.cpp:29:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 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...