Submission #837910

# Submission time Handle Problem Language Result Execution time Memory
837910 2023-08-25T19:56:40 Z beaconmc Sequence (APIO23_sequence) C++17
28 / 100
2000 ms 70060 KB
#include "sequence.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;

using namespace std;
using namespace __gnu_pbds;

#define FOR(i, x, y) for(int i=x; i<y; i++)
#define FORNEG(i, x, y) for(int i=x; i>y; i--)
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)



int sequence(int N, vector<int> A) {
  ll ans = 0;
  FOR(i,0,N){
    map<ll, ll> idk;
    ordered_set sus;
    FOR(j, i, N){
      idk[A[j]]++;
      sus.insert(A[j]);

      ll pos1 = (sus.size()-1)/2;
      ll pos2 = ((ll)sus.size()-2)/2+1;



      ll temp = 0;
      temp = idk[*sus.find_by_order(pos1)];

      temp = max(temp, idk[*sus.find_by_order(pos2)]);

      ans = max(ans, temp);
    }
  }
  return ans;
}
# 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 1 ms 300 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 ms 304 KB Output is correct
# 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 1 ms 300 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 ms 304 KB Output is correct
13 Correct 651 ms 508 KB Output is correct
14 Correct 634 ms 508 KB Output is correct
15 Correct 429 ms 424 KB Output is correct
16 Correct 466 ms 432 KB Output is correct
17 Correct 365 ms 552 KB Output is correct
18 Correct 577 ms 548 KB Output is correct
19 Correct 622 ms 496 KB Output is correct
20 Correct 609 ms 492 KB Output is correct
21 Correct 654 ms 492 KB Output is correct
22 Correct 706 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 2028 ms 58560 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 2053 ms 36464 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2062 ms 70060 KB Time limit exceeded
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 1 ms 300 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 ms 304 KB Output is correct
13 Correct 651 ms 508 KB Output is correct
14 Correct 634 ms 508 KB Output is correct
15 Correct 429 ms 424 KB Output is correct
16 Correct 466 ms 432 KB Output is correct
17 Correct 365 ms 552 KB Output is correct
18 Correct 577 ms 548 KB Output is correct
19 Correct 622 ms 496 KB Output is correct
20 Correct 609 ms 492 KB Output is correct
21 Correct 654 ms 492 KB Output is correct
22 Correct 706 ms 496 KB Output is correct
23 Execution timed out 2071 ms 9524 KB Time limit exceeded
24 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 1 ms 300 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 ms 304 KB Output is correct
13 Correct 651 ms 508 KB Output is correct
14 Correct 634 ms 508 KB Output is correct
15 Correct 429 ms 424 KB Output is correct
16 Correct 466 ms 432 KB Output is correct
17 Correct 365 ms 552 KB Output is correct
18 Correct 577 ms 548 KB Output is correct
19 Correct 622 ms 496 KB Output is correct
20 Correct 609 ms 492 KB Output is correct
21 Correct 654 ms 492 KB Output is correct
22 Correct 706 ms 496 KB Output is correct
23 Execution timed out 2028 ms 58560 KB Time limit exceeded
24 Halted 0 ms 0 KB -