自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 ACM-ICPC近年省赛汇总

ACM省赛汇总

2022-12-15 14:04:07 1532

原创 Bin Packing Problem

题意让你解决一个装箱问题,给你两种算法,让你求用这两种算法解决问题得到的方案解题思路对于第一种方法,用线段树维护区间最大值,要注意需要先判断左边以保证找到最前面的。对于d第二种方法,使用lower_bound直接模拟即可#include <bits/stdc++.h>using namespace std;const int N = 1e6 + 5;int a[N];int n, c, T;struct node { int l, r; int

2021-04-20 17:25:18 923

原创 Invoking the Magic

题意给你一些不同颜色的袜子,你要把它们放到一个容器中配对,如果能使所有的袜子配对成功,问这个容器最小的容量是多少。解题思路用并查集进行配对,把每双有相同颜色的袜子都放在一个集合,因为编号较大需要用map代替数组来存,这里注意用普通map存因为查询次数过多会超时,所以用hashmap来代替,另外dfs也可以做#include <bits/stdc++.h> using namespace std; const int MAXN = 100050; unordere

2021-04-20 16:30:10 438 1

原创 Longest Simple Cycle

题目大意#include <bits/stdc++.h>using namespace std;typedef long long LL;const int N = 1e5 + 10;long long c[N], a[N], b[N];int main(){ int t; cin >> t; while (t --){ int n, k; cin >> n; for (int i

2021-04-13 20:08:39 143

原创 MEX maximizing

题意进行一个游戏,一共有q个回合,每个回合向你的数组塞一个数,你可以对数组中的数加或减X的任意倍数,你的任务是在每回合找到数组内不存在的最小整数,并且通过操作使最小整数最大思路我们可以从零枚举这个最小整数,判断是否数组中存在可以变为这个数的数,如果不存在这个数就是我们要找的最小整数。可以知道对于a, b两个数,只要满足(a - b) % x == 0, 就可以通过对a加或者减x的倍数把a变成b。#include <bits/stdc++.h>using namespace s

2021-04-13 01:16:17 185

原创 Hatsune Miku(简单DP)

题目链接题目大意给你一个长度为n的数组p,对于每个不为-1的元素pi,都满足1<=pi<=m, 当pi等于-1时pi可以修改为1到m的任意一个数字,给你一个大小为m*m的二维数组b,对于每个数组a,都有一个属于自己的值,等于(a[p[1]][p[2]] + a[p[2]][p[3]] + … + a[p[n - 1]][p[n]];让你求此值最大是多少;解题思路本题数据比较小,可以写出来当数组长度为i时,前i位可能出现的所有值,具体方法可以通过枚举最后一个值的坐标为多少来实现;#

2021-02-22 18:39:19 180

原创 Find them, Catch them

等有时间补题解#include <cstdio>#include <iostream>using namespace std;const int MAXN = 100050;int p[MAXN], ans[MAXN];int n, m;int find(int x){ int sum = ans[x]; int y = p[x]; int temp, z; while (y != p[y]){ sum += an

2020-07-21 19:18:28 132 3

原创 20200427练习题解(Codeforces Round #329)

A - 2Char题解:先判断每个字符串字母种类,如果小于2进行归类统计长度,最后输出最长的组成方法的长度代码:#include <bits/stdc++.h>using namespace std;int t;char a[1050];int s1[300][300];int s2[300];int s3[300];int main(){ c...

2020-04-27 22:15:40 133

原创 cf题解

题目要求每个芯片都都要经过指定点,所以只要一个芯片经过网格内所有的点,那么这个芯片就一定满足要求,可以把全部的芯片都移向顶点{(0,0),(0,m),(n,0),(n,m)}其中一个,然后让芯片遍历整个网格。#include <bits/stdc++.h> using namespace std; int n, m;int x, y;int t; int main...

2020-03-26 20:57:14 186

原创 新生训练赛(3)

A - 最小的二进制数#include <iostream>#include <cstdio> using namespace std;int n;char a[10000];int b[10000];int c[10000];int s1, s2;int main(){ scanf("%d", &n); for (int i = 0; ...

2020-01-11 23:17:15 121

原创 新生训练2

//时间匆忙,先把自己代码弄上明天考完再做详细题解和剩下的补剩下的题。**A.B.C.D.#include <iostream>#include <cstdio> using namespace std;int a, b, c;int n;int main(){ cin >> n; while (n --){ cin >&...

2020-01-06 21:45:50 895

原创 入门练习-贪心(4)POJ-2376牛棚清洁

POJ-2376Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided ...

2019-11-04 18:05:21 222

原创 入门练习-贪心(3)POJ-3253栅栏维修

Fence Repair POJ - 3253Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some in...

2019-11-03 20:35:23 432

原创 入门练习-贪心(2)POJ-3069数轴打靶

题目:POJ3069DescriptionSaruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, amon...

2019-10-23 18:27:30 111

原创 入门练习-贪心(1)POJ-3623最小字典序

题目:POJ3623FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.The co...

2019-10-22 20:11:20 129

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除