自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

tomjobs的博客

I was so much older then, I'm younger than that now.

  • 博客(116)
  • 收藏
  • 关注

原创 杭电多校第10场 hdu6883 Coin Game(背包)

Problem DescriptionThere are n machines in front of you, and each of them has a cute button on it.For the i-th machine, if you push the button on it, it will give you a coin valued at ai. If you push the button again, it will give you a coin valued at bi

2020-09-29 18:48:43 288

原创 杭电多校第10场 hdu6881 Tree Cutting(点分治)

Problem DescriptionGiven a tree (connected undirected graph with n vertexes and n−1 edges), you are required to delete as few vertexes as possible such that the remaining graph is still a tree and its diameter shall not exceed k. The diameter of a tree is

2020-09-29 13:12:53 363

原创 P4178 Tree(点分治)

题目描述给定一棵 nn 个节点的树,每条边有边权,求出树上两点距离小于等于 kk 的点对数量思路:就是裸的点分治,每次找到重心遍历,然后求出所有路径双指针搞一下。数据开到了4e4,卡常,极限优化常数后,最后发现是unordered_map的问题,说好的O(1)查询呢??#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <vect

2020-09-29 12:24:09 181

原创 Codeforces1426 F. Number of Subsequences(DP)

You are given a string ???? consisting of lowercase Latin letters “a”, “b” and “c” and question marks “?”.Let the number of question marks in the string ???? be ????. Let’s replace each question mark with one of the letters “a”, “b” and “c”. Here we can o

2020-09-28 21:51:30 1160 3

原创 Codeforces1426 E. Rock, Paper, Scissors

Alice and Bob have decided to play the game “Rock, Paper, Scissors”.The game consists of several rounds, each round is independent of each other. In each round, both players show one of the following things at the same time: rock, paper or scissors. If bo

2020-09-28 21:48:57 561

原创 Codeforces 1426 D. Non-zero Segments

Kolya got an integer array ????1,????2,…,????????. The array can contain both positive and negative integers, but Kolya doesn’t like 0, so the array doesn’t contain any zeros.Kolya doesn’t like that the sum of some subsegments of his array can be 0. The s

2020-09-28 21:40:47 319

原创 Codeforces 1426 C. Increase and Copy

Initially, you have the array ???? consisting of one element 1 (????=[1]).In one move, you can do one of the following things:Increase some (single) element of ???? by 1 (choose some ???? from 1 to the current length of ???? and increase ???????? by one)

2020-09-28 21:38:39 419

原创 Codeforces 1426B. Symmetric Matrix

Masha has ???? types of tiles of size 2×2. Each cell of the tile contains one integer. Masha has an infinite number of tiles of each type.Masha decides to construct the square of size ????×???? consisting of the given tiles. This square also has to be a s

2020-09-28 21:36:14 363

原创 Codeforces 1426A. Floor Number

Vasya goes to visit his classmate Petya. Vasya knows that Petya’s apartment number is ????.There is only one entrance in Petya’s house and the distribution of apartments is the following: the first floor contains 2 apartments, every other floor contains ?

2020-09-28 21:32:59 425

原创 P3806 【模板】点分治1

题目描述给定一棵有 nn 个点的树,询问树上距离为 kk 的点对是否存在。思路:直接在点分治模板的双指针上加上了100次询问(竟然没有T)#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <vector>#include <queue>#include <iostream>#include &l

2020-09-28 10:00:33 202

原创 Round F 2020 - Kick Start 2020 ATM Queue

ProblemThere are N people numbered from 1 to N, standing in a queue to withdraw money from an ATM. The queue is formed in ascending order of their number. The person numbered i wants to withdraw amount Ai. The maximum amount a person can withdraw at a tim

2020-09-27 18:52:30 293

原创 Round F 2020 - Kick Start 2020 Metal Harvest

ProblemYou are in charge of deploying robots to harvest Kickium from a nearby asteroid. Robots are not designed to work as a team, so only one robot can harvest at any point of time. A single robot can be deployed for up to K units of time in a row before

2020-09-27 18:51:01 236

原创 Round F 2020 - Kick Start 2020 Painters‘ Duel(博弈搜索)

ProblemA new art museum is about to open! It is a single-story building in the shape of a large equilateral triangle. That triangle is made up of many smaller identical equilateral-triangle-shaped rooms, and the side length of the museum is S times the si

2020-09-27 18:22:39 700

原创 Round F 2020 - Kick Start 2020 Yeetzhee(期望,记忆化搜索)

ProblemPommel is very bored at home so she has invented a new game involving N dice. Each die has the numbers from 1 to M written on it. Whenever she throws a die, it has an equal probability of landing on each of the M possible values.Pommel places all

2020-09-27 17:21:32 512

原创 杭电多校第10场 6886 Tic-Tac-Toe-Nim(NIM博弈)

Problem DescriptionAlice and Bob are playing a new game that is a mixture of tic-tac-toe and nim.There are 9 piles of stones forming a 3∗3 grid. Players take turns to remove the stones: in each turn, the player choose a remaining pile and remove a positi

2020-09-26 19:40:18 292

原创 杭电多校第10场 6887 Task Scheduler

Problem DescriptionByteCompany has a server cluster with m workers, k of which are somehow disconnected.The task scheduler have just received n tasks, and the i-th task needs to be executed on ti workers.For an executive order of p1,p2,…pn, the task sch

2020-09-26 16:12:19 294

原创 杭电多校第10场 6880 Permutation Counting(DP)

Problem DescriptionFor a given permutation a1,a2,⋯,an of length n, we defined the neighbor sequence b of a, the length of which is n−1, as following:bi={01ai<ai+1ai>ai+1.For example, the neighbor sequence of permutation 1,2,3,6,4,5 is 0,0,0,1,0.

2020-09-26 15:13:58 1830

原创 杭电多校第10场 HDU6879 Mine Sweeper(构造)

题意:扫雷游戏,要求你构造最多25*25大的棋盘,合理的放置雷,使得每个位置的权值和为n(n≤1000)。每个位置的权值为周围8个位置雷的数量,雷的权值为0。思路:考虑依次间隔的放雷,那么每个雷的贡献就是8。那么最后可以弄成8x+y的形式。我们依次的凑,可以在全图里凑出这些3 5 6 7 9这几个数。在部分图里凑出1 2 3 4 5 6 7这几个数。当n≤7的时候,按照部分图的样子直接输出。当n≥8的时候,表示成n=8x+y,按照余数分配一下就好了#include <cstd.

2020-09-25 22:17:04 232

原创 一点点感想

留个坑给了以后放东西。

2020-09-25 19:58:18 225

原创 Codeforces 384B. Multitasking(冒泡)

Iahub wants to enhance his multitasking abilities. In order to do this, he wants to sort n arrays simultaneously, each array consisting of m integers.Iahub can choose a pair of distinct indices i and j (1 ≤ i, j ≤ m, i ≠ j). Then in each array the values

2020-09-25 15:47:43 198

原创 Codeforces 384A - Coder

Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (

2020-09-25 15:43:19 236

原创 Codeforces.383A Milking cows(贪心)

Iahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numbered from 1 to n from left to right. Each cow is either facing to the left or facing to the right. When Iahub milks a cow, all the cows that see th

2020-09-25 13:42:52 249

原创 Codeforces1420 D. Rescue Nibel!(区间,组合数)

Ori and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins… nothing happened.Ori was very surprised, but Sein gave the expla

2020-09-25 13:25:12 829

原创 Codeforces1420 C2. Pokémon Army (hard version)(差分)

This is the hard version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikac

2020-09-25 13:15:01 564

原创 Codeforces 1420 B. Rock and Lever

Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Danik needs to solve the following task.You are given a positive intege

2020-09-25 11:24:03 379

原创 Codeforces1420 A. Cubes Sorting

Wheatley decided to try to make a test chamber. He made a nice test chamber, but there was only one detail absent — cubes.For completing the chamber Wheatley needs ???? cubes. ????-th cube has a volume ????????.Wheatley has to place cubes in such a way t

2020-09-25 11:21:39 312

原创 Codeforces383 C. Propagating tree(dfs序线段树)

Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value ai. The root of the tree is node 1.This tree has a special property: whe

2020-09-24 21:54:30 420 1

原创 Codeforces 383 D. Antimatter(DP)

Iahub accidentally discovered a secret lab. He found there n devices ordered in a line, numbered from 1 to n from left to right. Each device i (1 ≤ i ≤ n) can create either ai units of matter or ai units of antimatter.Iahub wants to choose some contiguous

2020-09-24 21:50:26 207

原创 Codeforces383 B. Volcanoes(难题,大矩形能否走到终点)

Iahub got lost in a very big desert. The desert can be represented as a n × n square matrix, where each cell is a zone of the desert. The cell (i, j) represents the cell at row i and column j (1 ≤ i, j ≤ n). Iahub can go from one cell (i, j) only down or r

2020-09-24 16:43:03 201

原创 Codeforces 383 E. Vowels(SOS DP)

Iahubina is tired of so many complicated languages, so she decided to invent a new, simple language. She already made a dictionary consisting of n 3-words. A 3-word is a sequence of exactly 3 lowercase letters of the first 24 letters of the English alphabe

2020-09-23 16:48:01 388

原创 Codeforces165 E. Compatible Numbers(SOS dp)

Two integers x and y are compatible, if the result of their bitwise “AND” equals zero, that is, a & b = 0. For example, numbers 90 (10110102) and 36 (1001002) are compatible, as 10110102 & 1001002 = 02, and numbers 3 (112) and 6 (1102) are not comp

2020-09-23 12:43:47 235

原创 Codeforces1208 F. Bits And Pieces (SOS DP)

题意:寻找最大的a[i]|a[j]&a[k],满足i<j<k。思路:SOS DP。定义dp[sta][0/1]dp[sta][0/1]dp[sta][0/1]得到stastasta这个状态的最大下标,次大下标。那么初始有dp[a[i]][0]=idp[a[i]][0]=idp[a[i]][0]=i。对于a[j]&a[k],是指就是求a[j]a[j]a[j]的子集或者a[k]a[k]a[k]的子集。所以可以用SOS DP的方法维护出stastasta状态的最大次大下标。

2020-09-23 00:01:09 199

原创 Leetcode 第 207 场周赛

重新排列单词间的空格给你一个字符串 text ,该字符串由若干被空格包围的单词组成。每个单词由一个或者多个小写英文字母组成,并且两个单词之间至少存在一个空格。题目测试用例保证 text 至少包含一个单词 。请你重新排列空格,使每对相邻单词之间的空格数目都 相等 ,并尽可能 最大化 该数目。如果不能重新平均分配所有空格,请 将多余的空格放置在字符串末尾 ,这也意味着返回的字符串应当与原 text 字符串的长度相等。返回 重新排列空格后的字符串 。思路:因为不太懂字符串相关函数,所以没啥可以取巧的.

2020-09-22 19:24:39 142

原创 Codeforces 1419 D2. Sage‘s Birthday (hard version)

This is the hard version of the problem. The difference between the versions is that in the easy version all prices ???????? are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage’s birthday, and she will go

2020-09-22 09:29:42 359

原创 Codeforces1419 E. Decryption(质数)

An agent called Cypher is decrypting a message, that contains a composite number ????. All divisors of ????, which are greater than 1, are placed in a circle. Cypher can choose the initial order of numbers in the circle.In one move Cypher can choose two a

2020-09-22 09:29:40 358

原创 Codeforces 1419C. Killjoy

A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).Killjoy’s account is already infected and has a rating equal to ????

2020-09-21 20:38:35 479

原创 Codeforces 1419B. Stairs

题意:x个方格可以构成多少种不同阶梯图形,要求每个组成单位都是正方形。思路:容易推出sum[i]=sum[i−1]∗2+now∗nowsum[i] = sum[i - 1] * 2 + now * nowsum[i]=sum[i−1]∗2+now∗now,然后算能用多少个就好了。#include <cstdio>#include <cstring>#include <algorithm>#include <vector>#include &lt

2020-09-21 20:32:20 420

原创 Codeforces 1419A. Digit Game

Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play ???? matches of a digit game…In each of ???? matches of the digit game, a positive integer is generated.

2020-09-21 20:30:13 532

原创 Codeforces Global Round 10 G. Omkar and Pies(SOS DP,状压)

Omkar has a pie tray with ???? (2≤????≤20) spots. Each spot in the tray contains either a chocolate pie or a pumpkin pie. However, Omkar does not like the way that the pies are currently arranged, and has another ideal arrangement that he would prefer inst

2020-09-21 20:13:46 673

原创 Codeforces Global Round 10 F. Omkar and Landslide(贪心)

Omkar is standing at the foot of Celeste mountain. The summit is ???? meters away from him, and he can see all of the mountains up to the summit, so for all 1≤????≤???? he knows that the height of the mountain at the point ???? meters away from himself is

2020-09-21 19:49:31 182

空空如也

空空如也

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

TA关注的人

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