This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Cu code roi se AC
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⡄⢠⡄⣠⠤⢤⡀⣤⠀⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡏⠀⣿⠀⢨⡇⣿⠀⢸⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠈⠉⠉⠀⠈⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⢠⠤⣄⢠⡄⠀⣤⢀⣠⢤⡀⢠⡄⠀⡄⢠⡀⠀⢠⣤⣤⡀⠀⠀⠀⠀
// ⠀⠀⠀⠀⣙⠲⢦⢸⡗⠒⣿⢸⡁⠀⣿⢸⡇⠀⡇⢸⡇⠀⢸⡇⠀⡷⠀⠀⠀⠀
// ⠀⠀⠀⠀⠈⠛⠋⠈⠃⠀⠋⠀⠙⠛⠁⠀⠙⠛⠁⠘⠛⠛⠘⠛⠋⠁⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⢀⡀⢀⠀⡀⠀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡷⣯⠀⢸⠀⡇⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠃⠈⠓⠘⠀⠛⠒⠂⠛⠒⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⣀⠀⢀⡀⢀⣀⡀⠀⡀⠀⣀⢀⣀⣀⡀⢀⣀⣀⠀⣀⣀⡀⣀⠀⠀⢀⣀⣀⠀
// ⠀⠘⢷⠏⢰⡏⠀⢹⠄⡇⠀⣿⢸⣧⢤⡇⠘⠦⣬⡀⡧⠤⠄⣿⠀⠀⢸⠤⠄⠀
// ⠀⠀⠘⠀⠀⠛⠒⠋⠀⠛⠒⠋⠘⠃⠀⠓⠘⠲⠚⠁⠓⠒⠂⠛⠒⠒⠘⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⢀⠀⢀⣀⠀⢀⠀⢀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⢆⣸⢠⡏⠉⢹⡈⣇⡼⣇⣼⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠇⠈⠿⠀⠳⠶⠞⠀⠹⠇⠸⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠄⠄⠄⠄⠄⠄⠄⠄⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄⢀⣀⣀⣀⡀⠄⢀⣠⡔⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣰⢿⣿⣿⣿⣿⣿⣿⣷⡆⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣻⣟⣿⣿⡿⣟⣛⣿⡃⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣧⣿⣾⣿⣷⣿⣷⣿⣿⣿⣷⣽⣹⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⡟⣟⣿⣿⠺⣟⣻⣿⣿⣿⡏⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⡝⠻⠵⠿⠿⢿⣿⣿⢳⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣧⠈⣛⣛⣿⣿⡿⣡⣞⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡧⠄⠙⠛⠛⢁⣴⣿⣿⣷⣿⢿⣿⣿⣿⣿⣿⣿⣿
// ⣿⣿⣿⣿⣿⣿⡿⠟⠉⠄⠄⢠⠄⣀⣠⣾⣿⣿⡿⠟⠁⠄⠈⠛⢿⣿⣿⣿⣿
// ⣿⣿⣿⣿⡟⠉⠄⠄⢀⠠⠐⠒⠐⠾⠿⢟⠋⠁⠄⢀⣀⠠⠐⠄⠂⠈⠻⢿⣿
// ⣿⣿⣿⠋⠁⠄⢀⡈⠄⠄⠄⠄⠄⠄⠄⠄⠁⠒⠉⠄⢠⣶⠄⠄⠄⠄⠄⠈⠫
// ⣿⣿⡟⠄⢔⠆⡀⠄⠈⢀⠄⠄⠄⠄⠄⠄⠄⢄⡀⠄⠈⡐⢠⠒⠄⠄⠄⠄⢀
// ⣿⣿⠁⡀⠄⠄⢇⠄⠄⢈⠆⠄⠄⢀⠔⠉⠁⠉⠉⠣⣖⠉⡂⡔⠂⠄⢀⠔⠁
// ⣿⡿⠄⠄⠄⠄⢰⠹⣗⣺⠤⠄⠰⡎⠄⠄⠄⠄⠄⠄⠘⢯⡶⢟⡠⠰⠄⠄
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using type=ll;
#define taskname "table"
// for Orac
#define tasknamein "table"
#define tasknameout "table"
#define fi first
#define se second
#define sz(v) ((type)(v).size())
#define all(v) (v).begin(), (v).end()
typedef pair<type, type> ii;
typedef vector<ii> vii;
typedef vector<type> vi;
typedef vector<vector<type>> vvi;
//for FFT
using cd = complex<double>;
const double PI = acos(-1);
const type MN=3e5+10;
const type oo=1e18;
const type llmax=0x3f3f3f3f3f3f;
const type INF=1e9;
type n, a[MN], d;
type lis() {
vector<int> d(n+1, INF);
d[0]=-INF;
for (int i=0; i<n; i++) {
int l=upper_bound(d.begin(), d.end(), a[i])-d.begin();
if (d[l-1]<a[i] && a[i]<d[l]) {
d[l]=a[i];
}
}
type ans = 0;
for (int i=0; i<=n; i++) {
if (d[i]<INF)
ans=i;
}
return ans;
}
void read() {
cin >> n >> d;
for(int i=0; i<n; i++) {
cin >> a[i];
}
}
void sol(){
//sub5
if(d==n) {
cout << lis();
}
else {
cout << rand();
}
}
signed main() {
//freopen(taskname".inp", "r", stdin);
//freopen(taskname".out", "w", stdout);
//for Orac
/*
ifstream in("tasknamein.txt");
ofstream out("tasknameout.txt");
*/
ios_base::sync_with_stdio(false);
cin.tie(NULL);
type t;
// cin >> t;
t=1;
while(t--) {
read();
sol();
cout << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |