| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1284771 | Haanhtien | Global Warming (CEOI18_glo) | C++17 | 24 ms | 2728 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a), _b=(b); i<=_b; i++)
#define FORD(i, a, b) for(int i=(a), _b=(b); i>=_b; i--)
#define BIT(i, j) ((i>>j)&1)
#define pb push_back
#define ii pair<ll, ll>
#define pii pair<ll, ii>
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const ll inf = 1e18;
const ll mod = 1e9+7;
const ll N = 200005;
const ll M = 50005;
int n;
ll x;
ll f[N], len, a[N];
void solve()
{
cin >> n >> x;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++)
{
if (a[i] > f[len])
{
f[++len] = a[i];
}
else
{
int vt = lower_bound(f, f + len + 1, a[i]) - f;
f[vt] = a[i];
}
}
cout << len;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
#define task "bseq"
if(fopen(task".inp", "r"))
{
freopen(task".INP", "r", stdin);
freopen(task".OUT", "w", stdout);
}
solve();
return 0;
}
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
