Submission #444486

# Submission time Handle Problem Language Result Execution time Memory
444486 2021-07-14T07:35:34 Z BT21tata Global Warming (CEOI18_glo) C++17
10 / 100
48 ms 3456 KB
#include<bits/stdc++.h>
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
using namespace std;
const ll MOD=1e9+7;
// mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());

ll n, x, a[1000001],p;
vector<ll> v;

ll bs(ll l, ll r, ll k)
{
    ll mid;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(v[mid]>=k) r=mid-1;
        else l=mid+1;
    }
    return l;
}

ll LIS()
{
    v.resize(n+1, 0);
    v[0]=a[0]; p=1;
    for(ll i=1; i<n; i++)
    {
        if(a[i]>v[p-1]) v[p++]=a[i];
        else v[bs(0,p,a[i])]=a[i];
    }
    return p;
}

int main()
{
    SPEED;
    cin>>n>>x;
    for(int i=0; i<n; i++)
        cin>>a[i];
    cout<<LIS()<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 3436 KB Output is correct
2 Correct 47 ms 3456 KB Output is correct
3 Correct 37 ms 3396 KB Output is correct
4 Correct 48 ms 3436 KB Output is correct
5 Correct 24 ms 3312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1100 KB Output is correct
2 Correct 9 ms 1100 KB Output is correct
3 Correct 10 ms 1100 KB Output is correct
4 Incorrect 6 ms 1100 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -