"Link" 如果没有总人数的限制的话,两个班的人数分别为$R=\min(r_i),L=\max(l_i)$是最优的。 如果人数超限了就减少$L$,如果人数不够就增加$R$。 然后就是个简单的二分图染色判定问题了。 ...
分类:
其他好文 时间:
2020-01-27 17:29:04
阅读次数:
64
#include<iostream> #include<vector> #include <string> #include <set> using namespace std; struct book{ int ID; string title; string author; vector<str ...
分类:
其他好文 时间:
2020-01-27 17:08:57
阅读次数:
48
https://vjudge.net/contest/353156#problem/A 一开始想着按背包做 = = 我的dp还是太菜了 应该按照单调序列做 1 #include <iostream> 2 #include <algorithm> 3 #include <vector> 4 using ...
分类:
其他好文 时间:
2020-01-27 13:48:24
阅读次数:
59
1.大整数加法 用数组来存储大整数的每一位,然后模拟人工运算,用for循环按位运算和处理,原理十分简单,直接上模板。 #include<iostream> #include<vector> using namespace std; //大整数加法 vector<int> add(vector<int ...
分类:
编程语言 时间:
2020-01-27 09:45:36
阅读次数:
85
1. 数组不能随着问题规模的增大而增加,而动态分配的数组需要手动管理内存,于是 vector 应运而生。 2. 向量所使用的内存来自动态存储区,由系统动态管理。 3. 一般应该传递引用或常量引用形式,避免进行大量复制操作。 4. 当能够预知向量最终长度时,应该直接指定长度,而不要连续使用 push_ ...
分类:
其他好文 时间:
2020-01-27 09:25:51
阅读次数:
53
法1:BFS #include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> temp ...
分类:
其他好文 时间:
2020-01-26 22:35:05
阅读次数:
88
#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> child[maxn] ...
分类:
其他好文 时间:
2020-01-26 20:49:51
阅读次数:
111
Vector功能 1.Vector是一个在C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。 2.是一个能够存放任意类型的动态数组。 3.vector是动态空间,随着元素的加入,它的内部机制会自行扩充空间以容纳新元素。 4.向量长度较长时效率比较低。 基本函 ...
分类:
编程语言 时间:
2020-01-26 20:46:56
阅读次数:
99
这道题在家里仔细想想还是挺好想的... 考场的时候还是要镇定,给每道题要安排足够的思考时间. code: #include <cstdio> #include <cstring> #include <vector> #include <string> #include <algorithm> #de ...
分类:
编程语言 时间:
2020-01-26 20:43:45
阅读次数:
63
题目链接:https://leetcode-cn.com/problems/insert-interval/ 解法一:可以LeetCode 56 题的合并区间为基础。 将newInterval插入至intervals中,然后对intervals进行合并区间,就能够得到最终的结果。 时间复杂度:O(N ...
分类:
其他好文 时间:
2020-01-26 16:10:31
阅读次数:
100