제출 #1254605

#제출 시각아이디문제언어결과실행 시간메모리
1254605snairsRabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; void setIO(string name = "") { cin.tie(0)->sync_with_stdio(0); if ((int)name.size()) { freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } } int poles(vector<ll> const& a, ll m) { int n = a.size(); const int INF = 1e9; vector<ll> d(n+1, INF); d[0] = -INF; for (int i = 0; i < n; i++) { int l = upper_bound(d.begin(), d.end(), a[i]-m) - d.begin(); if (d[l-1] <= a[i] && a[i] <= d[l]) d[l] = a[i]; } int ans = 0; for (int l = 0; l <= n; l++) { if (d[l] < INF) ans = l; } return ans; } int main() { setIO(); ll n,m; cin >> n >> m; vector <ll> height(n+1); height[0]=0; for(int i=0;i<n;i++) cin >> height[i+1]; cout << poles(height,m)-1; }

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

triusis.cpp: In function 'void setIO(std::string)':
triusis.cpp:7:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |                 freopen((name + ".in").c_str(), "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:8:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |                 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...