Submission #899010

# Submission time Handle Problem Language Result Execution time Memory
899010 2024-01-05T10:48:58 Z efedmrlr Sequence (APIO23_sequence) C++17
0 / 100
40 ms 12372 KB
// #pragma GCC optimize("O1,O2,O3,unroll-loops,Ofast")
// #pragma GCC target("avx2")
#include <bits/stdc++.h>
 
#include "sequence.h";
using namespace std;
 
 
#define lli long long int
#define MP make_pair
#define pb push_back
#define REP(i,n) for(int i = 0; (i) < (n); (i)++)

void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
 
 
const double EPS = 0.00001;
const int INF = 1e9+900;
const int N = 3e5+5;
const int ALPH = 26;
const int LGN = 25;
const int MOD = 1e9+7;
const int MXA = 1e9+5;
int n,m,q;

int sequence(int n, vector<int> a) {
    int ans = 1;
    for(int l = 0; l<n; l++) {
        for(int r = l; r<n; r++) {
            vector<int> tmp, freq(n + 1, 0);
            for(int i = l; i<r; i++) {
                tmp.pb(a[i]);
                freq[a[i]]++;
            }
            sort(tmp.begin(), tmp.end());
            ans = max(ans , freq[tmp[tmp.size() / 2] ]);  
            if(tmp.size() % 2 == 0) {
                ans = max(ans , freq[tmp[tmp.size() / 2 - 1] ]);  
            }          
        }
    }
    return ans;
}

Compilation message

sequence.cpp:5:22: warning: extra tokens at end of #include directive
    5 | #include "sequence.h";
      |                      ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 12372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -