답안 #1099467

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099467 2024-10-11T10:24:59 Z hegoplay Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
0 ms 348 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){
    int pos = lower_bound(all(res),x) -res.begin();
    if (pos == res.size()){
      res.pb(x);
    }
    else{
      res[pos] = x;
    }
  }
  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:99: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]
   99 |     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 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -