Submission #10083500


Source Code Expand

Copy
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    int a[n];
    rep(i,0,n)cin>>a[i];
    multiset<int> st;
    rep(i,0,n){
        auto itr=st.lower_bound(a[i]);
        if(itr==st.begin()){
            st.insert(a[i]);
            continue;
        }
        itr--;
        st.erase(itr);
        st.insert(a[i]);
    }
    cout<<st.size()<<endl;
}

Submission Info

Submission Time
Task E - Sequence Decomposing
User ttttan
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1720 Byte
Status AC
Exec Time 48 ms
Memory 5376 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 42 ms 5376 KB
killer_01 AC 47 ms 5248 KB
killer_02 AC 44 ms 4992 KB
killer_03 AC 48 ms 5248 KB
killer_04 AC 40 ms 3712 KB
killer_05 AC 44 ms 3968 KB
many_dup_01 AC 26 ms 640 KB
many_dup_02 AC 26 ms 640 KB
many_dup_03 AC 26 ms 640 KB
many_dup_04 AC 27 ms 768 KB
many_dup_05 AC 26 ms 896 KB
many_dup_06 AC 29 ms 896 KB
many_dup_07 AC 25 ms 1664 KB
many_dup_08 AC 25 ms 1792 KB
many_dup_09 AC 22 ms 1664 KB
many_dup_10 AC 24 ms 2944 KB
many_dup_11 AC 24 ms 2176 KB
many_dup_12 AC 24 ms 2048 KB
rand_max_01 AC 26 ms 640 KB
rand_max_02 AC 25 ms 640 KB
rand_max_03 AC 25 ms 640 KB
rand_max_04 AC 25 ms 640 KB
rand_max_05 AC 25 ms 640 KB
rand_max_06 AC 25 ms 640 KB
rand_max_07 AC 26 ms 640 KB
rand_max_08 AC 26 ms 640 KB
rand_max_09 AC 25 ms 640 KB
rand_max_10 AC 27 ms 640 KB
rand_max_11 AC 25 ms 640 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sorted_ascending AC 13 ms 640 KB
sorted_descending AC 44 ms 5120 KB
unique_perm_01 AC 24 ms 640 KB
unique_perm_02 AC 24 ms 640 KB