Submission #337586

# Submission time Handle Problem Language Result Execution time Memory
337586 2020-12-21T07:09:25 Z Azimjon Global Warming (CEOI18_glo) C++17
10 / 100
44 ms 7020 KB
// Muallif: Azimjon Mehmonali o'g'li

//=========================================================

//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unroll-loops")

//=========================================================
#ifdef DEBUG
#define xtp xtp1
#else
#define xtp(x)
#endif
//=========================================================

#include <bits/stdc++.h>

using namespace std;

#define int long long

typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define F first
#define S second
#define pb push_back
#define endl "\n"

#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(ALL(a))
#define rSORT(a) sort(rALL(a))
#define REV(a) reverse(ALL(a))
#define sqr(x) ((x) * (x))

#define TEZ                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);

const long double PI = 3.1415926535897;
const int mod = 1000000007LL;
const int INF = 1e18;

const int N = 2e5 + 10;

signed main() {
	TEZ;

	int n, x;
	cin >> n >> x;

	vi a(n, 0);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	vi l(n + 1, INF), d(n + 1, -INF);
	l[0] = -INF;
	int o = 0;

	for (int i = 0; i < n; i++) {
		int x = lower_bound(l.begin(), l.begin() + o + 1, a[i]) - l.begin();
		d[i] = x;
		l[x] = a[i];
		if (o < x) {
			o = x;
		}
		// xtp(l);
	}

	cout << *max_element(ALL(d)) << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 44 ms 4972 KB Output is correct
2 Correct 39 ms 7020 KB Output is correct
3 Correct 38 ms 7020 KB Output is correct
4 Correct 37 ms 7020 KB Output is correct
5 Correct 27 ms 6168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1516 KB Output is correct
2 Correct 10 ms 2028 KB Output is correct
3 Correct 10 ms 2028 KB Output is correct
4 Incorrect 7 ms 1772 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 2668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -