답안 #1096452

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1096452 2024-10-04T13:17:30 Z quangnamoiracvl_ralaidecu Global Warming (CEOI18_glo) C++14
10 / 100
227 ms 15184 KB
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5, mod = 1e9;
 
int n,k,a[N],st[4*N], dp[N], dpv[N],l[N], b[N]; map<int,int> s;
 
void update(int id, int l, int r, int pos, int val){
    if(pos < l || pos > r) return;
    if(l == r){
       st[id] = val ;
       return;
    }
    int mid = (l+r)/2;
    update(id*2, l, mid, pos, val);
    update(id*2+1, mid+1, r, pos, val);
    st[id] = max(st[id*2] , st[id*2+1]) ;
}
 
int get(int id, int l, int r, int u, int v){
    if(r < u || l > v) return 0;
    if(l >= u && r <= v) return st[id];
 
    int mid = (l+r)/2;
    return max(get(id*2, l, mid, u, v) , get(id*2+1, mid+1, r, u, v)) ;
}
 
signed main()   
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0); 
    cin >> n >> k; for ( int i = 1; i <= n; i++ ) 
      {
        cin >> a[i]; 
        s[a[i]] = 1;
      }
      s[k]++;
    int d = 0; 
    for ( auto v : s ) {
        d++;
        s[v.first] = d;
    }
    k = s[k];
    for ( int i = 1; i <= n; i++ ) {
        a[i] = s[a[i]];
        // yêu thảo nguyên vl
    }
    int ans = -1;
    for ( int i = 1; i <= n; i++ ) {
        dp[i] = get(1,1,d,1,a[i] - 1) + 1;
      ans = max( ans, dp[i]);
        update(1,1,d,a[i],dp[i]);
    }
  
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 213 ms 15176 KB Output is correct
2 Correct 227 ms 15168 KB Output is correct
3 Correct 202 ms 15164 KB Output is correct
4 Correct 207 ms 15184 KB Output is correct
5 Correct 97 ms 8788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 4176 KB Output is correct
2 Correct 40 ms 4180 KB Output is correct
3 Correct 39 ms 4192 KB Output is correct
4 Incorrect 18 ms 2396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 89 ms 7824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -