Submission #1096980

# Submission time Handle Problem Language Result Execution time Memory
1096980 2024-10-05T15:36:00 Z andrewp Rabbit Carrot (LMIO19_triusis) C++14
100 / 100
457 ms 7876 KB
//Dedicated to my love, ivaziva
#pragma GCC optimize("Ofast") 
#include <bits/stdc++.h> 
using namespace std;   
 
#define int long long 
 
using pii = pair<int, int>;
using ll = int64_t;  
  
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back  
#define dbg(x) cerr<<#x<<": "<<x<<'\n';  
#define dbga(A,l_,r_){for(int i_=l_;i_<=r_;i_++)cerr<<A[i_]<<' ';cerr<<'\n';}
#define dbgv(a_){for(auto x_:a_) cerr<<x_<<' ';cerr<<'\n';}   

const int maxn = 2e5 + 10, inf = 1e9;
int n, m, a[maxn];

int32_t main()  {
    ios::sync_with_stdio(false); cin.tie(nullptr);  
    cout.tie(nullptr); cerr.tie(nullptr);
    
    cin >> n >> m; 
    for (int i = 1; i <= n; i++) {
        cin >> a[i];    
    }
    for (int i = 0; i <= n; i++) {
        a[i] += (n - i) * m; 
        a[i] = -a[i];
    }   
    int ans = 0; 
    vector<int> lis(1, a[0]);
    for (int i = 1; i <= n; i++) { 
        auto it = upper_bound(all(lis), a[i]);
        if (it == lis.end()) {
            lis.pb(a[i]);
        } else {
            if (*it == a[0]) {
                continue; 
            }
            *it = a[i];
        }
    }
    dbgv(lis);
    cout << (n - (int)(lis.size()) + 1) << '\n';
    return 0;       
}

Compilation message

triusis.cpp: In function 'int32_t main()':
triusis.cpp:33:9: warning: unused variable 'ans' [-Wunused-variable]
   33 |     int ans = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 11 ms 580 KB Output is correct
21 Correct 11 ms 604 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 10 ms 604 KB Output is correct
24 Correct 12 ms 668 KB Output is correct
25 Correct 12 ms 656 KB Output is correct
26 Correct 12 ms 860 KB Output is correct
27 Correct 6 ms 344 KB Output is correct
28 Correct 12 ms 660 KB Output is correct
29 Correct 12 ms 604 KB Output is correct
30 Correct 9 ms 604 KB Output is correct
31 Correct 6 ms 348 KB Output is correct
32 Correct 8 ms 604 KB Output is correct
33 Correct 8 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 11 ms 580 KB Output is correct
5 Correct 11 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 10 ms 604 KB Output is correct
8 Correct 12 ms 668 KB Output is correct
9 Correct 12 ms 656 KB Output is correct
10 Correct 12 ms 860 KB Output is correct
11 Correct 6 ms 344 KB Output is correct
12 Correct 12 ms 660 KB Output is correct
13 Correct 12 ms 604 KB Output is correct
14 Correct 9 ms 604 KB Output is correct
15 Correct 6 ms 348 KB Output is correct
16 Correct 8 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 15 ms 520 KB Output is correct
38 Correct 6 ms 600 KB Output is correct
39 Correct 11 ms 692 KB Output is correct
40 Correct 9 ms 584 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 8 ms 620 KB Output is correct
43 Correct 8 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 15 ms 520 KB Output is correct
5 Correct 6 ms 600 KB Output is correct
6 Correct 11 ms 692 KB Output is correct
7 Correct 9 ms 584 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 8 ms 620 KB Output is correct
10 Correct 8 ms 612 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 11 ms 580 KB Output is correct
15 Correct 11 ms 604 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 10 ms 604 KB Output is correct
18 Correct 12 ms 668 KB Output is correct
19 Correct 12 ms 656 KB Output is correct
20 Correct 12 ms 860 KB Output is correct
21 Correct 6 ms 344 KB Output is correct
22 Correct 12 ms 660 KB Output is correct
23 Correct 12 ms 604 KB Output is correct
24 Correct 9 ms 604 KB Output is correct
25 Correct 6 ms 348 KB Output is correct
26 Correct 8 ms 604 KB Output is correct
27 Correct 8 ms 604 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 344 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 420 ms 5776 KB Output is correct
45 Correct 16 ms 3928 KB Output is correct
46 Correct 26 ms 3800 KB Output is correct
47 Correct 38 ms 3920 KB Output is correct
48 Correct 369 ms 5800 KB Output is correct
49 Correct 412 ms 6600 KB Output is correct
50 Correct 226 ms 6060 KB Output is correct
51 Correct 457 ms 7876 KB Output is correct
52 Correct 218 ms 4668 KB Output is correct
53 Correct 13 ms 3160 KB Output is correct
54 Correct 329 ms 5932 KB Output is correct
55 Correct 339 ms 5832 KB Output is correct