Submission #1360693

#TimeUsernameProblemLanguageResultExecution timeMemory
1360693sim_pleSequence (APIO23_sequence)C++20
Compilation error
0 ms0 KiB
/*
    written by sim_ple
*/
#include "sequence.h"
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define N 500005
#define itn int
#define all(x) x.begin() , x.end()

int solve(int n , vector<int> a){
    int ans = 0;
    for(int l = 0; l < n; l++){
        for(int r = l; r < n; r++){
            vector<int> v;
            for(int i = l; i <= r; i++) v.push_back(a[i]);
            sort(all(v));
            int dif = (r - l);
            int co = 0;
            if(!(dif % 2)){
                int x = dif / 2;
                int val = v[x];
                for(int i = l; i <= r; i++){
                    if(a[i] == val){
                        co++;
                    }
                }
                // cout << "type1: " << co << "bounds: " << l << " " << r << endl;
            }
            else{
                int x1 = (dif - 1) / 2;
                int x2 = dif / 2;
                int val1 = v[x1] , val2 = v[x2];
                for(int i = l; i <= r; i++){
                    if(a[i] == val1 or a[i] == val2){
                        co++;
                    }
                }
                // cout << "type2: " << co << "bounds: " << l << " " << r << endl;
            }
            ans = max(ans , co);
        }
    }
    return ans;
}


// void solve1(){
//     int n;
//     cin >> n;
//     vector<int> a(n + 1);
//     for(int i = 0; i < n; i++){
//         cin >> a[i];
//     }
//     cout << solve(n , a) << endl;
// }

// int32_t main() {
//     ios::sync_with_stdio(0); cin.tie(0);


//     freopen("a.in", "r", stdin);
//     freopen("a.out", "w", stdout);

//     int t = 1;
//     //cin >> t;
//     while(t--) solve1();
//     return 0;
// }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccvgXp55.o: in function `main':
grader.cpp:(.text.startup+0x283): undefined reference to `sequence(int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status