답안 #591821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
591821 2022-07-08T00:46:42 Z Belgutei Rabbit Carrot (LMIO19_triusis) C++17
100 / 100
78 ms 13132 KB
#include <bits/stdc++.h>

using namespace std;

typedef pair<long long, long long> Point;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define MOD 1000000007
#define MOD1 1000000009
#define sqr(x) sqr((x)*(x))

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
#ifdef BE_DEBUG
#define debug(...) cerr << "\033[1;31m(" << #__VA_ARGS__ << "):\033[0m", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

const int N = 200005;
ll n,m;
ll a[N];
multiset<ll> s;
multiset<ll> :: iterator it;

int main() {
    IOS
    // freopen("cownomics.in", "r", stdin);
    // freopen("cownomics.out", "w", stdout);
    cin >> n >> m;
    for(int i = 1; i <= n; i ++) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; i ++) {
        if(a[i] > m * i) continue;
        ll tmp = m * i - a[i];
        it = s.upper_bound(tmp);
        if(it == s.end()) {
            s.insert(tmp);
        }
        else {
            s.erase(it);
            s.insert(tmp);
        }
    }
    cout << n - s.size();
}
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 596 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 596 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 596 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 1 ms 596 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 1 ms 500 KB Output is correct
32 Correct 2 ms 724 KB Output is correct
33 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 596 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 596 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 2 ms 724 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 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 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 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 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 2 ms 604 KB Output is correct
38 Correct 1 ms 468 KB Output is correct
39 Correct 1 ms 596 KB Output is correct
40 Correct 1 ms 504 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 476 KB Output is correct
43 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 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 2 ms 604 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 476 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 1 ms 596 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 596 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 596 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 2 ms 596 KB Output is correct
23 Correct 1 ms 596 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 1 ms 500 KB Output is correct
26 Correct 2 ms 724 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 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 68 ms 11656 KB Output is correct
45 Correct 19 ms 3704 KB Output is correct
46 Correct 32 ms 3836 KB Output is correct
47 Correct 33 ms 3788 KB Output is correct
48 Correct 48 ms 10632 KB Output is correct
49 Correct 73 ms 12076 KB Output is correct
50 Correct 59 ms 8396 KB Output is correct
51 Correct 78 ms 13132 KB Output is correct
52 Correct 70 ms 7444 KB Output is correct
53 Correct 15 ms 3072 KB Output is correct
54 Correct 69 ms 9804 KB Output is correct
55 Correct 69 ms 9816 KB Output is correct