Submission #6464108


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
  int n;cin>>n;
  int a[n];rep(i,n)cin>>a[i];
  int m=1e9+7;
  int ctr=0;
  vector<int> p(2*n+5);
  rep(i,n)p[i]=-1;
  rep(i,n,2*n+5)p[i]=mod;
  rep(i,n){
    auto it=lower_bound(all(p),a[i]);
    --it;
    *it=a[i];
  }
  rep(i,2*n+5){
    if(p[i]!=-1&&p[i]!=mod)ctr++;
  }
  cout<<ctr<<endl;
}

Submission Info

Submission Time
Task E - Sequence Decomposing
User meimon
Language C++14 (GCC 5.4.1)
Score 500
Code Size 886 Byte
Status AC
Exec Time 49 ms
Memory 1408 KB

Judge Result

Set Name All Sample
Score / Max Score 500 / 500 0 / 0
Status
AC × 35
AC × 2
Set Name Test Cases
All 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 sample_01, sample_02
Case Name Status Exec Time Memory
all_same AC 49 ms 1408 KB
killer_01 AC 46 ms 1408 KB
killer_02 AC 43 ms 1280 KB
killer_03 AC 45 ms 1408 KB
killer_04 AC 45 ms 1408 KB
killer_05 AC 46 ms 1408 KB
many_dup_01 AC 44 ms 1408 KB
many_dup_02 AC 45 ms 1408 KB
many_dup_03 AC 44 ms 1280 KB
many_dup_04 AC 46 ms 1408 KB
many_dup_05 AC 47 ms 1408 KB
many_dup_06 AC 43 ms 1280 KB
many_dup_07 AC 46 ms 1408 KB
many_dup_08 AC 46 ms 1408 KB
many_dup_09 AC 42 ms 1280 KB
many_dup_10 AC 46 ms 1408 KB
many_dup_11 AC 47 ms 1408 KB
many_dup_12 AC 42 ms 1280 KB
rand_max_01 AC 45 ms 1408 KB
rand_max_02 AC 43 ms 1280 KB
rand_max_03 AC 42 ms 1280 KB
rand_max_04 AC 44 ms 1280 KB
rand_max_05 AC 42 ms 1280 KB
rand_max_06 AC 43 ms 1280 KB
rand_max_07 AC 44 ms 1408 KB
rand_max_08 AC 47 ms 1408 KB
rand_max_09 AC 43 ms 1280 KB
rand_max_10 AC 46 ms 1408 KB
rand_max_11 AC 43 ms 1280 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sorted_ascending AC 31 ms 1408 KB
sorted_descending AC 33 ms 1408 KB
unique_perm_01 AC 33 ms 1280 KB
unique_perm_02 AC 33 ms 1408 KB