Submission #433393

# Submission time Handle Problem Language Result Execution time Memory
433393 2021-06-19T16:45:43 Z MohammadAghil Rabbit Carrot (LMIO19_triusis) C++14
100 / 100
102 ms 14648 KB
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(int i = l; i < r; i++)
#define per(i,r,l) for(int i = r; i >= l; i--)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define ff first
#define ss second 

const ll mod = 998244353, maxn = 2e5 + 5, inf = 1e9 + 5;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<ll> t(n + 1), a;
    rep(i,1,n + 1){
        ll k; cin >> k;
        t[i] = (ll)1LL*m*i - k;
    }
    rep(i,1,n + 1) if(t[i] >= 0) a.pb(t[i]);
    multiset<ll> s;
    rep(i,0,sz(a)){
        auto it = s.upper_bound(a[i]);
        if(it != s.end()) s.erase(it);
        s.insert(a[i]);
    }
    cout << n - sz(s);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 3 ms 588 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 2 ms 588 KB Output is correct
24 Correct 2 ms 588 KB Output is correct
25 Correct 2 ms 580 KB Output is correct
26 Correct 2 ms 716 KB Output is correct
27 Correct 2 ms 460 KB Output is correct
28 Correct 2 ms 588 KB Output is correct
29 Correct 3 ms 588 KB Output is correct
30 Correct 3 ms 580 KB Output is correct
31 Correct 2 ms 460 KB Output is correct
32 Correct 2 ms 588 KB Output is correct
33 Correct 2 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 588 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 2 ms 580 KB Output is correct
10 Correct 2 ms 716 KB Output is correct
11 Correct 2 ms 460 KB Output is correct
12 Correct 2 ms 588 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 3 ms 580 KB Output is correct
15 Correct 2 ms 460 KB Output is correct
16 Correct 2 ms 588 KB Output is correct
17 Correct 2 ms 588 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 324 KB Output is correct
37 Correct 3 ms 588 KB Output is correct
38 Correct 2 ms 460 KB Output is correct
39 Correct 2 ms 588 KB Output is correct
40 Correct 2 ms 452 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 2 ms 588 KB Output is correct
43 Correct 2 ms 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 452 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 2 ms 588 KB Output is correct
10 Correct 2 ms 500 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 460 KB Output is correct
15 Correct 3 ms 588 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 2 ms 588 KB Output is correct
18 Correct 2 ms 588 KB Output is correct
19 Correct 2 ms 580 KB Output is correct
20 Correct 2 ms 716 KB Output is correct
21 Correct 2 ms 460 KB Output is correct
22 Correct 2 ms 588 KB Output is correct
23 Correct 3 ms 588 KB Output is correct
24 Correct 3 ms 580 KB Output is correct
25 Correct 2 ms 460 KB Output is correct
26 Correct 2 ms 588 KB Output is correct
27 Correct 2 ms 588 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 204 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 88 ms 13176 KB Output is correct
45 Correct 31 ms 3792 KB Output is correct
46 Correct 44 ms 4920 KB Output is correct
47 Correct 43 ms 4956 KB Output is correct
48 Correct 67 ms 12144 KB Output is correct
49 Correct 90 ms 13748 KB Output is correct
50 Correct 73 ms 9656 KB Output is correct
51 Correct 102 ms 14648 KB Output is correct
52 Correct 85 ms 8900 KB Output is correct
53 Correct 21 ms 3020 KB Output is correct
54 Correct 86 ms 11388 KB Output is correct
55 Correct 88 ms 11460 KB Output is correct