Submission #6463405


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
int n, m, k, x, y, sum, cnt, ans;
int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	scanf("%d", &n);
	multiset<int>m;
	FOR(i, 0, n-1) {
		scanf("%d", &x);
		if (i==0) {
			m.insert(x);
		  continue;
		}
		auto it = m.lower_bound(x);
		if (it == m.begin()) {
			m.insert(x);
		} else {
			it--;
			int tmp = *it;
			m.erase(it);
			m.insert(x);
		}
	}
	printf("%d\n", m.size());
	
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:49:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::multiset<int>::size_type {aka long unsigned int}’ [-Wformat=]
  printf("%d\n", m.size());
                         ^
./Main.cpp:31:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
./Main.cpp:34:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
                  ^

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 4992 KB
killer_01 AC 49 ms 4864 KB
killer_02 AC 46 ms 4608 KB
killer_03 AC 49 ms 4864 KB
killer_04 AC 43 ms 3328 KB
killer_05 AC 44 ms 3584 KB
many_dup_01 AC 29 ms 256 KB
many_dup_02 AC 29 ms 384 KB
many_dup_03 AC 29 ms 256 KB
many_dup_04 AC 29 ms 512 KB
many_dup_05 AC 29 ms 512 KB
many_dup_06 AC 26 ms 512 KB
many_dup_07 AC 27 ms 1280 KB
many_dup_08 AC 27 ms 1408 KB
many_dup_09 AC 24 ms 1408 KB
many_dup_10 AC 27 ms 2560 KB
many_dup_11 AC 27 ms 1792 KB
many_dup_12 AC 25 ms 1664 KB
rand_max_01 AC 29 ms 256 KB
rand_max_02 AC 28 ms 256 KB
rand_max_03 AC 27 ms 256 KB
rand_max_04 AC 28 ms 256 KB
rand_max_05 AC 27 ms 256 KB
rand_max_06 AC 28 ms 256 KB
rand_max_07 AC 29 ms 256 KB
rand_max_08 AC 28 ms 256 KB
rand_max_09 AC 27 ms 256 KB
rand_max_10 AC 30 ms 256 KB
rand_max_11 AC 28 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sorted_ascending AC 16 ms 256 KB
sorted_descending AC 47 ms 4736 KB
unique_perm_01 AC 26 ms 256 KB
unique_perm_02 AC 26 ms 256 KB