06 2020 档案
摘要:You have unweighted tree of nn vertices. You have to assign a positive weight to each edge so that the following condition would hold: For every two d
阅读全文
摘要:Like any unknown mathematician, Yuri has favourite numbers: AA, BB, CC, and DD, where A≤B≤C≤DA≤B≤C≤D. Yuri also likes triangles and once he thought: h
阅读全文
摘要:You are given an array aa consisting of nn integers. Indices of the array start from zero (i. e. the first element is a0a0, the second one is a1a1, an
阅读全文
摘要:You have a given picture with size w×hw×h. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape h
阅读全文
摘要:The only difference between easy and hard versions is constraints. You are given a sequence aa consisting of nn positive integers. Let's define a thre
阅读全文
摘要:Karl likes Codeforces and subsequences. He wants to find a string of lowercase English letters that contains at least kk subsequences codeforces. Out
阅读全文
摘要:#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #include <sstream> #includ
阅读全文
摘要:You are given nn strings a1,a2,…,ana1,a2,…,an: all of them have the same length mm. The strings consist of lowercase English letters. Find any string
阅读全文
摘要:"OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will
阅读全文
摘要:Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now y
阅读全文
摘要:Polycarp wrote on the board a string ss containing only lowercase Latin letters ('a'-'z'). This string is known for you and given in the input. After
阅读全文
摘要:Problem Statement Let NN be a positive odd number. There are NN coins, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), when Coin ii is tossed, it c
阅读全文
摘要:Description YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficul
阅读全文
摘要:#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #include <sstream> #includ
阅读全文
摘要:Problem Statement There is a grid with HH horizontal rows and WW vertical columns. Let (i,j)(i,j) denote the square at the ii-th row from the top and
阅读全文
摘要:Problem Statement There is a directed graph GG with NN vertices and MM edges. The vertices are numbered 1,2,…,N1,2,…,N, and for each ii (1≤i≤M1≤i≤M),
阅读全文
摘要:Problem Statement You are given strings ss and tt. Find one longest string that is a subsequence of both ss and tt. Notes A subsequence of a string xx
阅读全文
摘要:Problem Statement There are NN items, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), Item ii has a weight of wiwi and a value of vivi. Taro has de
阅读全文
摘要:Problem Statement There are NN items, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), Item ii has a weight of wiwi and a value of vivi. Taro has de
阅读全文
摘要:Problem Statement Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of NN days. For each ii (
阅读全文
摘要:Problem Statement There are NN stones, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N1≤i≤N), the height of Stone ii is hihi. There is a frog who is initi
阅读全文
摘要:Every person likes prime numbers. Alice is a person, thus she also shares the love for them. Bob wanted to give her an affectionate gift but couldn't
阅读全文
摘要:Given an array aa of length nn, find another array, bb, of length nn such that: for each ii (1≤i≤n)(1≤i≤n) MEX({b1MEX({b1, b2b2, ……, bi})=aibi})=ai. T
阅读全文
摘要:You are given a matrix with nn rows (numbered from 11 to nn) and mm columns (numbered from 11 to mm). A number ai,jai,j is written in the cell belongi
阅读全文
摘要:The only difference between easy and hard versions is the number of elements in the array. You are given an array aa consisting of nn integers. In one
阅读全文
摘要:You are fighting with Zmei Gorynich — a ferocious monster from Slavic myths, a huge dragon-like reptile with multiple heads! Initially Zmei Gorynich h
阅读全文
摘要:Monocarp and Bicarp live in Berland, where every bus ticket consists of nn digits (nn is an even number). During the evening walk Monocarp and Bicarp
阅读全文
摘要:There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will ta
阅读全文
摘要:Suppose there is a h×wh×w grid consisting of empty or full cells. Let's make some definitions: riri is the number of consecutive full cells connected
阅读全文
摘要:Let's introduce some definitions that will be needed later. Let prime(x)prime(x) be the set of prime divisors of xx. For example, prime(140)={2,5,7}pr
阅读全文
摘要:You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has heigh
阅读全文
摘要:Alice got many presents these days. So she decided to pack them into boxes and send them to her friends. There are nn kinds of presents. Presents of o
阅读全文
摘要:Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he be
阅读全文
摘要:The only difference between easy and hard versions is the maximum value of nn. You are given a positive integer number nn. You really love good number
阅读全文
摘要:Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer p
阅读全文
摘要:You have a set of birthday cake candles. Each of such candles represents a digit between 00 and 99, inclusive. Example of birthday cake candles. Let's
阅读全文
摘要:Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The pa
阅读全文
摘要:扩展欧几里得求逆元 void exgcd ( int a , int b ) { if ( b == 0 ) { x = 1; y = 0; return ; } exgcd ( b , a % b ); int xx , yy; xx = y; yy = x - (a/b) * y; x = xx
阅读全文
摘要:Tsumugi brought nn delicious sweets to the Light Music Club. They are numbered from 11 to nn, where the ii-th sweet has a sugar concentration describe
阅读全文
摘要:You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your pun
阅读全文
摘要:E 判断是否有死循环 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #include <sstre
阅读全文
摘要:Ayush and Ashish play a game on an unrooted tree consisting of nn nodes numbered 11 to nn. Players make the following move in turns: Select any leaf n
阅读全文

浙公网安备 33010602011771号