Submission #395623

# Submission time Handle Problem Language Result Execution time Memory
395623 2021-04-28T17:11:31 Z Pichon5 Global Warming (CEOI18_glo) C++17
10 / 100
101 ms 4552 KB
#include<bits/stdc++.h>
#define lcm(a,b) (a/__gcd(a,b))*b
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define F first
#define S second
#define mp make_pair
//salida rapida "\n"
//DECIMALES fixed<<sp(n)<<x<<endl;
//gcd(a,b)= ax + by
//lCB x&-x
//set.erase(it) - ersases the element present at the required index//auto it = s.find(element)
//set.find(element) - iterator pointing to the given element if it is present else return pointer pointing to set.end()
//set.lower_bound(element) - iterator pointing to element greater than or equal to the given element
//set.upper_bound(element) - iterator pointing to element greater than the given element
// | ^
//__builtin_popcount(x)
using namespace std;


int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    vll d(n+2,1e9);//pongo a todos como infinito que sería como la "peor" situacióm para cada estado
    d[0]=-1e9;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        int b=1,e=n;
        while(b<=e){
            int mid=(b+e)/2;
            if(a[i]<d[mid] && a[i]>d[mid-1]){
                d[mid]=a[i];

                break;
            }
            if(d[mid]>a[i]){
                e=mid-1;
            }else{
                b=mid+1;
            }
        }
    }
    int res=0;
    for(int i=1;i<=n;i++){
        if(d[i]!=1e9)res=i;
    }
    cout<<res<<endl;
    return 0;
}
//409336628
# 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 99 ms 4552 KB Output is correct
2 Correct 98 ms 4524 KB Output is correct
3 Correct 101 ms 4548 KB Output is correct
4 Correct 100 ms 4540 KB Output is correct
5 Correct 71 ms 3740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1356 KB Output is correct
2 Correct 29 ms 1340 KB Output is correct
3 Correct 25 ms 1348 KB Output is correct
4 Incorrect 18 ms 1112 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 2336 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 -