Submission #1061299

#TimeUsernameProblemLanguageResultExecution timeMemory
1061299MuhammetSequence (APIO23_sequence)C++17
0 / 100
2099 ms7368 KiB
#include <bits/stdc++.h> #include "sequence.h" using namespace std; #define sz(s) (int)s.size() int sequence(int n, vector<int> a) { int ans = 0; for(int i = 0; i < n; i++){ vector <int> v, b(n,0); for(int j = i; j < n; j++){ v.push_back(a[j]); b[a[j]]++; for(int k = sz(v)-2; k >= 0; k--){ if(v[k] > v[k+1]){ swap(v[k],v[k+1]); } else { break; } } int x = sz(v), c = (x-1)/2, c1 = (x/2); ans = max(ans,b[v[c]]); ans = max(ans,b[v[c1]]); } } return ans; }
#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...