답안 #1099470

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099470 2024-10-11T10:52:06 Z hegoplay Rabbit Carrot (LMIO19_triusis) C++14
100 / 100
26 ms 8536 KB
/*
                                                                                                        -
                                                             +=
                                                           @@@@@%
                                                         +@@@@@@+
                                                      %@@@@@#%
                                                     @@@@@@@@=:
                       +******************         =@@@@@@@@@%
   =***********#*******+
                    %@@@@@@@@@@@@@@@@@@@@=         @@@@@@@@@@%
   #@@@@@@@@@@@@@@@@@@@@@@
                  +@@@@@@@@@@@@@@@@@@@@@+        +@@#@@@@@@@@%
   @@@@@@@@@@@@@@@@@@@@@@@=
                 +@@@@%                         *@@%@@@@@@@@@=    %@@@%
                 @@@@@#                        *@@@@@@@@@@@@#    #@@@@@
                %@@@@%                        +@@@@@@@@@@@@%
   @@@@@@@@@@@@@@@@@@@@%
               #@@@@@                        =#+@@@@@@@@#@%
   =@@@@@@@@@@@@@@@@@@@@*
              +@@@@@+                         #@@@@@@% =@@@@@=
             =@@@@@*                        #@@@@@@# @@@@@*
             #@@@@@@@@@@@@@@@@@@@@@       +@@@@@@# *@@@@@@@@@@@@@@@@@@@@@@#
             +@@@@@@@@@@@@@@@@@@@@=      %@@@@@% +@@@@@@@@@@@@@@@@@@@@@@+
               +*#************##*      =@@@@@#+ ###**##**#*******##*+
                                      =@@@@@@%
                                        +**  =+=
                                    Michael Jackson peeks
*/

#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define inf 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(), (x).end()
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define sz(x) (int)(x).size()
#define el "\n"
typedef long long ll;
typedef long double ld;
#define int long long

using namespace std;
using namespace __gnu_pbds;

#define indexed_set                                                            \
  tree<int, null_type, less<int>, rb_tree_tag,                                 \
       tree_order_statistics_node_update>

void setIO(string name = "") {
  if (sz(name)) {
    freopen((name + ".in").c_str(), "r", stdin); // see /general/input-output
    freopen((name + ".out").c_str(), "w", stdout);
  }
}

void solve() {
  int n;
  cin >> n;
  int m;
  cin >> m;
  vector<int> vt(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> vt[i];
  }
  vector<int> lis;
  vt[0] = 0;
  // tim
  // vi tri va so luong su thay doi can
  for (int i = 1; i < vt.size(); i++) {
    int x = vt[i];
    int val = x - m * i;
    if (val > 0) {
      continue;
    }
    lis.pb(m * i - x);
  }
  vector<int> res;
  for(int x : lis){
    // cout << x << " ";
    int pos = upper_bound(all(res),x) -res.begin();
    if (pos == res.size()){
      res.pb(x);
    }
    else{
      res[pos] = x;
    }
  }
  // cout << el;
  cout << n - res.size();

}
signed main() {
  // #ifndef ONLINE_JUDGE
  //     freopen("input.txt", "r", stdin);
  //     freopen("out.txt", "w", stdout);
  // #endif
  //    setIO("cowjog");
  ios ::sync_with_stdio(false);
  cin.tie(nullptr);
  ll t = 1;
  // cin >> t;
  while (t--)
    solve();
  return 0;
}

Compilation message

triusis.cpp: In function 'void solve()':
triusis.cpp:88:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |   for (int i = 1; i < vt.size(); i++) {
      |                   ~~^~~~~~~~~~~
triusis.cpp:100:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  100 |     if (pos == res.size()){
      |         ~~~~^~~~~~~~~~~~~
triusis.cpp: In function 'void setIO(std::string)':
triusis.cpp:70:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |     freopen((name + ".in").c_str(), "r", stdin); // see /general/input-output
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:71:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 |     freopen((name + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 352 KB Output is correct
10 Correct 0 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 0 ms 348 KB Output is correct
14 Correct 1 ms 352 KB Output is correct
15 Correct 0 ms 356 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 352 KB Output is correct
10 Correct 0 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 0 ms 348 KB Output is correct
14 Correct 1 ms 352 KB Output is correct
15 Correct 0 ms 356 KB Output is correct
16 Correct 0 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 352 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 608 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 1 ms 516 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 464 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 608 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 1 ms 516 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 516 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 352 KB Output is correct
27 Correct 0 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 0 ms 348 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 0 ms 356 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 600 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 600 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 1 ms 604 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 600 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 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 352 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 464 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 608 KB Output is correct
19 Correct 1 ms 600 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 516 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 516 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 352 KB Output is correct
37 Correct 0 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 0 ms 348 KB Output is correct
41 Correct 1 ms 352 KB Output is correct
42 Correct 0 ms 356 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 14 ms 6864 KB Output is correct
45 Correct 17 ms 3936 KB Output is correct
46 Correct 22 ms 5092 KB Output is correct
47 Correct 23 ms 5340 KB Output is correct
48 Correct 18 ms 7380 KB Output is correct
49 Correct 19 ms 7632 KB Output is correct
50 Correct 26 ms 6744 KB Output is correct
51 Correct 22 ms 8536 KB Output is correct
52 Correct 17 ms 6100 KB Output is correct
53 Correct 11 ms 3164 KB Output is correct
54 Correct 19 ms 7728 KB Output is correct
55 Correct 19 ms 7628 KB Output is correct