# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
647672 | 2022-10-03T14:42:56 Z | nayhz | Rabbit Carrot (LMIO19_triusis) | C++17 | 31 ms | 5308 KB |
// source identifier task_name #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define lck cout << "ick bmi 32.9\n" #define cam_cs cout << "ick orz\n" #define orz(x) cout << (x) << " orz\n" #define pii pair<int, int> #define pll pair<long long, long long> #define pcc pair<char, char> #define ll long long #define ull unsigned long long #define ld long double // #define int long long #define vi vector<int> #define vll vector<long long> #define vd vector<double> #define vpii vector<pair<int, int>> #define vpll vector<pair<long long, long long>> #define vc vector<char> #define vsc vector<string> #define vb vector<bool> #define fi first #define se second #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define yes() cout << "Yes\n" #define no() cout << "No\n" #define impossible() cout << "Impossible\n" template<typename T, typename V> inline void print (const std::pair<T, V> &x) {std::cout << x.first << ' ' << x.second << '\n';} template<typename T> inline void print (const T &x) {std::cout << x << '\n';} template<typename T> inline void print (std::vector<T> &x) {for (auto &y : x) std::cout << y << " "; std::cout << '\n';} inline void print () {std::cout << '\n';} using namespace std; const ld pi = acos(-1); const ld eps = 1e-9; const ll mod = 1000000007; const ll inf = 1000000007; clock_t T, NT; inline double get_time() {NT = clock() - T; return (double)(NT) / CLOCKS_PER_SEC;} void file_io (string x); /* >>>>>>>>>>>>>>>>>>>>>>>>>>END OF TEMPLATE HEADER<<<<<<<<<<<<<<<<<<<<<<<< */ void solve (int &tc) { int n, m; cin >> n >> m; vi a(n); for (auto &x : a) cin >> x; vi b; for (int i = 0; i < n; i++) { if ((i + 1) * m >= a[i]) b.pb((i + 1) * m - a[i]); } // print(b); vi v; for (int i = 0; i < (int)(b.size()); i++) { auto it = upper_bound(all(v), b[i]); if (it == v.end()) v.pb(b[i]); else *it = b[i]; } cout << n - (int)v.size() << '\n'; } signed main () { cin.tie()->sync_with_stdio(false); T = clock(); srand(time(NULL)); // file_io(""); int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(i); // if (i != t) cout << '\n'; } // while (true) {solve(t); t++;} return 0; } void file_io (string x = "x") { string i = x + ".in"; freopen(i.c_str(), "r", stdin); string o = x + ".out"; freopen(o.c_str(), "w", stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 324 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 316 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 316 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 324 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 316 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 316 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 328 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 328 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 328 KB | Output is correct |
7 | Correct | 1 ms | 328 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 324 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 1 ms | 288 KB | Output is correct |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 316 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 316 KB | Output is correct |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 212 KB | Output is correct |
33 | Correct | 1 ms | 212 KB | Output is correct |
34 | Correct | 1 ms | 396 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 332 KB | Output is correct |
37 | Correct | 1 ms | 340 KB | Output is correct |
38 | Correct | 2 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 468 KB | Output is correct |
40 | Correct | 2 ms | 340 KB | Output is correct |
41 | Correct | 1 ms | 340 KB | Output is correct |
42 | Correct | 1 ms | 340 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 396 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 468 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 328 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 328 KB | Output is correct |
17 | Correct | 1 ms | 328 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 2 ms | 340 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 324 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 0 ms | 212 KB | Output is correct |
33 | Correct | 1 ms | 288 KB | Output is correct |
34 | Correct | 1 ms | 212 KB | Output is correct |
35 | Correct | 1 ms | 212 KB | Output is correct |
36 | Correct | 1 ms | 316 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 1 ms | 316 KB | Output is correct |
39 | Correct | 0 ms | 212 KB | Output is correct |
40 | Correct | 0 ms | 212 KB | Output is correct |
41 | Correct | 1 ms | 212 KB | Output is correct |
42 | Correct | 1 ms | 212 KB | Output is correct |
43 | Correct | 1 ms | 212 KB | Output is correct |
44 | Correct | 16 ms | 3728 KB | Output is correct |
45 | Correct | 24 ms | 3000 KB | Output is correct |
46 | Correct | 31 ms | 3644 KB | Output is correct |
47 | Correct | 28 ms | 3660 KB | Output is correct |
48 | Correct | 20 ms | 4296 KB | Output is correct |
49 | Correct | 20 ms | 4552 KB | Output is correct |
50 | Correct | 26 ms | 4424 KB | Output is correct |
51 | Correct | 28 ms | 5308 KB | Output is correct |
52 | Correct | 24 ms | 3648 KB | Output is correct |
53 | Correct | 25 ms | 2248 KB | Output is correct |
54 | Correct | 25 ms | 4420 KB | Output is correct |
55 | Correct | 22 ms | 4424 KB | Output is correct |