Submission #1037901

# Submission time Handle Problem Language Result Execution time Memory
1037901 2024-07-29T09:55:51 Z javotaz LIS (INOI20_lis) C++17
20 / 100
58 ms 628 KB
// In the Name of Allah

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

#pragma GCC optimize("Ofast,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,avx,avx2,sse4.2,popcnt,tune=native")

typedef long long ll;

#define F first
#define S second
#define pii pair<int, int>
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
#define int long long

const int N = 2e3 + 12;
int a[N], n, dp[N];

int32_t main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int q;
	cin >> q;
	if (q > 2000)
		return 0;
	while (q--) {
		int p, x;
		cin >> p >> x;
		a[++n] = x;
		for (int i = n; i > p; i--)
			swap(a[i], a[i - 1]);
		memset(dp, 127, sizeof dp);
		int ans = 0;
		for (int i = 0; i <= n; i++)
			dp[lower_bound(dp, dp + n + 1, a[i]) - dp] = a[i];
		for (int i = 0; i <= n; i++)
			if (dp[i] <= 10000000)
				ans = i;
		cout << ans << '\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 22 ms 488 KB Output is correct
4 Correct 32 ms 492 KB Output is correct
5 Correct 34 ms 348 KB Output is correct
6 Correct 58 ms 628 KB Output is correct
7 Correct 24 ms 348 KB Output is correct
8 Correct 37 ms 348 KB Output is correct
9 Correct 24 ms 504 KB Output is correct
10 Correct 23 ms 348 KB Output is correct
11 Correct 24 ms 344 KB Output is correct
12 Correct 58 ms 348 KB Output is correct
13 Correct 37 ms 348 KB Output is correct
14 Correct 34 ms 348 KB Output is correct
15 Correct 36 ms 500 KB Output is correct
16 Correct 33 ms 348 KB Output is correct
17 Correct 50 ms 500 KB Output is correct
18 Correct 51 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 22 ms 488 KB Output is correct
4 Correct 32 ms 492 KB Output is correct
5 Correct 34 ms 348 KB Output is correct
6 Correct 58 ms 628 KB Output is correct
7 Correct 24 ms 348 KB Output is correct
8 Correct 37 ms 348 KB Output is correct
9 Correct 24 ms 504 KB Output is correct
10 Correct 23 ms 348 KB Output is correct
11 Correct 24 ms 344 KB Output is correct
12 Correct 58 ms 348 KB Output is correct
13 Correct 37 ms 348 KB Output is correct
14 Correct 34 ms 348 KB Output is correct
15 Correct 36 ms 500 KB Output is correct
16 Correct 33 ms 348 KB Output is correct
17 Correct 50 ms 500 KB Output is correct
18 Correct 51 ms 348 KB Output is correct
19 Incorrect 0 ms 348 KB Output isn't correct
20 Halted 0 ms 0 KB -