Submission #388492

#TimeUsernameProblemLanguageResultExecution timeMemory
388492IwanttobreakfreeGlobal Warming (CEOI18_glo)C++17
0 / 100
213 ms262148 KiB
#include <iostream> #include <vector> #include <set> using namespace std; int main(){ int n,x,maxi=0; cin>>n>>x; vector<int>list(n); for(int i=0;i<n;i++){ cin>>list[i]; } vector<vector<pair<int,set<int> > > >DP(n,vector<pair<int,set<int> > >(n)); vector<bool> visto(n,false); pair<int,set<int> > maximo; for(int i=0;i<n;i++){ DP[i][i].first=list[i]; DP[i][i].second.insert(i); maximo=DP[i][i]; for(int j=i+1;j<n;j++){ for(int q=i;q<j;q++){ if(list[j]>DP[i][q].first&&DP[i][q].second.size()+1>DP[i][j].second.size()){ DP[i][j]=DP[i][q]; DP[i][j].first=list[j]; DP[i][j].second.insert(j); if(DP[i][j].second.size()>maximo.second.size())maximo=DP[i][j]; } } if(DP[i][j].first==0)DP[i][j]=maximo; } int t=maximo.second.size(); maxi=max(t,maxi); } cout<<maxi; }
#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...