随笔分类 -  贪心

摘要:单调性 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, m, op; int a[N]; void solve() { scanf("%d 阅读全文
posted @ 2022-07-31 13:21 wKingYu 阅读(16) 评论(0) 推荐(0) 编辑
摘要:差分 + 贪心 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; int n; int a[N], b[N]; void solve() { cin >> 阅读全文
posted @ 2022-07-23 18:16 wKingYu 阅读(20) 评论(0) 推荐(0) 编辑
摘要:贪心 + 单调栈 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n, k; int a[N]; void solve() { cin >> n 阅读全文
posted @ 2022-06-26 18:21 wKingYu 阅读(6) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<algorithm> using namespace std; typedef pair<int,int> PII; const int N = 1e5 + 10; int n; PII cow[N]; int main() { 阅读全文
posted @ 2022-06-14 22:24 wKingYu 阅读(18) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n, res; int a[N]; int main() { cin >> n; for (int i = 0 阅读全文
posted @ 2022-06-14 21:30 wKingYu 阅读(18) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<algorithm> using namespace std; typedef long long LL; const int N = 1e5 + 10; int n; LL res; int a[N]; int main() { 阅读全文
posted @ 2022-06-14 21:07 wKingYu 阅读(15) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<vector> #include<queue> using namespace std; int n, res; priority_queue<int,vector<int>,greater<int>> heap; int mai 阅读全文
posted @ 2022-06-14 20:04 wKingYu 阅读(20) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10; int st, ed, n, res; struct Range { int l, r; bool operator 阅读全文
posted @ 2022-06-14 00:29 wKingYu 阅读(35) 评论(0) 推荐(0) 编辑
摘要:差分 + 贪心 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; int n; void solve() { cin >> n; vector<pair< 阅读全文
posted @ 2022-06-04 13:10 wKingYu 阅读(37) 评论(0) 推荐(1) 编辑
摘要:点击查看代码 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n; struct Range { int l, r; bool oper 阅读全文
posted @ 2022-06-04 12:02 wKingYu 阅读(20) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n; struct Range { int l, r; bool oper 阅读全文
posted @ 2022-06-03 22:04 wKingYu 阅读(18) 评论(0) 推荐(0) 编辑
摘要:贪心 + 二分 复杂度 O(nlog(n)) 总体复杂度 1×105×log(1×105)1.66×106 点击查看代码 #include<iostream> using na 阅读全文
posted @ 2022-05-23 19:58 wKingYu 阅读(31) 评论(0) 推荐(0) 编辑

欢迎阅读『贪心』
点击右上角即可分享
微信分享提示