제출 #1086608

#제출 시각아이디문제언어결과실행 시간메모리
1086608firegirlwaterboyRabbit Carrot (LMIO19_triusis)C++14
100 / 100
29 ms5336 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; void solve() { int n, m; cin >> n >> m; vector<int> a(n); for (int &p : a) { cin >> p; } vector<int> b; for (int i = 1; i <= n; i++) { if (i * m >= a[i - 1]) { b.push_back(i * m - a[i - 1]); } } vector<int> ans; for (int i : b) { int idx = upper_bound(ans.begin(), ans.end(), i) - ans.begin(); if (idx == ans.size()) { ans.push_back(i); } else { ans[idx] = i; } } cout << n - ans.size() << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }

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

triusis.cpp: In function 'void solve()':
triusis.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if (idx == ans.size()) {
      |             ~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...