제출 #1289905

#제출 시각아이디문제언어결과실행 시간메모리
1289905pecorineRabbit Carrot (LMIO19_triusis)C++20
0 / 100
3 ms2952 KiB
#include <bits/stdc++.h> // clang-format off #define princess_connect(file,extention) if(fopen(file "." extention, "r")) freopen(file "." extention, "r", stdin) #define yabai_desune ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define __Pecorine__ signed main() #define For(i, l, r) for (int i = l; i <= r; i++) #define Fod(i, r, l) for (int i = r; i >= l; i--) #define ll long long #define pb push_back #define sz(yuuki) (int)yuuki.size() #define bit(x, i) (x >> i) & 1 #define endl "\n" using namespace std;/* // ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠙⠻⠟⠛⠻⢿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿ ⣿⣿⣿⡟⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣀⠀⢸⣿ ⣿⡄⠀⠀⠀⠀⠀⠻⠿⣿⣿⣿⣿⣿⡷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣼⣿⣿⣿ ⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿ ⣿⣿⣿⣷⣶⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿ ⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⣉⣽ ⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿ ⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿ */ // clang-format on const int inf = 2e9; const int mxn = 2 * 1e5 + 7; const int mod = 1e9 + 7; int n, m; vector<int> a(mxn); vector<ll> b(mxn); struct seq { vector<int> st; seq(int _n) { st.resize(4 * _n + 1); } void update(int id, int l, int r, int pos, int val) { if (l == r) { st[id] = max(val, st[id]); return; } int m = (l + r) >> 1; if (pos <= m) { update(2 * id, l, m, pos, val); } else { update(2 * id + 1, m + 1, r, pos, val); } st[id] = max(st[2 * id], st[2 * id + 1]); } int get(int id, int l, int r, int u, int v) { if (l > v || r < u) { return 0; } if (l >= u && r <= v) { return st[id]; } int m = (l + r) >> 1; return max(get(2 * id, l, m, u, v), get(2 * id + 1, m + 1, r, u, v)); } }; __Pecorine__ { yabai_desune; princess_connect("yabai", "desune"); cin >> n >> m; For(i, 1, n) cin >> a[i]; For(i, 1, n) { if (a[i] <= 1LL * m * i) { b[i] = 1LL * m * i - a[i]; } } seq st1 = seq(n); vector<ll> c(b.begin() + 1, b.begin() + 1 + n); auto last = unique(c.begin(), c.end()); For(i, 1, n) { if (a[i] <= 1LL * m * i && b[i] >= 0) { int idx = lower_bound(c.begin(), last, b[i]) - c.begin() + 1; int val = st1.get(1, 1, n, 1, idx); st1.update(1, 1, n, idx, val + 1); } } cout << n - st1.get(1, 1, n, 1, n); }

컴파일 시 표준 에러 (stderr) 메시지

triusis.cpp: In function 'int main()':
triusis.cpp:2:84: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define princess_connect(file,extention) if(fopen(file "." extention, "r")) freopen(file "." extention, "r", stdin)
      |                                                                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:71:5: note: in expansion of macro 'princess_connect'
   71 |     princess_connect("yabai", "desune");
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...