Submission #740862

# Submission time Handle Problem Language Result Execution time Memory
740862 2023-05-13T07:55:30 Z old_school Rabbit Carrot (LMIO19_triusis) C++17
100 / 100
36 ms 6980 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define ll            long long
#define ld            long double
#define pb            push_back
#define ppb           pop_back
#define F             first
#define S             second
#define nl            '\n'
#define YES           cout << "YES\n";
#define NO            cout << "NO\n";
#define all(c)        (c).begin(), (c).end()
#define sz(c)         (ll)(c).size()
#define MOD           (ll) 1e9 + 7 // 998244353
#define MAX           (ll) 1e5 + 5
#define INF           (ll) 1e18
#define itr(i, a, b)  for (ll i = a; i <= b; i++)
#define itrn(i, a, b) for (ll i = a; i >= b; i--)
#define iot(n)        for (ll i = 0; i < n; i++)
#define jot(n)        for (ll j = 0; j < n; j++)
#define pls(n, arr) \
    ll arr[n];  \
    iot(n) cin >> arr[i];

typedef pair<ll, ll> pii;

template <typename T> bool mycomp(T x, T y)
{
    return (x == y);
}

/******************************I/O******************************/
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

template <typename T> void input(T &&t)
{
    cin >> t;
}
template <typename T, typename... Args> void input(T &&t, Args &&...args)
{
    cin >> t;
    input(forward<Args>(args)...);
}

template <typename T> void print(T &&t)
{
    cout << t << " ";
}
template <typename T, typename... Args> void print(T &&t, Args &&...args)
{
    cout << t << " ";
    print(forward<Args>(args)...);
}
/******************************End******************************/
ll lis(vector<ll> &b)
{
    ll n = sz(b);
    vector<ll> d(n, INF);
    ll ans = 0;
    iot(n)
    {
        auto itr = upper_bound(all(d), b[i]);
        ll ind = itr - d.begin();
        d[ind] = b[i];
        ans = max(ans, ind + 1);
    }
    return ans;
}
void solve()
{
    ll n, m;
    input(n, m);
    pls(n, a);
    vector<ll> b;
    iot(n) if (m * (i + 1) >= a[i]) b.pb((m * (i + 1) - a[i]));
    print(n - lis(b));
}

int main()
{
    fast_io;
    ll t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << nl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 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 212 KB Output is correct
15 Correct 1 ms 320 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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 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 212 KB Output is correct
15 Correct 1 ms 320 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 340 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 468 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 456 KB Output is correct
29 Correct 2 ms 468 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 1 ms 468 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 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 456 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 320 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 380 KB Output is correct
38 Correct 1 ms 460 KB Output is correct
39 Correct 1 ms 400 KB Output is correct
40 Correct 1 ms 464 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 2 ms 468 KB Output is correct
43 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 380 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 400 KB Output is correct
7 Correct 1 ms 464 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 1 ms 468 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 340 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 1 ms 468 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 456 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 0 ms 212 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 320 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 320 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 22 ms 5436 KB Output is correct
45 Correct 22 ms 3780 KB Output is correct
46 Correct 29 ms 5444 KB Output is correct
47 Correct 30 ms 5460 KB Output is correct
48 Correct 26 ms 6084 KB Output is correct
49 Correct 28 ms 6256 KB Output is correct
50 Correct 29 ms 6200 KB Output is correct
51 Correct 31 ms 6980 KB Output is correct
52 Correct 29 ms 5968 KB Output is correct
53 Correct 20 ms 3008 KB Output is correct
54 Correct 36 ms 6072 KB Output is correct
55 Correct 29 ms 6204 KB Output is correct