Submission #748965

#TimeUsernameProblemLanguageResultExecution timeMemory
748965model_codeSequence (APIO23_sequence)C++17
11 / 100
2086 ms6340 KiB
#include "sequence.h" #include<bits/stdc++.h> #define re register using namespace std; int t,n,m,a[1000002],ans,b[1000002]; int sequence(int N, std::vector<int> L){ n=N; for(re int i=1;i<=n;++i)a[i]=L[i-1]; for(re int i=1;i<=n;++i){ m=0; for(re int j=i;j<=n;++j){ b[++m]=a[j],sort(b+1,b+m+1); if(m%2==1){ re int s=0; for(re int k=1;k<=m;++k)s+=b[k]==b[m+1>>1]; ans=max(ans,s); } else{ re int s=0; for(re int k=1;k<=m;++k)s+=b[k]==b[m>>1]; ans=max(ans,s),s=0; for(re int k=1;k<=m;++k)s+=b[k]==b[m+2>>1]; ans=max(ans,s); } } } return ans; }

Compilation message (stderr)

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:8:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |  for(re int i=1;i<=n;++i)a[i]=L[i-1];
      |             ^
sequence.cpp:9:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |  for(re int i=1;i<=n;++i){
      |             ^
sequence.cpp:11:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |   for(re int j=i;j<=n;++j){
      |              ^
sequence.cpp:14:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |     re int s=0;
      |            ^
sequence.cpp:15:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |     for(re int k=1;k<=m;++k)s+=b[k]==b[m+1>>1];
      |                ^
sequence.cpp:15:41: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |     for(re int k=1;k<=m;++k)s+=b[k]==b[m+1>>1];
      |                                        ~^~
sequence.cpp:19:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |     re int s=0;
      |            ^
sequence.cpp:20:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |     for(re int k=1;k<=m;++k)s+=b[k]==b[m>>1];
      |                ^
sequence.cpp:22:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |     for(re int k=1;k<=m;++k)s+=b[k]==b[m+2>>1];
      |                ^
sequence.cpp:22:41: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   22 |     for(re int k=1;k<=m;++k)s+=b[k]==b[m+2>>1];
      |                                        ~^~
#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...