제출 #1148255

#제출 시각아이디문제언어결과실행 시간메모리
1148255Sir_Ahmed_ImranBouquet (EGOI24_bouquet)C++17
24 / 100
44 ms12132 KiB
// 01001100 01001111 01010100 01000001 \\ // \\ // ╦ ╔═╗╔╦╗╔═╗ \\ // ║ ║ ║ ║ ╠═╣ \\ // ╩═╝╚═╝ ╩ ╩ ╩ \\ // \\ // 01001100 01001111 01010100 01000001 \\ #include <bits/stdc++.h> using namespace std; #define N 200001 #define nl '\n' #define ff first #define ss second #define add insert #define ll long long #define ld long double #define terminator main #define pll pair<ll,ll> #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) int dp[N]; vector<pii> a[N]; int get(int x){ int ans = 0; while(x){ ans = max(ans, dp[x]); x -= x & -x; } return ans; } void update(int x, int val){ while(x < N){ dp[x] = max(dp[x], val); x += x & -x; } } void solve(){ int n, p, q, ans; cin >> n; ans = 0; for(int i = 1; i <= n; i++){ cin >> p >> q; q = min(n, i + q); p = max(0, i - p - 1); ans = max(ans, get(p) + 1); a[q].append({i, ans}); for(auto [j, k] : a[i]) update(j, k); } cout << ans; } int terminator(){ L0TA; solve(); return 0; }
#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...