# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37184 | Ulugbek_Abdimanabov | Money (IZhO17_money) | C++14 | 0 ms | 21548 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Solution by Zhusupov Nurlan
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef map<string , int> MSI;
typedef vector<int> VI;
typedef pair<int, int> PII;
#define endl '\n'
#define pb(x) push_back(x)
#define sqr(x) ((x) * (x))
#define F first
#define S second
#define SZ(t) ((int) t.size())
#define len(t) ((int) t.length())
#define base LL(1e9 + 7)
#define fname "money."
#define sz 1000 * 1000
#define EPS (1e-8)
#define INF ((int)1e9 + 9)
#define mp make_pair
int n, a[sz], ans, d[sz], was[sz];
PII b[sz];
int main()
{
freopen(fname"in", "r", stdin);
freopen(fname"out", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
d[i] = INF;
}
for (int i = 1; i <= n; i++) {
int l = 0, r = n + 1;
while (r - l > 1) {
int m = (l + r) >> 1;
if (a[i] <= d[m])
r = m;
else
l = m;
}
ans = max(ans, r);
d[r] = a[i];
}
cout << ans << "\n";
}
Compilation message (stderr)
# | 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... |