10 2022 档案
摘要:Next Greater Element IV You are given a 0-indexed array of non-negative integers nums . For each integer in nums , you must find its respective second
阅读全文
摘要:C1. Sheikh (Easy version) This is the easy version of the problem. The only difference is that in this version $q=1$. You are given an array of intege
阅读全文
摘要:D. Factorial Divisibility You are given an integer $x$ and an array of integers $a_1,a_2, \dots ,a_n$. You have to determine if the number $a_1!+a_2!+
阅读全文
摘要:F. MEX vs MED You are given a permutation $p_1,p_2, \dots ,p_n$ of length $n$ of numbers $0, \dots ,n−1$. Count the number of subsegments $1 \leq l \l
阅读全文
摘要:E. FTL Monocarp is playing a video game. In the game, he controls a spaceship and has to destroy an enemy spaceship. Monocarp has two lasers installed
阅读全文
摘要:C1. Make Nonzero Sum (easy version) This is the easy version of the problem. The difference is that in this version the array can not contain zeros. Y
阅读全文
摘要:D1. Balance (Easy version) This is the easy version of the problem. The only difference is that in this version there are no "remove" queries. Initial
阅读全文
摘要:B. Ugu A binary string is a string consisting only of the characters $0$ and $1$. You are given a binary string $s_1 s_2 \dots s_n$. It is necessary t
阅读全文
摘要:A. Bestie You are given an array $a$ consisting of $n$ integers $a_1,a_2, \dots ,a_n$. Friends asked you to make the greatest common divisor (GCD) of
阅读全文
摘要:三元组 给定 $n$ 个两两不同的正整数 $a_1,a_2, \dots ,a_n$。 请你计算共有多少个三元组 $(i,j,k)$ 能够同时满足: $i<j<k$ $a_i>a_j>a_k$ 输入格式 第一行包含整数 $n$。 第二行包含 $n$ 个整数 $a_1,a_2, \dots ,a_n$
阅读全文
摘要:D. Problem with Random Tests You are given a string $s$ consisting of $n$ characters. Each character of $s$ is either $0$ or $1$. A substring of $s$ i
阅读全文
摘要:C. Save the Magazines Monocarp has been collecting rare magazines for quite a while, and now he has decided to sell them. He distributed the magazines
阅读全文
摘要:E2. Divisible Numbers (hard version) This is an hard version of the problem. The only difference between an easy and a hard version is the constraints
阅读全文
摘要:E1. Divisible Numbers (easy version) This is an easy version of the problem. The only difference between an easy and a hard version is the constraints
阅读全文
摘要:Count Subarrays With Fixed Bounds You are given an integer array nums and two integers minK and maxK . A fixed-bound subarray of nums is a subarray th
阅读全文
摘要:Minimize Maximum of Array You are given a 0-indexed array nums comprising of $n$ non-negative integers. In one operation, you must: Choose an integer
阅读全文
摘要:最短路程 给定一个 $n$ 个节点的树。 节点编号为 $1 \sim n$。 树中所有边均为双向边,且长度均已知。 你需要从 $1$ 号点出发,沿着一条路径遍历树中所有点,路径中可以包含重复的点和边。 要求,你的行程总长度应尽可能短。 请你计算,你所需的行程总长度的最小可能值。 注意,你可以在任意点
阅读全文
摘要:F. Multi-Colored Segments Dmitry has $n$ segments of different colors on the coordinate axis $Ox$. Each segment is characterized by three integers $l_
阅读全文
摘要:E. Sending a Sequence Over the Network The sequence $a$ is sent over the network as follows: sequence $a$ is split into segments (each element of the
阅读全文
摘要:D. Equal Binary Subsequences Everool has a binary string $s$ of length $2n$. Note that a binary string is a string consisting of only characters $0$ a
阅读全文
摘要:C1. Good Subarrays (Easy Version) This is the easy version of this problem. In this version, we do not have queries. Note that we have multiple test c
阅读全文
摘要:B. Playing with GCD You are given an integer array $a$ of length $n$. Does there exist an array $b$ consisting of $n+1$ positive integers such that $a
阅读全文
摘要:Minimum Swaps To Make Sequences Increasing You are given two integer arrays of the same length nums1 and nums2 . In one operation, you are allowed to
阅读全文
摘要:Using a Robot to Print the Lexicographically Smallest String You are given a string s and a robot that currently holds an empty string t . Apply one o
阅读全文
摘要:最小移动距离 平面上有 $n$ 个点,编号为 $1 \sim n$。 对于每个点 $i$($1 \leq i \leq n$),都存在一条从点 $i$ 到点 $a_i$($1 \leq a_i \leq n$,$a_i$ 可以等于 $i$)的有向边。 所有边的长度均为 $1$。 请你判断是否存在一个
阅读全文
摘要:Maximum Deletions on a String You are given a string s consisting of only lowercase English letters. In one operation, you can: Delete the entire stri
阅读全文
摘要:买糖果 $n$ 个糖果店,围成一圈。 店铺按顺时针顺序从 $1$ 到 $n$ 编号,$n$ 号店铺与 $1$ 号店铺相邻。 第 $i$ 号店铺的单个糖果售价为 $a_i$ 元。 李华拿着 $T$ 元钱去购买糖果,具体购买过程如下: 初始时,他位于 $1$ 号店铺。 如果他现有的钱足够在当前店铺购买一
阅读全文
摘要:整数拆分 我们规定 $f(x)$($x \geq 2$)表示整数 $x$ 的除本身之外的最大因数。 例如,$f(6)=3$,$f(25)=5$,$f(2)=1$。 现在,给定一个整数 $n$,请你将其拆分为 $k$ 份 $n_1,n_2, \dots ,n_k$(也可以不拆分,即 $k=1$),要求
阅读全文