제출 #681692

#제출 시각아이디문제언어결과실행 시간메모리
681692MarwenElarbiRabbit Carrot (LMIO19_triusis)C++14
100 / 100
28 ms5296 KiB
#include <bits/stdc++.h>
#define vi vector<int>
#define ve vector
#define ll long long
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 1e9
#define eps 1e-7
#define eps1 1e-2
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
using namespace std;
const int MOD = 1e9+7;
const int nax = 2*1e3+5;
double PI=3.14159265359;
int arx[8]={1,1,0,-1,-1,-1, 0, 1};
int ary[8]={0,1,1, 1, 0,-1,-1,-1};
typedef complex<int> Point;
#define X real()
#define Y imag()
void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
int main(){
    optimise;
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    //setIO("nocross");
    int n,m;
    cin>>n>>m;
    int tab[n];
    for (int i = 0; i < n; ++i)
        cin>>tab[i];
    vi v;
    for (int i = 0; i < n; ++i)
    {
        if (tab[i]<=(i+1)*m)
        {
            v.pb(m*(i+1)-tab[i]);
        }
    }
    vi nabba;
    for (auto u:v)
    {
        int j=upper_bound(nabba.begin(),nabba.end(),u)-nabba.begin();
        if (j==nabba.size()) nabba.pb(u);
        else nabba[j]=u;
    }cout << n-nabba.size()<<endl;
}   

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

triusis.cpp: In function 'int main()':
triusis.cpp:57:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |         if (j==nabba.size()) nabba.pb(u);
      |             ~^~~~~~~~~~~~~~
triusis.cpp: In function 'void setIO(std::string)':
triusis.cpp:30:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:31:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     freopen((s + ".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...