NIRVANA


  • HOME

  • TAGS

  • ARCHIVES

  • ABOUT

  • SITEMAP

  • SEARCH

BZOJ4126 国王奇遇记加强版之再加强版 <多项式插值>

发表于 2018-09-21
字数统计: 1,164 | 阅读时长 ≈ 6

Problem

国王奇遇记加强版之再加强版


Description



Input

共一行,包括两个正整数 和 。

Output

共一行,为所求表达式的值对 取模的值。

阅读全文 »

BZOJ4002【JLOI2015】有意义的字符串 <线性齐次递推>

发表于 2018-09-20
字数统计: 562 | 阅读时长 ≈ 3

Problem

【JLOI2015】有意义的字符串


Description

君 有两个好朋友,他们叫宁宁和冉冉。
有一天,冉冉遇到了一个有趣的题目:输入 ,求

Input

一行三个整数 。

Output

一行一个数表示模 之后的结果。

阅读全文 »

ARC068F Solitaire <计数DP>

发表于 2018-09-20
字数统计: 685 | 阅读时长 ≈ 3

Problem

Solitaire


Statement

Snuke has decided to play with cards and a deque (that is, a double-ended queue). Each card shows an integer from through , and the deque is initially empty.
Snuke will insert the cards at the beginning or the end of the deque one at a time, in order from to . Then, he will perform the following action times: take out the card from the beginning or the end of the deque and eat it.
Afterwards, we will construct an integer sequence by arranging the integers written on the eaten cards, in the order they are eaten. Among the sequences that can be obtained in this way, find the number of the sequences such that the element is . Print the answer modulo .

Constraints

Input

The input is given from Standard Input in the following format:

Output

Print the answer modulo .

阅读全文 »

BZOJ3516 国王奇遇记加强版 <扰动法>

发表于 2018-09-19
字数统计: 466 | 阅读时长 ≈ 3

Problem

国王奇遇记加强版


Description



Input

共一行,包括两个正整数 和 。

Output

共一行,为所求表达式的值对 取模的值。

阅读全文 »

HR34E Magic Cards <状压>

发表于 2018-09-19
字数统计: 1,257 | 阅读时长 ≈ 6

Problem

Magic Cards

by Birjik

Description

Birzhan has cards, numbered from to . Every card has each number from to written on it. Some numbers exist on the front side of the card and some on the back side. No number exists on both the sides of a card at the same time. These cards are placed on the table in a row such that only one side is visible. Birzhan is allowed to flip them any number of times.
Now, Birzhan has to answer queries each of them consisting of two integers and ( ). We define as the sum of the squares of every integer from to if it exists on the visible side of any card numbered from to . Given that Birzhan can flip any number of cards any number of times, find and print the maximum value of .
For example, given cards and we have the as follows:-




Now, for and . We have on the two cards, the sum of their squares is .
If we flip the first card, we get , the sum of their squares is .
And, if we flip both cards, we get , the sum of their squares is
Hence, the maximum value of in the above case is .

Input Format

The first line contains three space-separated integers, , , and , denoting the number of cards, what numbers written on each card, and the number of queries, respectively.
Each of the next lines describes the cards. On each line, the first number is , denoting the count of numbers written on the visible side of the card. Next space-separated unique integers represent the numbers written on the visible side of that card, each between and .
Next lines contain two space-separated integers, and , describing the query mentioned above.

Constraints

Output Format

Print the maximum value of for each query.

阅读全文 »

BZOJ2001【HNOI2010】城市建设 < CDQ分治+MST >

发表于 2018-09-19
字数统计: 1,380 | 阅读时长 ≈ 7

Problem

【HNOI2010】城市建设


Description

国 是一个拥有诸多城市的大国,国王 为城市的交通建设可谓绞尽脑汁。 可以在某些城市之间修建道路,在不同的城市之间修建道路需要不同的花费。 希望建造最少的道路使得国内所有的城市连通。但是由于某些因素,城市之间修建道路需要的花费会随着时间而改变, 会不断得到某道路的修建代价改变的消息,他希望每得到一条消息后能立即知道使城市连通的最小花费总和, 决定求助于你来完成这个任务。

Input

第一行三个整数 ,分别表示城市的数目,可以修建的道路个数,收到的消息个数。
接下来 行,第 行有三个用空格隔开的整数 ( ),表示在城市 与城市 之间修建道路的代价为 。
接下来 行,每行包含两个数 ,表示输入的第 个道路的修建代价修改为 (即将 修改为 )。

Output

行,第 行输出得知前 条消息后使城市连通的最小花费总和。

阅读全文 »

BZOJ3157 国王奇遇记 <倍增>

发表于 2018-09-19
字数统计: 475 | 阅读时长 ≈ 3

Problem

国王奇遇记


Description



Input

共一行,包括两个正整数 和 。

Output

共一行,为所求表达式的值对 取模的值。

阅读全文 »

BZOJ4001【TJOI2015】概率论 <生成函数>

发表于 2018-09-18
字数统计: 430 | 阅读时长 ≈ 2

Problem

【TJOI2015】概率论


Description



Input

输入一个正整数 ,代表有根树的节点数。

Output

输出这棵树期望的叶子节点数。要求误差小于 。

阅读全文 »

CF40E Number Table <计数>

发表于 2018-09-18
字数统计: 947 | 阅读时长 ≈ 5

Problem

Number Table


Description

As it has been found out recently, all the Berland’s current economical state can be described using a simple table in size. ― the number of days in each Berland month, ― the number of months. Thus, a table cell corresponds to a day and a month of the Berland’s year. Each cell will contain either , or , which means the state’s gains in a particular month, on a particular day. corresponds to profits, corresponds to losses. It turned out important for successful development to analyze the data on the state of the economy of the previous year, however when the treasurers referred to the archives to retrieve the data, it turned out that the table had been substantially damaged. In some table cells the number values had faded and were impossible to be deciphered. It is known that the number of cells in which the data had been preserved is strictly less than . However, there is additional information ― the product of the numbers in each line and column equaled . Your task is to find out how many different tables may conform to the preserved data. As the answer to the task can be quite large, you have to find it modulo .

Input

The first line contains integers and . The second line contains the integer ― the number of cells in which the data had been preserved. The next lines contain the data on the state of the table in the preserved cells. Each line is of the form a b c, where ― the number of the table row, ― the number of the column, ― the value containing in the cell ( or ). They are numbered starting from . It is guaranteed that no two lines with same and values exist. The last line contains an integer .

Output

Print the number of different tables that could conform to the preserved data modulo .

阅读全文 »

BZOJ4184 Shallot <线段树分治+凸包>

发表于 2018-09-13
字数统计: 800 | 阅读时长 ≈ 4

Problem

Shallot


Description

小苗去市场上买了一捆小葱苗,她突然一时兴起,于是她在每颗小葱苗上写上一个数字,然后把小葱叫过来玩游戏。
每个时刻她会给小葱一颗小葱苗或者是从小葱手里拿走一颗小葱苗,并且让小葱从自己手中的小葱苗里选出一些小葱苗使得选出的小葱苗上的数字的异或和最大。
这种小问题对于小葱来说当然不在话下,但是他的身边没有电脑,于是他打电话给同为 选手的你,你能帮帮他吗?
你只需要输出最大的异或和即可,若小葱手中没有小葱苗则输出0。

Input

第一行一个正整数 表示总时间。
第二行 个整数 ,若 大于 代表给了小葱一颗数字为 的小葱苗,否则代表从小葱手中拿走一颗数字为 的小葱苗。

Output

输出共 行,每行一个整数代表第 个时刻的最大异或和。

阅读全文 »
1234…27
Azrael_Death

Azrael_Death

Veni, Vidi, Vici

270 日志
153 标签
RSS
GitHub ZhiHu
友链
  • OwenOwl
  • Joker
  • Aziint
  • DXY
  • Demon_Rieman
  • myjs999
  • wsyzh
  • YJQ
  • Candy
  • ZigZag
  • BYVoid
  • cxjyxx_me
  • ShuiZiLong
  • KuangBin
  • Crazy_Cloud
  • SkyWalkert
  • RuanXingZhi
  • Riteme
© 2019 Azrael_Death | Site words total count: 256.2k
本站访客数:
|
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4
0%