답안 #702120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
702120 2023-02-23T04:14:12 Z ifateen Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
0 ms 212 KB
#ifndef ONLINE_JUDGE
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#else
#include <bits/stdc++.h>
#endif
using namespace std;
#define int long long
#define double long double
#define vec vector
#define vi vec<int>
#define pii pair<int,int>
#define vpi vec<pii>
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define pq priority_queue
#define all(v) v.begin(), v.end()


signed main() {
    int n,t;
    cin >> n >> t;
    vi v(n+1,0);
    for (int i = 1; i <= n; i++) cin >> v[i];
    int k = 1;
    vi dp(n+1,-1e18);
    int u = 0;
    for (int i = 1; i <= n; i++) {
        if (v[i] - v[i - 1] > t) dp[i] = k++;
        if (i == 1 and v[i] > t) u++;
    }
    vi liss;
    for (int i = 0; i < dp.size(); i++) {
        int pos = lower_bound(liss.begin(), liss.end(), dp[i]) - liss.begin();
        if (pos == liss.size()) {
            liss.push_back(i);
        } else {
            liss[pos] = i;
        }
    }
    cout << liss.size()+u << endl;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:39:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = 0; i < dp.size(); i++) {
      |                     ~~^~~~~~~~~~~
triusis.cpp:41:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if (pos == liss.size()) {
      |             ~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -