제출 #785632

#제출 시각아이디문제언어결과실행 시간메모리
785632makanhuliaGlobal Warming (CEOI18_glo)C++17
0 / 100
144 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll findlis(vector<ll> v, ll x, ll prev){ ll sz = v.size(); if(x == sz) return 0; if(x == sz-1){ return findlis(v, x+1, prev); } if(prev == -1) return max(findlis(v, x+1, -1), findlis(v, x+1, x+1)+1); if(v[prev] < v[x+1]) return max(findlis(v, x+1, prev), findlis(v, x+1, x+1)+1); return findlis(v, x+1, prev); } int main(){ vector<ll> t, temp; ll n, x, input, maxlis = 0; cin >> n >> x; for(int i = 0; i < n; i++){ cin >> input; t.push_back(input); } if(x == 0){ cout << findlis(t, 0, -1) << endl; return 0; } for(int k = x*(-1); k <= x; k++){ for(int l = 0; l < n; l++){ temp = t; for(int r = l; r < n; r++){ temp[r] += k; maxlis = max(maxlis, findlis(temp, 0, -1)); } } } cout << maxlis; }
#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...