Submission #6457374


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i != n; ++i)
        cin >> arr[i];
    
    vector<int> tmp(1, arr[0]);
    for (int i = 1; i != n; ++i)
    {
        int l = -1;
        int r = tmp.size();
        
        while (r - l != 1)
        {
            int m = l + r >> 1;
            
            if (tmp[m] >= arr[i])
                l = m;
            else
                r = m;
        }
        
        if (r == tmp.size())
            tmp.push_back(arr[i]);
        else
            tmp[r] = max(tmp[r], arr[i]);
    }
    
    cout << tmp.size() << '\n';
    
    return 0;
}

Submission Info

Submission Time
Task E - Sequence Decomposing
User keima915
Language C++14 (GCC 5.4.1)
Score 500
Code Size 763 Byte
Status AC
Exec Time 18 ms
Memory 1276 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 18 ms 1276 KB
killer_01 AC 17 ms 1276 KB
killer_02 AC 16 ms 1276 KB
killer_03 AC 17 ms 1276 KB
killer_04 AC 17 ms 1276 KB
killer_05 AC 17 ms 1276 KB
many_dup_01 AC 14 ms 640 KB
many_dup_02 AC 14 ms 640 KB
many_dup_03 AC 14 ms 640 KB
many_dup_04 AC 15 ms 640 KB
many_dup_05 AC 16 ms 768 KB
many_dup_06 AC 14 ms 640 KB
many_dup_07 AC 17 ms 896 KB
many_dup_08 AC 17 ms 896 KB
many_dup_09 AC 15 ms 896 KB
many_dup_10 AC 17 ms 1024 KB
many_dup_11 AC 17 ms 1024 KB
many_dup_12 AC 16 ms 896 KB
rand_max_01 AC 14 ms 640 KB
rand_max_02 AC 13 ms 640 KB
rand_max_03 AC 13 ms 640 KB
rand_max_04 AC 13 ms 640 KB
rand_max_05 AC 13 ms 640 KB
rand_max_06 AC 13 ms 640 KB
rand_max_07 AC 13 ms 640 KB
rand_max_08 AC 14 ms 640 KB
rand_max_09 AC 13 ms 640 KB
rand_max_10 AC 14 ms 640 KB
rand_max_11 AC 13 ms 640 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sorted_ascending AC 9 ms 640 KB
sorted_descending AC 15 ms 1276 KB
unique_perm_01 AC 11 ms 640 KB
unique_perm_02 AC 12 ms 640 KB