Submission #977057

# Submission time Handle Problem Language Result Execution time Memory
977057 2024-05-07T10:53:07 Z Tsagana Sequence (APIO23_sequence) C++17
Compilation error
0 ms 0 KB
#include "cyberland.h"

//OP
#include <bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define pi pair<int, int >
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define mset multiset
#define F first
#define S second

using namespace std;

struct arr {
  vector<int> v;

  void res() {v.clear();}
  void insert(int x) {
    v.pb(x); sort(all(v));
  }
  pair<int, int> med() {
    int n = v.size();
    if (n % 2 == 1) {
      return {v[n/2], -1};
    }
    else {
      return {v[n/2-1], v[n/2]};
    }
  }
  int calc() {
    pair<int, int> p = med();
    int c1 = 0, c2 = 0;
    for (auto i: v) {
      if (i == p.F) c1++;
      if (i == p.S) c2++;
    }
    return max(c1, c2);
  }
};
int sequence(int N, std::vector<int> A) {
  int ans = 0;
  for (int i = 0; i < N; i++) {
    arr a; a.res();
    for (int j = i; j < N; j++) {
      a.insert(A[j]);
      ans = max(ans, a.calc());
      // for (auto k: a.v) cout << k << ' ';
      // cout << " - " << ans << '\n';
    }
  }
  return ans;
}
//ED

Compilation message

sequence.cpp:1:10: fatal error: cyberland.h: No such file or directory
    1 | #include "cyberland.h"
      |          ^~~~~~~~~~~~~
compilation terminated.