Submission #144166

#TimeUsernameProblemLanguageResultExecution timeMemory
144166SwanGlobal Warming (CEOI18_glo)C++14
0 / 100
41 ms5608 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; if(mx!=1 && v[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); } cout << get_lis(v); return 0; } /* 6 2 1 2 1 3 2 1 1 0 */

Compilation message (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:28: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...