제출 #640374

#제출 시각아이디문제언어결과실행 시간메모리
640374NafeeszxRabbit Carrot (LMIO19_triusis)C++14
100 / 100
95 ms6840 KiB
#include <bits/stdc++.h>
using namespace std;
#define trav(a, x) for(auto& a : x)
#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define ROF(i, a, b) for (int i=(a); i>=(signed)(b); i--)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define vi vector<int>
#define vvl vector<vector<ll>>
#define all(v) (v).bebbin(), (v).end()
typedef long long ll;

void setIO(string name = "") { 
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(name.size()){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

const int MAXN = 2e5;
const ll mod = 1e9 + 7, MOD = 998244353;


int lnds(vector<ll> &a) {
    vector<ll> dp;
    trav(u, a) {
        int j = upper_bound(dp.begin(), dp.end(), u) - dp.begin();
        if(j == dp.size()) {
            dp.push_back(u);
        } else {
            dp[j] = u;
        }
    }
    return dp.size();
}

int main() 
{	
    //setIO("cowjog");
    int n; ll m; cin >> n >> m;
    vector<ll> v;
    F0R(i, n) {
        ll a; cin >> a;
        if(m * (i+1) - a >= 0) v.push_back(m * (i + 1) - a);
    }
    cout << n - lnds(v);  
    return 0;
}   

컴파일 시 표준 에러 (stderr) 메시지

triusis.cpp: In function 'int lnds(std::vector<long long int>&)':
triusis.cpp:28:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if(j == dp.size()) {
      |            ~~^~~~~~~~~~~~
triusis.cpp: In function 'void setIO(std::string)':
triusis.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen((name+".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:16:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         freopen((name+".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...