# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1100362 | 2024-10-13T15:15:02 Z | jassu12345 | Rabbit Carrot (LMIO19_triusis) | C++11 | 1 ms | 504 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define int long long int mod = 1e9+7; void solve() { int n, m; cin >> n >> m; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; vector<int> temp, b; for (int i = 0; i < n; i++) { if (m * (i + 1) >= a[i]) { b.pb((i + 1) * m - a[i]); } } int k = b.size(); for (int i = 0; i < k && i < n; i++) { if (a[i] > 0 && temp.empty()) { temp.pb(a[i]); } else if (!temp.empty() && a[i] > temp.back()) { // Ensure temp is not empty temp.push_back(a[i]); } else { int idx = upper_bound(temp.begin(), temp.end(), b[i]) - temp.begin(); if (idx == temp.size()) { temp.push_back(b[i]); } else { temp[idx] = b[i]; } } } int sz = temp.empty() ? 0 : temp.size(); cout << n - sz; } signed main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; while (t--) { solve(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Incorrect | 1 ms | 340 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Incorrect | 1 ms | 340 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Incorrect | 1 ms | 340 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Incorrect | 1 ms | 340 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |