自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Codeforces Round #540 (Div. 3) E. Yet Another Ball Problem

k个颜色,总共的搭配应该是k * (k - 1)可以证明k * (k - 1)都是可以出现的,即符合题目的4天限制条件证明如下:假设k 为 4 , 1为合理搭配, 0 为不合理搭配    1    2    3    41    0   1   1     1    2    1    0    1    13     1     1   0    14     1...

2019-02-25 17:39:26 180

原创 Codeforces Round #540 (Div. 3) B. Tanya and Candies

直接维护第i个数为止,前面的奇数的数的累加和 和偶数的数的累加和然后枚举判断这个数拿不拿,那的话这个数之后的奇数和偶数的累加和反转#include<bits/stdc++.h>#define ll long longusing namespace std;const int MAXN = 2e5 + 10;int cs[MAXN];ll ji[MAXN], ou[...

2019-02-25 17:09:42 168

原创 Codeforces Round #540 (Div. 3) A. Water Buying

由于2是1的倍数,所以直接判断2的是否比2 * 1的便宜,便宜先买2,否则只买1#include<bits/stdc++.h>#define ll long longusing namespace std;int main(){ int T; scanf("%d", &T); while(T --) { ll n...

2019-02-25 17:07:10 168

原创 Codeforces Round #540 (Div. 3) C. Palindromic Matrix

这题真的快搞死我了首先一遍读入一遍桶排序要是偶数的情况的话,则右上角1/4那块应该与左上角1/4那块对称,然后上半部分和下半部分对称所以,每个数的数量都要是4的倍数,判断可行性然后填充,填充只用填充右上角1/4,对称得到左上角1/4,再对称得到下半部分现在考虑奇数的情况设mid = n / 2 + 1,要是忽略mid行和mid列,则剩下的区域和偶数部分是一样的处理但是现...

2019-02-25 17:05:35 180

原创 Codeforces Round #540 (Div. 3) Coffee and Coursework

由于我是直接写的hard版本的,而hard版本和easy版本只有数据范围的差距,所以在此只阐述hard版本的题解(easy版也能过,但是easy的数据范围应该还有其他方法可以偷跑过去)假设x天可以完成,那么x+1天肯定可以,因为x+1天的第一杯咖啡是没有损耗的(本题中由于每多一天,咖啡效果-1,所以记作孙损耗)假设x天无法完成,那么x-1天肯定不行,因为x天起码第一杯咖啡是没有损耗的故...

2019-02-25 16:57:03 146

原创 A - ACM Computer Factory

As you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are historically produced at the same factory.Ever...

2018-08-29 15:31:00 296

原创 P1378 油滴扩展

题目描述在一个长方形框子里,最多有N(0≤N≤6)个相异的点,在其中任何一个点上放一个很小的油滴,那么这个油滴会一直扩展,直到接触到其他油滴或者框子的边界。必须等一个油滴扩展完毕才能放置下一个油滴。那么应该按照怎样的顺序在这N个点上放置油滴,才能使放置完毕后所有油滴占据的总体积最大呢?(不同的油滴不会相互融合)注:圆的面积公式V=pi*r*r,其中r为圆的半径。输入输出格式输入格式...

2018-08-21 15:47:58 214

原创 P1120 小木棍 [数据加强版]

题目描述乔治有一些同样长的小木棍,他把这些木棍随意砍成几段,直到每段的长都不超过 5050 。现在,他想把小木棍拼接成原来的样子,但是却忘记了自己开始时有多少根木棍和它们的长度。给出每段小木棍的长度,编程帮他找出原始木棍的最小可能长度。输入输出格式输入格式: 共二行。第一行为一个单独的整数N表示砍过以后的小木棍的总数,其中 N≤65N≤65(管理员注:要把超过 ...

2018-08-21 11:17:40 173

原创 P2468 [SDOI2010]粟粟的书架

题目描述幸福幼儿园B29班的粟粟是一个聪明机灵、乖巧可爱的小朋友,她的爱好是画画和读书,尤其喜欢Thomas H. Cormen的文章。粟粟家中有一个R行C列的巨型书架,书架的每一个位置都摆有一本书,上数第i行、左数第j列摆放的书有Pi,j页厚。粟粟每天除了读书之外,还有一件必不可少的工作就是摘苹果,她每天必须摘取一个指定的苹果。粟粟家果树上的苹果有的高、有的低,但无论如何凭粟粟自己的个头...

2018-08-16 22:22:46 246

原创 K-th Number

DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able t...

2018-08-14 19:27:38 387

原创 P2161 [SHOI2009]会场预约

题目描述PP大厦有一间空的礼堂,可以为企业或者单位提供会议场地。这些会议中的大多数都需要连续几天的时间(个别的可能只需要一天),不过场地只有一个,所以不同的会议的时间申请不能够冲突。也就是说,前一个会议的结束日期必须在后一个会议的开始日期之前。所以,如果要接受一个新的场地预约申请,就必须拒绝掉与这个申请相冲突的预约。 一般来说,如果PP大厦方面事先已经接受了一个会场预约,例如从10日到15日,...

2018-08-14 02:09:47 179

原创 Codeforces 527C Glass Carvi

#include<bits/stdc++.h>#define ls l, mid, rt << 1#define rs mid + 1, r, rt << 1 | 1using namespace std;const int MAXN = 200000 + 10;struct f{ int maxx; int ll, rr; int l, ...

2018-08-12 19:52:04 236

原创 C - 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 ...

2018-08-12 13:36:18 185

原创 B - I Hate It (非递归版)

很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5...

2018-08-12 13:10:22 204

原创 A - 敌兵布阵 (非递归版本的线段树)

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...

2018-08-11 13:38:15 242

原创 1989. Subpalindromes

Time limit: 0.5 secondMemory limit: 64 MBYou have a string and queries of two types:replace i’th character of the string by character a; check if substring sj...sk is a palindrome.InputThe fi...

2018-08-10 13:31:48 257

原创 P2023 [AHOI2009]维护序列

题目描述老师交给小可可一个维护数列的任务,现在小可可希望你来帮他完成。 有长为N的数列,不妨设为a1,a2,…,aN 。有如下三种操作形式: (1)把数列中的一段数全部乘一个值; (2)把数列中的一段数全部加一个值; (3)询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模P的值。输入输出格式输入格式: 第一行两个整数N和P(1≤P≤1000000000)。 第二行含...

2018-08-09 10:47:02 239

原创 P1972 [SDOI2009]HH的项链

题目背景无题目描述HH 有一串由各种漂亮的贝壳组成的项链。HH 相信不同的贝壳会带来好运,所以每次散步完后,他都会随意取出一段贝壳,思考它们所表达的含义。HH 不断地收集新的贝壳,因此,他的项链变得越来越长。有一天,他突然提出了一个问题:某一段贝壳中,包含了多少种不同的贝壳?这个问题很难回答……因为项链实在是太长了。于是,他只好求助睿智的你,来解决这个问题。输入输出格式输入格式...

2018-08-09 10:46:16 138

原创 P1198 [JSOI2008]最大数

题目描述现在请求你维护一个数列,要求提供以下两种操作:1、 查询操作。语法:Q L功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值。限制: LL 不超过当前数列的长度。 (L > 0)(L>0)2、 插入操作。语法:A n功能:将 nn 加上 tt ,其中 tt 是最近一次查询操作的答案(如果还未执行过查询操作,则 t=0t=0 ),并将所得...

2018-08-09 10:45:37 165

原创 Q - Get The Treasury HDU - 3642

Problem DescriptionJack knows that there is a great underground treasury in a secret region. And he has a special device that can be used to detect treasury under the surface of the earth. One day h...

2018-08-06 03:03:35 224

原创 P - Atlantis HDU - 1542

There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe diff...

2018-08-05 15:49:51 165

原创 O - 覆盖的面积 HDU - 1255

给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.  Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮点数,代表平面上的一个矩形的左上角坐标和右下角坐标,矩形的上下边和X轴平行,左右边和Y轴平行.坐标的范...

2018-08-05 15:49:15 254

原创 N - Picture POJ - 1177

A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partially or totally covered b...

2018-08-05 15:48:33 390

原创 M - 约会安排

  寒假来了,又到了小明和女神们约会的季节。   小明虽为屌丝级码农,但非常活跃,女神们常常在小明网上的大段发言后热情回复“呵呵”,所以,小明的最爱就是和女神们约会。与此同时,也有很多基友找他开黑,由于数量实在过于巨大,怎么安排时间便成了小明的一大心事。   我们已知小明一共有T的空闲时间,期间会有很多女神或者基友来找小明。   作为一个操作系统曾经怒考71分的大神,小明想到了一个算法,即“...

2018-08-02 20:47:52 331

原创 L - Vases and Flowers

  Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in one vase. ...

2018-08-02 12:59:10 294

原创 L - Vases and Flowers

  Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in one vase. ...

2018-08-01 11:41:26 152

原创 杭电多校第一场 Balanced Sequence

Problem DescriptionChiaki has n strings s1,s2,…,sn consisting of '(' and ')'. A string of this type is said to be balanced:+ if it is the empty string+ if A and B are balanced, AB is balanced,+ i...

2018-07-26 20:07:10 172

原创 杭电2018多校赛第一场 Distinct Values

Problem DescriptionChiaki has an array of n positive integers. You are told some facts about the array: for every two elements ai and aj in the subarray al..r (l≤i<j≤r), ai≠ajholds.Chiaki would ...

2018-07-26 15:56:24 268

原创 杭电多校赛第二场 Game

Problem DescriptionAlice and Bob are playing a game.The game is played on a set of positive integers from 1 to n.In one step, the player can choose a positive integer from the set, and erase all o...

2018-07-26 10:01:20 240

原创 K - Transformation

Yuanfang is puzzled with the question below: There are n integers, a 1, a 2, …, a n. The initial values of them are 0. There are four kinds of operations. Operation 1: Add c to each number between a...

2018-07-26 09:59:00 207

原创 J - Assign the task

There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leader of whole company).If you are the immediate boss of someone,that ...

2018-07-24 23:47:36 196

原创 I - Tunnel Warfare

During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...

2018-07-24 22:16:51 374

原创 H - Can you answer these queries?

A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end...

2018-07-23 20:17:41 163

原创 G - Balanced Lineup

For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things ...

2018-07-23 19:15:50 234

原创 2018 Multi-University Training Contest 1 Time Zone

Problem DescriptionChiaki often participates in international competitive programming contests. The time zone becomes a big problem.Given a time in Beijing time (UTC +8), Chiaki would like to know ...

2018-07-23 18:03:26 215

原创 2018 Multi-University Training Contest 1 Maximum Multiple

Problem DescriptionGiven an integer n, Chiaki would like to find three positive integers x, y and z such that: n=x+y+z, x∣n, y∣n, z∣n and xyz is maximum.  InputThere are multiple test cases....

2018-07-23 18:02:17 205

原创 F - Count the Colors

Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last. ...

2018-07-23 10:27:15 199

原创 E - Just a Hook

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now Pud...

2018-07-22 19:55:54 230

原创 D - Mayor's posters

The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d...

2018-07-22 19:03:34 165

原创 C - 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 ...

2018-07-22 14:20:04 173

空空如也

空空如也

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

TA关注的人

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