제출 #1307301

#제출 시각아이디문제언어결과실행 시간메모리
1307301mendekeFinancial Report (JOI21_financial)C++20
0 / 100
24 ms7396 KiB
//#pragma GCC optimize("O3,unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include<bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define all(x) x.begin(), x.end() const int mod = 1e9 + 7; const int N = 500001; using namespace std; ll n, m, t[N * 4],mx[N]; pair <ll, ll> p[N]; vector <ll> v; void upd (ll idx, ll val, ll tl = 1, ll tr = n, ll v = 1){ if (tl == tr){ t[v] = val; return; } ll tm = (tl + tr) / 2; if (tm < idx){ upd (idx, val, tm + 1, tr, v + v + 1); } else{ upd (idx, val, tl, tm, v + v); } t[v] = max (t[v + v], t[v + v + 1]); } ll get (ll l, ll r, ll tl = 1, ll tr = n, ll v = 1){ if (tr < l || tl > r){ return 0; } if (l <= tl && tr <= r){ return t[v]; } ll tm = (tl + tr) / 2; return max (get (l, r, tl, tm, v + v), get (l, r, tm + 1, tr, v + v + 1)); } signed main (){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; ll a = 0; for (int i = 1; i <= n; i++){ cin >> p[i].F; p[i].S = i; if (p[i].F > p[i - 1].F){ mx[i] = mx[i - 1] + 1; } else{ mx[i] = 1; } a = max (a, mx[i]); } cout << a; // sort (p + 1, p + n + 1); // for (int i = 1; i <= n; i++){ // if (p[i].F != p[i - 1].F){ // sort (all (v)); // reverse (all (v)); // for (auto j: v){ // upd (j, get (max (j - m, 1ll), j) + 1); // } // v.clear(); // } // v.pb (p[i].S); // } // sort (all (v)); // reverse (all (v)); // for (auto j: v){ // upd (j, get (j - m, j) + 1); // } // v.clear(); // ll mx = 0; // for (int i = 1; i <= n * 4; i++){ // mx = max (mx, t[i]); // } // cout << mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...