随笔分类 - 题库—Codeforces比赛
摘要:Soroush and Keshi each have a labeled and rooted tree on 𝑛n vertices. Both of their trees are rooted from vertex 11. Soroush and Keshi used to be at
阅读全文
摘要:题目描述 Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random
阅读全文
摘要:A You are given 𝑛n integers 𝑎1,𝑎2,…,𝑎𝑛a1,a2,…,an. Find the maximum value of 𝑚𝑎𝑥(𝑎𝑙,𝑎𝑙+1,…,𝑎𝑟)⋅𝑚𝑖𝑛(𝑎𝑙,𝑎𝑙+1,…,𝑎𝑟)max(a
阅读全文
摘要:Suppose you have two points 𝑝=(𝑥𝑝,𝑦𝑝)p=(xp,yp) and 𝑞=(𝑥𝑞,𝑦𝑞)q=(xq,yq). Let's denote the Manhattan distance between them as 𝑑(𝑝,𝑞)=|𝑥𝑝−�
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int n, k; void process() { int r; cin >> r; if(r == 1) return; for(int i = 1; i < n; i++) { cout << (i ^
阅读全文
摘要:AquaMoon had 𝑛n strings of length 𝑚m each. 𝑛n is an odd number. When AquaMoon was gone, Cirno tried to pair these 𝑛n strings together. After makin
阅读全文
摘要:AquaMoon has 𝑛n friends. They stand in a row from left to right, and the 𝑖i-th friend from the left wears a T-shirt with a number 𝑎𝑖ai written on
阅读全文
摘要:Cirno gave AquaMoon a chessboard of size 1×𝑛1×n. Its cells are numbered with integers from 11 to 𝑛n from left to right. In the beginning, some of th
阅读全文
摘要:The weight of a sequence is defined as the number of unordered pairs of indexes (𝑖,𝑗)(i,j) (here 𝑖<𝑗i<j) with same value (𝑎𝑖=𝑎𝑗ai=aj). For exa
阅读全文
摘要:ABC Conjecture Time limit: 3 seconds Figure 1: Shinichi Mochizuki The ABC conjecture (also known as the Oesterle–Masser conjec- ´ ture) is a famous co
阅读全文
摘要:We will consider the numbers 𝑎a and 𝑏b as adjacent if they differ by exactly one, that is, |𝑎−𝑏|=1|a−b|=1. We will consider cells of a square matr
阅读全文
摘要:You are playing the game "Arranging The Sheep". The goal of this game is to make the sheep line up. The level in the game is described by a string of
阅读全文
摘要:Phoenix has n blocks of height h1,h2,…,hn, and all hi don't exceed some value x. He plans to stack all 𝑛n blocks into m separate towers. The height o
阅读全文
摘要:To satisfy his love of matching socks, Phoenix has brought his n socks (n is even) to the sock store. Each of his socks has a color ci and is either a
阅读全文
摘要:You are given two integer arrays a and b of length n. You can reverse at most one subarray (continuous subsegment) of the array 𝑎a. Your task is to r
阅读全文
摘要:Polycarp is an organizer of a Berland ICPC regional event. There are 𝑛n universities in Berland numbered from 1 to n. Polycarp knows all competitive
阅读全文
摘要:There is a n×m grid. You are standing at cell (1,1) and your goal is to finish at cell (n,m). You can move to the neighboring cells to the right or do
阅读全文
摘要:You have r red and b blue beans. You'd like to distribute them among several (maybe, one) packets in such a way that each packet: has at least one red
阅读全文
摘要:Baby Ehab was toying around with arrays. He has an array a of length n. He defines an array to be good if there's no way to partition it into 2 subseq
阅读全文
摘要:You are given three integers a, 𝑏b and c. Find two positive integers x and y (x>0, y>0) such that: the decimal representation of x without leading ze
阅读全文