自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(92)
  • 问答 (2)
  • 收藏
  • 关注

原创 python项目总结(持续更新中)

【代码】python项目总结(持续更新中)

2024-03-31 10:03:02 576

原创 Timofey and a tree(思维题)

Each New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color ci.Now it's time for Timofey birthday, and his mother asked him to remove the tree. Timo

2024-03-31 10:04:13 535

原创 Anton and Making Potions(枚举,二分)

Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions.Anton has a special kettle, that can prepare one potions in x seconds. Also, he knows spells of two types tha

2024-03-25 18:50:20 708

原创 B. Party(思维)

A club plans to hold a party and will invite some of its nn members. The nn members are identified by the numbers 1,2,…,n1,2,…,n. If member ii is not invited, the party will gain an unhappiness value of aiai.There are mm pairs of friends among the nn membe

2024-03-24 21:56:49 712

原创 登山小分队(dfs,模拟)

接下来 n−1n-1n−1 行,每行两个整数,分别是 xi,yi(1≤xi,yi≤n)x_i,y_i(1 \le x_i,y_i \le n)xi​,yi​(1≤xi​,yi​≤n),表示有一条路连接 xix_ixi​ 号点 和 yiy_iyi​ 号点,其中 111 号点即为山顶,保证给定的图是一棵树。这个问题中,我们将山顶视作树的根节点,而山脚视为树的叶节点,上山的每一条路可以视作树的一条边。3,这个题最难的是,单个节点记录数量,dfs深度搜索,递归的书写。输出一行一个数,表示所有人都到齐的最少时间。

2024-03-24 21:52:24 437

原创 Array Destruction(枚举暴力,stl的合理选择)

You found a useless array aa of 2n2n positive integers. You have realized that you actually don't need this array, so you decided to throw out all elements of aa.It could have been an easy task, but it turned out that you should follow some rules:For examp

2024-03-23 14:17:51 566

原创 Pinkie Pie Eats Patty-cakes(贪心或者二分)

Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-b

2024-03-19 08:31:59 676

原创 Link with Monotonic Subsequence(分块,思维)

2,3 2 1 6 5 4 9 8 7,这样的话,分sqrt(n)块,块内减,块间递增,value是sqrt(n)。1,打表,找到符合题意的解,发现value和sqrt(n)有关。

2024-03-18 08:36:33 862

原创 Zigzags(思维,前缀处理)

You are given an array a1,a2…ana1,a2…an. Calculate the number of tuples (i,j,k,l)(i,j,k,l) such that:InputThe first line contains a single integer tt (1≤t≤1001≤t≤100) — the number of test cases.The first line of each test case contains a single integer nn

2024-03-17 20:05:25 498

原创 Navigation System(djkstra,反向建图,思维)

The map of Bertown can be represented as a set of nn intersections, numbered from 11 to nn and connected by mm one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from one intersect

2024-03-17 18:28:30 2071

原创 Link with Arithmetic Progression(最小二乘法,三分)

1,用long double ,这里面精度要求较高,用double是不行的。2,要用read()快读,首项是a+b。我用的最小二乘法求回归方程,

2024-03-16 15:19:55 911

原创 The Sports Festival(区间dp)

The student council is preparing for the relay race at the sports festival.The council consists of nn members. They will run one after the other in the race, the speed of member ii is sisi. The discrepancy didi of the ii-th stage is the difference between

2024-03-16 08:46:49 751

原创 Divide and Summarize(二分,递归,前缀和)

正在上传…重新上传取消InputOutputExampleinputCopy25 51 2 3 4 51891265 53 1 3 1 3123911outputCopyYesNoYesNoYesNoYesNoYesYesNote。

2024-03-15 18:00:49 950

原创 Eezie and Pie(树上差分)

题意:从i节点最多走d[i]长度,馅饼保鲜,一个节点一个节点地走,问每个节点经过的次数。

2024-03-15 10:07:04 747

原创 D. Peculiar Movie Preferences(思维,map)

InputOutputExampleinputCopy65zxabcczxba2abbad4codeforces3abc3abcdcba2ababoutputCopyYESNONOYESYESNONote。

2024-03-14 12:16:46 806

原创 Flood Fill(区间dp)

You are given a line of nn colored squares in a row, numbered from 11 to nn from left to right. The ii-th square initially has the color cici.Let's say, that two squares ii and jj belong to the same connected component if ci=cjci=cj, and ci=ckci=ck for all

2024-03-14 09:31:11 537

原创 G. Anna, Svyatoslav and Maps(最短路floyd,思维)

原题链接The main characters have been omitted to be short.You are given a directed unweighted graph without loops with nn vertexes and a path in it (that path is not necessary simple) given by a sequence p1,p2,…,pmp1,p2,…,pm of mm vertexes; for each 1≤i...

2024-03-13 10:52:26 837

原创 Bouncing Boomerangs(构造,思维,贪心)

正在上传…重新上传取消InputOutputExamplesinputCopy6outputCopy52 12 53 33 65 6inputCopy10outputCopy0inputCopy6outputCopy-1Note。

2024-03-12 20:40:48 779

原创 B2. Tokitsukaze and Good 01-String (hard version)(规律)

This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary stringssof lengthnn, consisting only of zeros and ones,nn...

2024-03-11 21:37:55 591

原创 L2-002 链表去重 (25 分)(数组模拟)(附链表相关)

给定一个带整数键值的链表 L,你需要把其中绝对值重复的键值结点删掉。即对每个键值 K,只有第一个绝对值等于 K 的结点被保留。同时,所有被删除的结点须被保存在另一个链表上。例如给定 L 为 21→-15→-15→-7→15,你需要输出去重后的链表 21→-15→-7,还有被删除的链表 -15→15。输入格式:输入在第一行给出 L 的第一个结点的地址和一个正整数 N(≤105,为结点总数)。一个结点的地址是非负的 5 位整数,空地址 NULL 用 −1 来表示。随后 N 行,每行按以下格式描述一个

2024-03-11 21:36:26 187

原创 Lorenzo Von Matterhorn(思维,二叉树,模拟)

iand 2iiand 2ii正在上传…重新上传取消qvuandwutovwdollars.vuInputq(1 ≤q≤ 1 000).The nextqvuwutovbywvuvu1 ≤vu≤ 1018,v≠u, 1 ≤wOutputExampleinputCopy71 3 4 301 4 1 21 3 6 82 4 31 6 1 402 3 72 2 4output。

2024-03-10 09:40:22 975

原创 Integers Have Friends(线段树,双指针,GCD)

British mathematician John Littlewood once said about Indian mathematician Srinivasa Ramanujan that "every positive integer was one of his personal friends."It turns out that positive integers can also be friends with each other! You are given an array aa

2024-03-08 18:24:53 691

原创 Mocha and Railgun(几何规律)

来源:牛客网。

2024-03-08 18:23:08 766

原创 (牛客寒假训练)B-清楚姐姐学构造

2需要特判一下,不知道为什么2没有逆元,希望有大佬可以解释一下。在B题上,所有的东西都对了,就差一个知识点。

2023-01-30 22:24:40 174 1

原创 c++的左右对齐语句

c++的对齐语句

2022-12-28 16:18:19 290

原创 E. Counting Rectangles(二维前缀和)

原题链接You have nn rectangles, the ii-th rectangle has height hihi and width wiwi.You are asked qq queries of the form hs ws hb wbhs ws hb wb.For each query output, the total area of rectangles you own that can fit a rectangle of height hshs and width wsws wh

2022-09-23 21:33:05 465

原创 C. Connect the Points(计算几何)(找统一规律)

原题链接:You are given three points on a plane. You should choose some segments on the plane that are parallel to coordinate axes, so that all three points become connected. The total length of the chosen segments should be the minimal possible.Two points aa a

2022-09-22 19:58:36 204

原创 LCM Sum (hard version)(树状数组,筛因子)

LCM Sum (hard version)This version of the problem differs from the previous one only in the constraint on tt. You can make hacks only if both versions of the problem are solved.You are given two positive integers ll and rr.Count the number of distinct trip

2022-08-18 19:31:55 219

原创 G. Good Key, Bad Key(思维)

链接:There are nn chests. The ii-th chest contains aiai coins. You need to open all nn chests in order from chest 11 to chest nn.There are two types of keys you can use to open a chest:You need to use in total nn keys, one for each chest. Initially, you have

2022-08-18 09:43:19 260

原创 Particle Arts NIO‘s Sword

1,关于余数,13%3==1,12%3==132%3==0,所以只需要看余数,las记载上次的余数。按转化为二进制,然后转化为最大到最小十进制。

2022-08-12 09:55:47 81

原创 D. Shortest and Longest LIS(思维,模拟,构造)

原题链接Gildong recently learned how to find the longest increasing subsequence (LIS) in O(nlogn)O(nlog⁡n) time for a sequence of length nn. He wants to test himself if he can implement it correctly, but he couldn't find any online judges that would do it (eve

2022-08-10 15:18:07 9

原创 C. Discrete Acceleration(浮点数二分)

原题链接There is a road with length ll meters. The start of the road has coordinate 00, the end of the road has coordinate ll.There are two cars, the first standing at the start of the road and the second standing at the end of the road. They will start drivin

2022-08-10 09:44:37 15

原创 C. Binary Search(二分,思维)

首先,二分找pos,然后小于的个数减1,因为要的是严格小于的个数,并且选择的时候应该是a不是c。

2022-08-09 16:10:53 8

原创 C. Fishingprince Plays With Array(二维数组,思维)

原文链接Fishingprince is playing with an array [a1,a2,…,an][a1,a2,…,an]. He also has a magic number mm.He can do the following two operations on it:Note that the array length might change during the process. The value of nn above is defined as the current leng

2022-08-09 09:49:01 17

原创 awoo‘s Favorite Problem(思维)

You are given two strings ss and tt, both of length nn. Each character in both string is 'a', 'b' or 'c'.In one move, you can perform one of the following actions:You are allowed to perform an arbitrary amount of moves (possibly, zero). Can you change stri

2022-08-08 20:52:34 132

原创 Cross Coloring(逆向,map)

There is a sheet of paper that can be represented with a grid of size n×mn×m: nn rows and mm columns of cells. All cells are colored in white initially.qq operations have been applied to the sheet. The ii-th of them can be described as follows:The sheet af

2022-08-08 18:24:06 293

原创 C. Build Permutation(构造,思维)

原题链接A 00-indexed array aa of size nn is called good if for all valid indices ii (0≤i≤n−10≤i≤n−1), ai+iai+i is a perfect square††.Given an integer nn. Find a permutation‡‡ pp of [0,1,2,…,n−1][0,1,2,…,n−1] that is good or determine that no such permutation e

2022-08-07 10:03:17 515

原创 D. Chip Move(思维,模拟)

There is a chip on the coordinate line. Initially, the chip is located at the point00. You can perform any number of moves; each move increases the coordinate of the chip by some positive integer (which is calledthe length of the move). The length of the..

2022-08-05 16:14:58 340

原创 D. Color with Occurrences(指针,子串)

这题需要整体输出,所以需要用数组存

2022-08-02 11:45:30 26

原创 C. Virus(差分数组,思维)

There arennhouses numbered from11tonnon a circle. For each1≤i≤n−11≤i≤n−1, houseiiand housei+1i+1are neighbours; additionally, housennand house11are also neighbours.Initially,mmof thesennhouses are infected by a deadly virus. Eachmorni...

2022-08-01 11:20:59 364

空空如也

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

TA关注的人

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