Submission #954139

#TimeUsernameProblemLanguageResultExecution timeMemory
954139OtalpSequence (APIO23_sequence)C++17
11 / 100
2095 ms7628 KiB
#include "sequence.h" #include <bits/stdc++.h> using namespace std; int sequence(int n, vector<int> a) { int ans = 0; for(int i=0; i<n; i++){ int sum=0, col=0; for(int j=i; j>=0; j--){ if(a[i] == a[j]) col++; if(a[i] < a[j]) sum --; if(a[i] > a[j]) sum ++; if(abs(sum) <= col) ans = max(ans, col); //cout<<i<<' '<<j<<' '<<col<<' '<<sum<<'\n'; } } 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...