제출 #660275

#제출 시각아이디문제언어결과실행 시간메모리
660275chanhchuong123Rabbit Carrot (LMIO19_triusis)C++14
100 / 100
33 ms6700 KiB
#include <bits/stdc++.h> using namespace std; #define task "C" #define fi first #define se second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() template <typename T1, typename T2> bool mini(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maxi(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } const int N = 2e5 + 3; int n, M; int a[N]; long long b[N]; vector<long long> dp; main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.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]; b[i] = 1LL * M * i - a[i]; } for (int i = 1; i <= n; i++) if (b[i] >= 0) { int x = upper_bound(all(dp), b[i]) - dp.begin(); if (x != dp.size()) dp[x] = b[i]; else dp.push_back(b[i]); } cout << n - dp.size(); }

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

triusis.cpp:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main() {
      | ^~~~
triusis.cpp: In function 'int main()':
triusis.cpp:38:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     if (x != dp.size()) dp[x] = b[i];
      |         ~~^~~~~~~~~~~~
triusis.cpp:27:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     freopen(task".inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:28:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     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...