上一页 1 2 3 4 5 6 7 ··· 29 下一页
摘要: 新知识:倍增 目前为止遇到的题目中,这题的难度能进前三 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N = 500010; 5 int n, m; //n是长度,m是对数 阅读全文
posted @ 2020-11-13 23:29 kyk333 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 500010; 4 int a[N], b[N]; 5 int tmp[N]; 6 typedef long long ll; 7 ll merge_sort(int 阅读全文
posted @ 2020-11-11 17:25 kyk333 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 本质是归并排序求逆序对数量 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 500010; 4 int a[N]; 5 int tmp[N]; 6 typedef long long ll; 7 ll merge_s 阅读全文
posted @ 2020-11-11 15:47 kyk333 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 对顶堆的应用 1 #include <bits/stdc++.h> 2 using namespace std; 3 int main() { 4 int t; 5 cin >> t; 6 while (t--) { 7 int n, m; 8 cin >> n >> m; 9 cout << n 阅读全文
posted @ 2020-11-11 15:09 kyk333 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N = 100010; 5 int row[N], col[N], s[N], c[N]; 6 //s是前缀和数组 7 ll w 阅读全文
posted @ 2020-11-11 14:50 kyk333 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 中位数的运用 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 100010; 4 int n; 5 int a[N]; 6 int main() { 7 cin >> n; 8 for (int i = 0; i < 阅读全文
posted @ 2020-11-09 16:45 kyk333 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 解法一:unordered_map 加 双关键字排序 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 200010; 4 int n, m; 5 int scientist[N]; //存储科学家明白的语言 6 st 阅读全文
posted @ 2020-11-09 16:41 kyk333 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 这是交互式的题目,leetcode上很常见,只需要实现一个函数就好 1 // Forward declaration of compare API. 2 // bool compare(int a, int b); 3 // return bool means whether a is less t 阅读全文
posted @ 2020-11-09 14:35 kyk333 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 100010; 4 int n, m; 5 int a[N]; 6 double sum[N]; 7 bool check(double mid) { 8 for (i 阅读全文
posted @ 2020-11-09 14:31 kyk333 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://bailian.openjudge.cn/practice/4135 题目解析:二分选择答案 1 #include <bits/stdc++.h> 2 using namespace std; 3 int n, m; 4 const int N = 100010; 5 int 阅读全文
posted @ 2020-11-07 10:39 kyk333 阅读(238) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 29 下一页