Submission #977932

#TimeUsernameProblemLanguageResultExecution timeMemory
977932NexusSequence (APIO23_sequence)C++17
0 / 100
89 ms31828 KiB
//#include "sequence.h" #include <bits/stdc++.h> #define ll long long #define mid (r+l)/2 using namespace std; const ll N=5e5+9,M=2e18+9,mod=1e9+7; ll n,x,y,z; vector<ll>v[N]; int sequence(int N, vector<int> A) { x=1; for(ll i=0;i<N;++i) v[A[i]].push_back(i); for(ll i=1;i<=N;++i) { if(v[i].size()<2)continue; y=v[i][v[i].size()-1]-v[i][0]; z=y-v[i].size(); if(z<=N/2)x=max(x,(ll)v[i].size()); } return x; } /* int main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>n; vector<int>g(n); for(auto &i:g)cin>>i; cout<<sequence(n,g); } */
#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...