This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define i2 pair<ll,ll>
using namespace std;
int n,x;
int a[200007];
namespace sub2 {
bool check() {
return x == 0;
}
vector<int> b;
void solve() {
for (int i=1; i<=n; i++) {
auto it = lower_bound(b.begin(),b.end(),a[i]);
if (it == b.end()) b.push_back(a[i]);
else *it = a[i];
}
cout << b.size();
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> x;
for (int i=1; i<=n; i++) {
cin >> a[i];
}
if (sub2::check()) {
sub2::solve();
return 0;
}
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |