# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
757014 | 2023-06-12T12:23:57 Z | Valters07 | Sequence (APIO23_sequence) | C++17 | 945 ms | 74656 KB |
#include <bits/stdc++.h> #include "sequence.h" #define ll long long #define pb push_back #define fi first #define se second using namespace std; int sequence(int n, vector<int> a) { int peak = 0; while(peak+1<n&&a[peak]<=a[peak+1]) peak++; int res = 1, l = 0, r; for(int i = 1;i<n;i++) if(a[i]!=a[i-1]) l=i; else res=max(res,i-l+1); map<int,int> fir, lst, cnt; for(int i = 0;i<n;i++) { if(!fir.count(a[i])) fir[a[i]]=i; lst[a[i]]=i; cnt[a[i]]++; } for(auto x:cnt) { int mi = fir[x.fi]+(n-lst[x.fi]-1), cur = x.se, mx = n-mi-cur; int st = 0; if(mi<mx) st=mx-mi; if(st<=cur) res=max(res,cur); } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 335 ms | 48764 KB | Output is correct |
3 | Correct | 378 ms | 48712 KB | Output is correct |
4 | Correct | 42 ms | 4168 KB | Output is correct |
5 | Correct | 328 ms | 44268 KB | Output is correct |
6 | Correct | 311 ms | 44104 KB | Output is correct |
7 | Correct | 52 ms | 4164 KB | Output is correct |
8 | Correct | 51 ms | 4168 KB | Output is correct |
9 | Correct | 47 ms | 4184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 51 ms | 4168 KB | Output is correct |
3 | Incorrect | 53 ms | 4172 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 945 ms | 74656 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |