Submission #1061455

# Submission time Handle Problem Language Result Execution time Memory
1061455 2024-08-16T09:15:53 Z kwongweng Global Warming (CEOI18_glo) C++17
10 / 100
23 ms 3948 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second

int LIS(vi a){
    int n = a.size();
    vi dp = {a[0]};
    FOR(i,1,n){
        if (dp[dp.size()-1] < a[i]){
            dp.pb(a[i]); continue;
        }
        int pos = lower_bound(dp.begin(), dp.end(), a[i]) - dp.begin();
        dp[pos] = a[i];
    }
    return dp.size();
}
void solve(){
    int n,x; cin>>n>>x;
    vi t(n); FOR(i,0,n) cin>>t[i];
    cout<<LIS(t)<<"\n"; 
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int TC = 1; //cin>>TC;
    while (TC--){
        solve();
    }
    return 0;
}

/*
0 2 4 6
4 5 1 0
4 7 5
*/
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 3804 KB Output is correct
2 Correct 22 ms 3932 KB Output is correct
3 Correct 23 ms 3948 KB Output is correct
4 Correct 22 ms 3928 KB Output is correct
5 Correct 12 ms 3808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1112 KB Output is correct
2 Correct 6 ms 1116 KB Output is correct
3 Correct 6 ms 1116 KB Output is correct
4 Incorrect 3 ms 1368 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 2140 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -