답안 #1109815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109815 2024-11-07T17:13:17 Z SzBence Global Warming (CEOI18_glo) C++17
27 / 100
34 ms 3560 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,x;
    cin >>n >> x;
    vector<int>v(n);
    for(int i = 0; i < n; i++){
        cin >>v[i];
    }
    vector<int>dp(n+1,LLONG_MAX);
    dp[0] = 0;
    int maxi = 0;
    for(int i = 0;i < n; i++){
        int j = lower_bound(dp.begin(), dp.end(), v[i]+x)-dp.begin();
        maxi = max(maxi, j);
        dp[j] = v[i]+x;
        dp[lower_bound(dp.begin(), dp.end(), v[i])- dp.begin()] = v[i];
        //cout << dp;
    }
    cout << maxi;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Incorrect 1 ms 336 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Incorrect 1 ms 336 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Incorrect 1 ms 336 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 3560 KB Output is correct
2 Correct 30 ms 3408 KB Output is correct
3 Correct 31 ms 3408 KB Output is correct
4 Correct 30 ms 3560 KB Output is correct
5 Correct 22 ms 3408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1104 KB Output is correct
2 Correct 7 ms 1248 KB Output is correct
3 Correct 7 ms 1104 KB Output is correct
4 Incorrect 9 ms 1104 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1872 KB Output is correct
2 Correct 16 ms 1872 KB Output is correct
3 Correct 34 ms 3408 KB Output is correct
4 Correct 24 ms 3408 KB Output is correct
5 Correct 12 ms 1872 KB Output is correct
6 Correct 21 ms 3408 KB Output is correct
7 Correct 24 ms 3408 KB Output is correct
8 Correct 14 ms 1872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Incorrect 1 ms 336 KB Output isn't correct
11 Halted 0 ms 0 KB -