제출 #1120746

#제출 시각아이디문제언어결과실행 시간메모리
1120746InvMODRabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms396 KiB
#include<bits/stdc++.h>

#define int long long

using namespace std;

int lis(vector<int>& potential){
    vector<int> lis_;

    for(int i = 0; i < (int)potential.size(); i++){
        if(!lis_.size()){
            lis_.push_back(potential[i]);
        }
        else{
            int p = lower_bound(lis_.begin(), lis_.end(), potential[i]) - lis_.begin();
            if(p == lis_.size()){
                lis_.push_back(potential[i]);
            }
        }
    }
    return lis_.size();
}

void solve()
{
    int n,w; cin >> n >> w;

    vector<int> potential;
    for(int i = 1; i <= n; i++){
        int x; cin >> x;
        if(x <= 1ll * i * w){
            potential.push_back(i * w - x);
        }
    }

    cout << n - lis(potential) <<"\n";
}

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #define name "InvMOD"
    if(fopen(name".INP", "r")){
        freopen(name".INP", "r", stdin);
        freopen(name".OUT", "w", stdout);
    }

    solve();
    return 0;
}

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

triusis.cpp: In function 'long long int lis(std::vector<long long int>&)':
triusis.cpp:16:18: 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]
   16 |             if(p == lis_.size()){
      |                ~~^~~~~~~~~~~~~~
triusis.cpp: In function 'int32_t main()':
triusis.cpp:45:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |         freopen(name".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:46:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |         freopen(name".OUT", "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...