Submission #919647

#TimeUsernameProblemLanguageResultExecution timeMemory
919647JakobZorzSequence (APIO23_sequence)C++17
11 / 100
2052 ms35408 KiB
#include"sequence.h" #include<vector> using namespace std; int n; int arr2[500000]; int tree1[500000]; vector<int>arr[500000]; int sequence(int N,vector<int>A){ n=N; for(int i=0;i<n;i++){ arr[A[i]-1].push_back(i); arr2[i]=A[i]-1; tree1[i]=-1; } int res=0; for(int v=0;v<n;v++){ for(int idx:arr[v]){ tree1[idx]=1; for(int i=0;i<n;i++){ int sum=0,num=0; for(int j=i;j<n;j++){ sum+=tree1[j]; if(arr2[j]==v) num++; if(0<=sum&&sum<=1) res=max(res,num); } } } } return res; }
#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...