제출 #1229082

#제출 시각아이디문제언어결과실행 시간메모리
1229082HduongRabbit Carrot (LMIO19_triusis)C++20
100 / 100
17 ms4032 KiB
#include <bits/stdc++.h> #define task "task" using namespace std; const long long INF = 1e18; const int N = 2e5 + 5; long long n, m, a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); if (fopen (task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i], a[i] = m*i - a[i]; vector <long long> v; long long res = n; for (int i = 1; i <= n; i++) { if (a[i] < 0) continue ; auto it = upper_bound(v.begin(), v.end(), a[i]); if (it == v.end()) { v.push_back(a[i]); } else { *it = a[i]; } } cout << res - v.size(); }

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

triusis.cpp: In function 'int main()':
triusis.cpp:14:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen (task".inp", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:15:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen (task".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...