Submission #6457886


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;
  reverse(begin(A), end(A));
  vector< int > tap(N + 1, inf);
  for(int i = 0; i < N; i++) {
    *upper_bound(begin(tap), end(tap), A[i]) = A[i];
  }
  int q = lower_bound(begin(tap), end(tap), inf) - begin(tap);
  cout << q << endl;
}





Submission Info

Submission Time
Task E - Sequence Decomposing
User ei13333
Language C++14 (GCC 5.4.1)
Score 500
Code Size 2428 Byte
Status
Exec Time 17 ms
Memory 1024 KB

Judge Result

Set Name Score / Max Score Test Cases
All 500 / 500 all_same, killer_01, killer_02, killer_03, killer_04, killer_05, many_dup_01, many_dup_02, many_dup_03, many_dup_04, many_dup_05, many_dup_06, many_dup_07, many_dup_08, many_dup_09, many_dup_10, many_dup_11, many_dup_12, rand_max_01, rand_max_02, rand_max_03, rand_max_04, rand_max_05, rand_max_06, rand_max_07, rand_max_08, rand_max_09, rand_max_10, rand_max_11, sample_01, sample_02, sorted_ascending, sorted_descending, unique_perm_01, unique_perm_02
Sample 0 / 0 sample_01, sample_02
Case Name Status Exec Time Memory
all_same 17 ms 1024 KB
killer_01 16 ms 1024 KB
killer_02 15 ms 1024 KB
killer_03 16 ms 1024 KB
killer_04 15 ms 1024 KB
killer_05 17 ms 1024 KB
many_dup_01 16 ms 1024 KB
many_dup_02 16 ms 1024 KB
many_dup_03 15 ms 1024 KB
many_dup_04 16 ms 1024 KB
many_dup_05 16 ms 1024 KB
many_dup_06 15 ms 1024 KB
many_dup_07 17 ms 1024 KB
many_dup_08 16 ms 1024 KB
many_dup_09 15 ms 1024 KB
many_dup_10 16 ms 1024 KB
many_dup_11 16 ms 1024 KB
many_dup_12 15 ms 1024 KB
rand_max_01 16 ms 1024 KB
rand_max_02 15 ms 1024 KB
rand_max_03 15 ms 1024 KB
rand_max_04 15 ms 1024 KB
rand_max_05 15 ms 1024 KB
rand_max_06 15 ms 1024 KB
rand_max_07 15 ms 1024 KB
rand_max_08 16 ms 1024 KB
rand_max_09 15 ms 1024 KB
rand_max_10 16 ms 1024 KB
rand_max_11 15 ms 1024 KB
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sorted_ascending 10 ms 1024 KB
sorted_descending 13 ms 1024 KB
unique_perm_01 13 ms 1024 KB
unique_perm_02 14 ms 1024 KB