Submission #6467736


Source Code Expand

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

ll solve() {
    ll N;
    cin >> N;
    map<ll, int> num;
    ll a;
    for ( int i = 0; i < N; i++ ) {
        cin >> a;
        a = -a;
        auto x = num.upper_bound(a);
        if ( x == num.end() ) {
            num[a]++;
        } else {
            num[a]++;
            num[x->first]--;
            if ( num[x->first] == 0 ) {
                num.erase(x->first);
            }
        }
    }
    ll s = 0;
    for( auto x : num ) {
        s += x.second;
    }
    return s;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Submission Info

Submission Time
Task E - Sequence Decomposing
User qxa
Language C++14 (GCC 5.4.1)
Score 500
Code Size 671 Byte
Status AC
Exec Time 100 ms
Memory 6400 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 44 ms 256 KB
killer_01 AC 97 ms 6400 KB
killer_02 AC 94 ms 6016 KB
killer_03 AC 100 ms 6400 KB
killer_04 AC 81 ms 4352 KB
killer_05 AC 80 ms 4608 KB
many_dup_01 AC 59 ms 256 KB
many_dup_02 AC 56 ms 256 KB
many_dup_03 AC 58 ms 256 KB
many_dup_04 AC 45 ms 256 KB
many_dup_05 AC 44 ms 256 KB
many_dup_06 AC 41 ms 256 KB
many_dup_07 AC 42 ms 256 KB
many_dup_08 AC 41 ms 256 KB
many_dup_09 AC 38 ms 256 KB
many_dup_10 AC 41 ms 256 KB
many_dup_11 AC 43 ms 256 KB
many_dup_12 AC 38 ms 256 KB
rand_max_01 AC 71 ms 256 KB
rand_max_02 AC 68 ms 256 KB
rand_max_03 AC 66 ms 256 KB
rand_max_04 AC 68 ms 256 KB
rand_max_05 AC 66 ms 256 KB
rand_max_06 AC 68 ms 256 KB
rand_max_07 AC 69 ms 256 KB
rand_max_08 AC 69 ms 256 KB
rand_max_09 AC 67 ms 256 KB
rand_max_10 AC 72 ms 256 KB
rand_max_11 AC 70 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sorted_ascending AC 34 ms 256 KB
sorted_descending AC 86 ms 6272 KB
unique_perm_01 AC 58 ms 256 KB
unique_perm_02 AC 58 ms 256 KB