- 博客(30)
- 收藏
- 关注
原创 2021 ICPC North America Division Championships五道题
F - Investigating Imposters 假设A说B,如果B是“imposters",那么说明A也是“imposters”。 那么假设第i个人是“imposters",判断有多少个人也会是“imposters”。由于“imposters”人数有限制,多的不可能是。 #include <bits/stdc++.h> // #define x first // #define y second typedef long long ll; const int N = 511; // #d
2021-11-03 10:33:46
912
原创 E Eyjafjalla(莫队 主席树)
输入 4 1 2 1 3 2 4 10 8 7 6 3 1 10 10 2 6 7 3 7 10 输出 1 0 3 数据结构题,题意就不写了 思路 首先考虑能达到的最上边,再看从最上边开始的子树有多少符合下界的,可以将用树链剖分变为一条链,再对区间操作。 考虑对温度建一棵主席树,用dfs序更新,或者对温度分块,用莫队修改。 具体不简单,详见代码 注意向上找要用倍增,温度要离散化(包括询问时的温度) 主席树 #include <bits/stdc++.h> // #define x fir.
2021-08-20 21:16:29
189
原创 Educational Codeforces Round 112 (Rated for Div. 2)D. Say No to Palindromes
CD题有代码,AB仅说思路 A. PizzaForces 题意 给三种披萨的烘烤方式,分别是15分钟烤6块,20分钟烤8块,25分钟烤10块,每次给出要多少块披萨,问多少分钟烤完 思路 易知,这三种烘烤方式等价,那么从第7块开始,每多五分钟多两块 B. Two Tables 题意 给一个长方形区域,里面有一个长方形桌子(桌子平行于轴),给出左下角右上角,现在要想再放进一个桌子,问能不能放进来,最少需要移动之前的桌子多少(上下左右移动) 思路 做就完了 C. Corn Rows 题意 2*n的格子,Alic
2021-08-11 21:41:14
217
原创 拓扑排序求环的大小和每个环的元素(Link with Limit)
Link with Limit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 415 Accepted Submission(s): 129 Problem Description Link has a function f(x), where x and f(x) are both integers in [1,n]. Let fn(
2021-08-11 09:25:44
429
原创 7-5 E-求导
7-5 E-求导 小E最近在学习求导,他给了你一个多项式,让你帮忙求出它的导数。 形式化地说,不妨假设 xi 项数的系数为 A,规定一个多项式的正确的表达方式如下: 各项次数非负且递减。 如果 A=0,不写出这一项,否则如果 A=1,且 i≠0,不写出系数。 对于 i=0 的项,表示成 A;对于 i=1 的项,表示成 Ax;对于其他项,表示成 Ax^i。 如果该项是负的,要在前面加上负号,否则加正号。注意,如果该项是正的且为第一项,则正号和负号都不用加。 特别地,如果多项式为f(x)=0,它应该被表
2021-06-29 09:33:23
461
原创 计蒜客 43466 B - Bracket Sequence
计蒜客 43466 Two great friends, Eddie John and Kris Cross, are attending the Brackets Are Perfection Conference. They wholeheartedly agree with the main message of the conference and they are delighted with all the new things they learn about brackets.One of
2021-05-19 15:03:45
202
原创 L2-039 清点代码库 (25 分)
上图转自新浪微博:“阿里代码库有几亿行代码,但其中有很多功能重复的代码,比如单单快排就被重写了几百遍。请设计一个程序,能够将代码库中所有功能重复的代码找出。各位大佬有啥想法,我当时就懵了,然后就挂了。。。” 这里我们把问题简化一下:首先假设两个功能模块如果接受同样的输入,总是给出同样的输出,则它们就是功能重复的;其次我们把每个模块的输出都简化为一个整数(在 int 范围内)。于是我们可以设计一系列输入,检查所有功能模块的对应输出,从而查出功能重复的代码。你的任务就是设计并实现这个简化问题的解决方案。 输入.
2021-04-26 21:12:26
1864
原创 特殊堆栈 (30 分)
输入样例: Pop PeekMedian Push 3 PeekMedian Push 2 PeekMedian Push 1 PeekMedian Pop Pop Push 5 Push 4 PeekMedian Pop Pop Pop Pop 输出样例: Invalid Invalid 3 2 2 1 2 4 4 5 3 Invalid 题目意思是找中位数,当然和中位数还有点不一样。 首先我们必定要有个栈,但是我们不能光有一个栈。这样不能找已有元素的中值。所以我设置了一个vector,理由如下 ve
2021-04-15 09:29:05
556
原创 紧急救援 (25 分)(邻接表存图)
这个题用邻接矩阵比较好一点,但是我为了练习堆优化版,并练习邻接表,用了邻接表 这道题用了很多数组,注意区分,详见代码 #include <map> #include <set> #include <stack> #include <queue> #include <vector> #include <string> #include <math.h> #include <stdio.h> #include <
2021-03-17 20:04:11
142
原创 kattis Block Game + Chess Tournament + Completing the Square + Millionaire Madness
这ji道题都来自同一场比赛,这次把这五道题做一个整理。原题不说了,只说一下个别题的题目大意和思路。 A - Block Game 一个玄学的博弈问题,虽然没看懂,但是做出来了。 这里只说一下必胜态,1如果一个是另一个的倍数(特别的,两者相等)显然知道这是必胜态。2如果某个状态能拿的是两个以上,那么先手就能控制后手的走法,也就是可以给后手留下1次或者0次(也就是后手要拿另一堆),那么只要我们发现这种情况就算胜。否则就轮流拿,看能拿的次数的奇偶看胜负 #include <math.h> #inclu
2021-02-22 15:30:42
320
原创 E - Resistors in Parallel 最详细(
In this physics problem, what we are concerned about are only resistors. If you are poor at physics, do not worry, since solving this problem does not require you to have advanced abilities in physics. Resistors are said to be connected together in paralle
2021-01-31 15:17:32
759
原创 Codeforces Round #694 BC Strange Birthday Party
C. Strange Birthday Party time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Petya organized a strange birthday party. He invited n friends and assigned an integer ki to the i-th of them. Now Petya woul
2021-01-20 11:13:03
225
原创 B - Gremlins attack! Gym - 102785B(并查集拓展)
There’s an emergency in a county-level American town. Gremlins have scattered around the town and thus the rest of the world is in danger, as, at least, one of them seems to have left the town. Special intelligence services are currently restoring the cour
2020-12-04 21:19:25
391
原创 Gym 102800部分题解
Gym 102800 A:没什么好说的,直接上代码 #include <iostream> #include <bits/stdc++.h> using namespace std; map<string,int>p; int main() { string a; string b; string c; int n; cin>>n; p["A"]=1; p["A#"]=2; p["B"]=3;
2020-11-20 21:39:27
472
原创 悄悄关注(map+struct)
7-11 悄悄关注 (25分) 新浪微博上有个“悄悄关注”,一个用户悄悄关注的人,不出现在这个用户的关注列表上,但系统会推送其悄悄关注的人发表的微博给该用户。现在我们来做一回网络侦探,根据某人的关注列表和其对其他用户的点赞情况,扒出有可能被其悄悄关注的人。 输入格式: 输入首先在第一行给出某用户的关注列表,格式如下: 人数N 用户1 用户2 …… 用户N 其中N是不超过5000的正整数,每个用户i(i=1, …, N)是被其关注的用户的ID,是长度为4位的由数字和英文字母组成的字符串,各项间以空格分隔。 之
2020-10-30 21:10:46
165
原创 SDUT 4783 病毒扩散
Description 2019-ncov的突然出现扰乱了人们的日常生活,它具有极强的传染性,可以快速的在人群中扩散,现在研究人员正在模拟其在人群中的扩散情况. 在一个n*m矩阵所示的人群中,*为普通人,#为佩戴口罩的人,@为病毒携带者,已知每秒每位病毒携带者会将病毒传染给相邻八个方向的未戴口罩的普通人。请问 x 秒后会有多少名传染者(初始为第0秒)? Input 第一行输入空格分隔的三个数n,m,x代表n行,m列的空间,x秒(n,m<=1000)。 接下来n行每行m人如上述所示。 Output 一个
2020-10-28 20:58:04
420
原创 Invoking the Magic Gym - 102770I(并查集+离散化)
@[TOC](Invoking the Magic Gym - 102770I(并查集+离散化)) BaoBao is a lazy boy. He has nn pairs of socks in different colours and he washes them once a month. In the washing machine, these socks will be mixed. Because there are too many socks that need to be paire
2020-10-23 21:33:35
707
2
原创 Jurassic Jigsaw
Jurassic Jigsaw Kattis - jurassicjigsaw (最小生成树) The famous Jurassic park biologist Dean O’Saur has discovered new samples of what he expects to be the DNA of a dinosaur. With the help of his assistant Petra Dactil, he managed to sequence the samples, and n
2020-10-04 20:37:12
262
原创 The Number of Products Gym - 102348F
The Number of Products Gym - 102348F You are given a sequence a1,a2,…,an consisting of n integers. You have to calculate three following values: the number of pairs of indices (l,r) (l≤r) such that al⋅al+1…ar−1⋅ar is negative; the number of pairs of indice
2020-08-25 09:07:50
188
原创 功夫传人 链式前向星
功夫传人 (25分) 一门武功能否传承久远并被发扬光大,是要看缘分的。一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟子们的功夫就越弱…… 直到某一支的某一代突然出现一个天分特别高的弟子(或者是吃到了灵丹、挖到了特别的秘笈),会将功夫的威力一下子放大N倍 —— 我们称这种弟子为“得道者”。 这里我们来考察某一位祖师爷门下的徒子徒孙家谱:假设家谱中的每个人只有1位师傅(除了祖师爷没有师傅);每位师傅可以带很多徒弟;并且假设辈分严格有序,即祖师爷这门武功的每个第i代传人只能在第i-1代传人中拜1个师
2020-08-24 15:56:22
109
原创 B - Latin Squares Gym - 101652O
Latin Squares A Latin Square is an n-by-n array filled with n different digits, each digit occurring exactly once in each row and once in each column. (The name “Latin Square” was inspired by the work of Leonhard Euler, who used Latin characters in his pap
2020-08-22 10:50:51
312
原创 E. Cupcakes
In a college dormitory, somebody posted an announcement saying there would be a table with K cupcakes (K>=0) on the first floor of the building. Students thought it was a great idea and they lined up in a long queue to get a cupcake. For each student nu
2020-08-20 21:25:18
199
原创 F - GlitchBot
One of our delivery robots is malfunctioning! The job of the robot is simple; it should follow a list of instructions in order to reach a target destination. The list of instructions is originally correct to get the robot to the target. However, something
2020-08-11 08:44:13
190
原创 gym 102220J Time Limit
In CCPC contests, you will get “Time Limit Exceeded” when your program tried to run during too much time. Setting suitable time limit for problems is vital to a contest. Mr. Bread is preparing problems for a coming contest with his friends. For each proble
2020-08-07 23:27:00
398
原创 Bomb 数位DP
Bomb The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence includes the sub-sequence “49”, the power of the blast
2020-08-07 11:06:22
229
原创 K - Assigning Frequencies
K - Assigning Frequencies Bob wants to assign frequencies to n satellites, numbered from 0 to n−1. Two distinct satellites are said to be adjacent if, when assigned the same frequency, they interfere with each other. Sensibly, Bob’s assignment of frequenci
2020-08-04 19:25:14
173
原创 Gym 100801C
Gym 100801C(思想) Problem C. Concatenation Input file: concatenation.in Output file: concatenation.out Time limit: 2 seconds Memory limit: 256 megabytes Famous programmer Gennady likes to create new words. One way to do it is to concatenate existing words. T
2020-07-30 19:58:02
242
原创 POJ -3468(线段树区间更新)
A Simple Problem with Integers You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given i
2020-07-27 11:25:16
185
原创 减小时间复杂度的个人见解
L - Chance After Noura’s brother, Tamim, finished his junior training, coach Fegla was impressed with his progress. He told Noura that if Tamim would solve the following problem in SCPC2015 and yet does not qualify to the ACPC2015, he will give him a chanc
2020-05-21 21:03:49
490
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人