problem_number
stringclasses
123 values
problem_letter
stringclasses
33 values
problem_title
stringlengths
1
46
tags
stringlengths
2
129
difficulty
stringclasses
41 values
problem_link
stringlengths
43
56
start_time
stringclasses
117 values
language
stringclasses
2 values
problem_site
stringclasses
3 values
description
stringlengths
331
6.84k
1994
C
Hungry Games
["binary search", "dp", "two pointers"]
1600
https://codeforces.com/problemset/problem/1994/C
1721313300
en
codeforces
# Hungry Games ## Problem Description Yaroslav is playing a computer game, and at one of the levels, he encountered $ n $ mushrooms arranged in a row. Each mushroom has its own level of toxicity; the $ i $ -th mushroom from the beginning has a toxicity level of $ a_i $ . Yaroslav can choose two integers $ 1 \le l \le...
1994
B
Fun Game
["bitmasks", "constructive algorithms", "greedy", "math"]
1100
https://codeforces.com/problemset/problem/1994/B
1721313300
en
codeforces
# Fun Game ## Problem Description Vova really loves the [XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operation (denoted as $ \oplus $ ). Recently, when he was going to sleep, he came up with a fun game. At the beginning of the game, Vova chooses two binary sequences $ s $ and $ t $ of length $ n $ and ...
1994
A
Diverse Game
["constructive algorithms", "greedy", "implementation"]
800
https://codeforces.com/problemset/problem/1994/A
1721313300
en
codeforces
# Diverse Game ## Problem Description Petr, watching Sergey's stream, came up with a matrix $ a $ , consisting of $ n $ rows and $ m $ columns (the number in the $ i $ -th row and $ j $ -th column is denoted as $ a_{i, j} $ ), which contains all integers from $ 1 $ to $ n \cdot m $ . But he didn't like the arrangemen...
1993
F2
Dyn-scripted Robot (Hard Version)
["chinese remainder theorem", "math", "number theory"]
2800
https://codeforces.com/problemset/problem/1993/F2
1722782100
en
codeforces
# Dyn-scripted Robot (Hard Version) ## Problem Description This is the hard version of the problem. The only difference is that in this version $ k \le 10^{12} $ . You can make hacks only if both versions of the problem are solved. Given a $ w \times h $ rectangle on the $ Oxy $ plane, with points $ (0, 0) $ at the ...
1993
F1
Dyn-scripted Robot (Easy Version)
["brute force", "chinese remainder theorem", "constructive algorithms", "math", "number theory"]
2400
https://codeforces.com/problemset/problem/1993/F1
1722782100
en
codeforces
# Dyn-scripted Robot (Easy Version) ## Problem Description This is the easy version of the problem. The only difference is that in this version $ k \le n $ . You can make hacks only if both versions of the problem are solved. Given a $ w \times h $ rectangle on the $ Oxy $ plane, with points $ (0, 0) $ at the bottom...
1993
E
Xor-Grid Problem
["bitmasks", "constructive algorithms", "dp", "implementation"]
2700
https://codeforces.com/problemset/problem/1993/E
1722782100
en
codeforces
# Xor-Grid Problem ## Problem Description Given a matrix $ a $ of size $ n \times m $ , each cell of which contains a non-negative integer. The integer lying at the intersection of the $ i $ -th row and the $ j $ -th column of the matrix is called $ a_{i,j} $ . Let's define $ f(i) $ and $ g(j) $ as the [XOR](https:/...
1993
D
Med-imize
["binary search", "dp", "greedy"]
2200
https://codeforces.com/problemset/problem/1993/D
1722782100
en
codeforces
# Med-imize ## Problem Description Given two positive integers $ n $ and $ k $ , and another array $ a $ of $ n $ integers. In one operation, you can select any subarray of size $ k $ of $ a $ , then remove it from the array without changing the order of other elements. More formally, let $ (l, r) $ be an operation ...
1993
C
Light Switches
["implementation", "math"]
1400
https://codeforces.com/problemset/problem/1993/C
1722782100
en
codeforces
# Light Switches ## Problem Description There is an apartment consisting of $ n $ rooms, each with its light initially turned off. To control the lights in these rooms, the owner of the apartment decided to install chips in the rooms so that each room has exactly one chip, and the chips are installed at different ti...
1993
B
Parity and Sum
["constructive algorithms", "greedy"]
1100
https://codeforces.com/problemset/problem/1993/B
1722782100
en
codeforces
# Parity and Sum ## Problem Description Given an array $ a $ of $ n $ positive integers. In one operation, you can pick any pair of indexes $ (i, j) $ such that $ a_i $ and $ a_j $ have distinct parity, then replace the smaller one with the sum of them. More formally: - If $ a_i < a_j $ , replace $ a_i $ with $ a_i...
1993
A
Question Marks
["greedy", "implementation"]
800
https://codeforces.com/problemset/problem/1993/A
1722782100
en
codeforces
# Question Marks ## Problem Description Tim is doing a test consisting of $ 4n $ questions; each question has $ 4 $ options: 'A', 'B', 'C', and 'D'. For each option, there are exactly $ n $ correct answers corresponding to that option — meaning there are $ n $ questions with the answer 'A', $ n $ questions with the a...
1992
G
Ultra-Meow
["combinatorics", "dp", "math"]
2000
https://codeforces.com/problemset/problem/1992/G
1720708500
en
codeforces
# Ultra-Meow ## Problem Description K1o0n gave you an array $ a $ of length $ n $ , consisting of numbers $ 1, 2, \ldots, n $ . Accept it? Of course! But what to do with it? Of course, calculate $ \text{MEOW}(a) $ . Let $ \text{MEX}(S, k) $ be the $ k $ -th positive (strictly greater than zero) integer in ascending ...
1992
F
Valuable Cards
["brute force", "dp", "greedy", "number theory", "two pointers"]
1900
https://codeforces.com/problemset/problem/1992/F
1720708500
en
codeforces
# Valuable Cards ## Problem Description In his favorite cafe Kmes once again wanted to try the herring under a fur coat. Previously, it would not have been difficult for him to do this, but the cafe recently introduced a new purchasing policy. Now, in order to make a purchase, Kmes needs to solve the following probl...
1992
E
Novice's Mistake
["brute force", "constructive algorithms", "implementation", "math", "strings"]
1700
https://codeforces.com/problemset/problem/1992/E
1720708500
en
codeforces
# Novice's Mistake ## Problem Description One of the first programming problems by K1o0n looked like this: "Noobish\_Monk has $ n $ $ (1 \le n \le 100) $ friends. Each of them gave him $ a $ $ (1 \le a \le 10000) $ apples for his birthday. Delighted with such a gift, Noobish\_Monk returned $ b $ $ (1 \le b \le \min(1...
1992
D
Test of Love
["dp", "greedy", "implementation"]
1200
https://codeforces.com/problemset/problem/1992/D
1720708500
en
codeforces
# Test of Love ## Problem Description ErnKor is ready to do anything for Julen, even to swim through crocodile-infested swamps. We decided to test this love. ErnKor will have to swim across a river with a width of $ 1 $ meter and a length of $ n $ meters. The river is very cold. Therefore, in total (that is, through...
1992
C
Gorilla and Permutation
["constructive algorithms", "math"]
900
https://codeforces.com/problemset/problem/1992/C
1720708500
en
codeforces
# Gorilla and Permutation ## Problem Description Gorilla and Noobish\_Monk found three numbers $ n $ , $ m $ , and $ k $ ( $ m < k $ ). They decided to construct a permutation $ ^{\dagger} $ of length $ n $ . For the permutation, Noobish\_Monk came up with the following function: $ g(i) $ is the sum of all the numbe...
1992
B
Angry Monk
["greedy", "math", "sortings"]
800
https://codeforces.com/problemset/problem/1992/B
1720708500
en
codeforces
# Angry Monk ## Problem Description To celebrate his recovery, k1o0n has baked an enormous $ n $ metres long potato casserole. Turns out, Noobish\_Monk just can't stand potatoes, so he decided to ruin k1o0n's meal. He has cut it into $ k $ pieces, of lengths $ a_1, a_2, \dots, a_k $ meters. k1o0n wasn't keen on tha...
1992
A
Only Pluses
["brute force", "constructive algorithms", "greedy", "math", "sortings"]
800
https://codeforces.com/problemset/problem/1992/A
1720708500
en
codeforces
# Only Pluses ## Problem Description Kmes has written three integers $ a $ , $ b $ and $ c $ in order to remember that he has to give Noobish\_Monk $ a \times b \times c $ bananas. Noobish\_Monk has found these integers and decided to do the following at most $ 5 $ times: - pick one of these integers; - increase it...
1991
I
Grid Game
["constructive algorithms", "games", "graph matchings", "greedy", "interactive"]
3500
https://codeforces.com/problemset/problem/1991/I
1722177300
en
codeforces
# Grid Game ## Problem Description This is an interactive problem. You are given a grid with $ n $ rows and $ m $ columns. You need to fill each cell with a unique integer from $ 1 $ to $ n \cdot m $ . After filling the grid, you will play a game on this grid against the interactor. Players take turns selecting one...
1991
H
Prime Split Game
["bitmasks", "dp", "fft", "games", "math", "number theory"]
3300
https://codeforces.com/problemset/problem/1991/H
1722177300
en
codeforces
# Prime Split Game ## Problem Description Alice and Bob are playing a game with $ n $ piles of stones, where the $ i $ -th pile has $ a_i $ stones. Players take turns making moves, with Alice going first. On each move, the player does the following three-step process: 1. Choose an integer $ k $ ( $ 1 \leq k \leq \f...
1991
G
Grid Reset
["constructive algorithms", "greedy", "implementation"]
2700
https://codeforces.com/problemset/problem/1991/G
1722177300
en
codeforces
# Grid Reset ## Problem Description You are given a grid consisting of $ n $ rows and $ m $ columns, where each cell is initially white. Additionally, you are given an integer $ k $ , where $ 1 \le k \le \min(n, m) $ . You will process $ q $ operations of two types: - $ \mathtt{H} $ (horizontal operation) — You cho...
1991
F
Triangle Formation
["brute force", "greedy", "implementation", "math", "sortings"]
2200
https://codeforces.com/problemset/problem/1991/F
1722177300
en
codeforces
# Triangle Formation ## Problem Description You are given $ n $ sticks, numbered from $ 1 $ to $ n $ . The length of the $ i $ -th stick is $ a_i $ . You need to answer $ q $ queries. In each query, you are given two integers $ l $ and $ r $ ( $ 1 \le l < r \le n $ , $ r - l + 1 \ge 6 $ ). Determine whether it is po...
1991
E
Coloring Game
["constructive algorithms", "dfs and similar", "games", "graphs", "greedy", "interactive"]
1900
https://codeforces.com/problemset/problem/1991/E
1722177300
en
codeforces
# Coloring Game ## Problem Description This is an interactive problem. Consider an undirected connected graph consisting of $ n $ vertices and $ m $ edges. Each vertex can be colored with one of three colors: $ 1 $ , $ 2 $ , or $ 3 $ . Initially, all vertices are uncolored. Alice and Bob are playing a game consisti...
1991
D
Prime XOR Coloring
["bitmasks", "constructive algorithms", "graphs", "greedy", "math", "number theory"]
1900
https://codeforces.com/problemset/problem/1991/D
1722177300
en
codeforces
# Prime XOR Coloring ## Problem Description You are given an undirected graph with $ n $ vertices, numbered from $ 1 $ to $ n $ . There is an edge between vertices $ u $ and $ v $ if and only if $ u \oplus v $ is a [prime number](https://en.wikipedia.org/wiki/Prime_number), where $ \oplus $ denotes the [bitwise XOR o...
1991
C
Absolute Zero
["constructive algorithms", "greedy", "math"]
1300
https://codeforces.com/problemset/problem/1991/C
1722177300
en
codeforces
# Absolute Zero ## Problem Description You are given an array $ a $ of $ n $ integers. In one operation, you will perform the following two-step move: 1. Choose an integer $ x $ ( $ 0 \le x \le 10^{9} $ ). 2. Replace each $ a_i $ with $ |a_i - x| $ , where $ |v| $ denotes the [absolute value](https://en.wikipedia.o...
1991
B
AND Reconstruction
["bitmasks", "constructive algorithms", "greedy"]
1100
https://codeforces.com/problemset/problem/1991/B
1722177300
en
codeforces
# AND Reconstruction ## Problem Description You are given an array $ b $ of $ n - 1 $ integers. An array $ a $ of $ n $ integers is called good if $ b_i = a_i \, \& \, a_{i + 1} $ for $ 1 \le i \le n-1 $ , where $ \& $ denotes the [bitwise AND operator](https://en.wikipedia.org/wiki/Bitwise_operation#AND). Construc...
1991
A
Maximize the Last Element
["greedy", "implementation"]
800
https://codeforces.com/problemset/problem/1991/A
1722177300
en
codeforces
# Maximize the Last Element ## Problem Description You are given an array $ a $ of $ n $ integers, where $ n $ is odd. In one operation, you will remove two adjacent elements from the array $ a $ , and then concatenate the remaining parts of the array. For example, given the array $ [4,7,4,2,9] $ , we can obtain the...
1990
F
Polygonal Segments
["brute force", "data structures", "divide and conquer", "dp", "greedy", "two pointers"]
2800
https://codeforces.com/problemset/problem/1990/F
1721486100
en
codeforces
# Polygonal Segments ## Problem Description You are given an array $ a $ of size $ n $ . A segment $ [l, r](1 \le l < r \le n) $ is called a polygonal segment only if the following conditions hold: - $ (r-l+1) \geq 3 $ ; - Considering $ a_l, a_{l+1}, \ldots, a_r $ as side lengths, these sides can form a polygon wit...
1990
E2
Catch the Mole(Hard Version)
["binary search", "data structures", "dfs and similar", "divide and conquer", "interactive", "trees"]
2600
https://codeforces.com/problemset/problem/1990/E2
1721486100
en
codeforces
# Catch the Mole(Hard Version) ## Problem Description This is the hard version of the problem. The only difference is the limit on the number of queries. This is an interactive problem. You are given a tree of $ n $ nodes with node $ 1 $ as its root node. There is a hidden mole in one of the nodes. To find its pos...
1990
E1
Catch the Mole(Easy Version)
["binary search", "data structures", "dfs and similar", "interactive", "trees"]
2500
https://codeforces.com/problemset/problem/1990/E1
1721486100
en
codeforces
# Catch the Mole(Easy Version) ## Problem Description This is the easy version of the problem. The only difference is the limit on the number of queries. This is an interactive problem. You are given a tree of $ n $ nodes with node $ 1 $ as its root node. There is a hidden mole in one of the nodes. To find its pos...
1990
D
Grid Puzzle
["bitmasks", "brute force", "dp", "greedy", "implementation"]
1800
https://codeforces.com/problemset/problem/1990/D
1721486100
en
codeforces
# Grid Puzzle ## Problem Description You are given an array $ a $ of size $ n $ . There is an $ n \times n $ grid. In the $ i $ -th row, the first $ a_i $ cells are black and the other cells are white. In other words, note $ (i,j) $ as the cell in the $ i $ -th row and $ j $ -th column, cells $ (i,1), (i,2), \ldots,...
1990
C
Mad MAD Sum
["brute force", "greedy", "math"]
1500
https://codeforces.com/problemset/problem/1990/C
1721486100
en
codeforces
# Mad MAD Sum ## Problem Description We define the $ \operatorname{MAD} $ (Maximum Appearing Duplicate) in an array as the largest number that appears at least twice in the array. Specifically, if there is no number that appears at least twice, the $ \operatorname{MAD} $ value is $ 0 $ . For example, $ \operatorname...
1990
B
Array Craft
["constructive algorithms", "greedy"]
1200
https://codeforces.com/problemset/problem/1990/B
1721486100
en
codeforces
# Array Craft ## Problem Description For an array $ b $ of size $ m $ , we define: - the maximum prefix position of $ b $ is the smallest index $ i $ that satisfies $ b_1+\ldots+b_i=\max_{j=1}^{m}(b_1+\ldots+b_j) $ ; - the maximum suffix position of $ b $ is the largest index $ i $ that satisfies $ b_i+\ldots+b_m=\m...
1990
A
Submission Bait
["brute force", "games", "greedy", "sortings"]
900
https://codeforces.com/problemset/problem/1990/A
1721486100
en
codeforces
# Submission Bait ## Problem Description Alice and Bob are playing a game in an array $ a $ of size $ n $ . They take turns to do operations, with Alice starting first. The player who can not operate will lose. At first, a variable $ mx $ is set to $ 0 $ . In one operation, a player can do: - Choose an index $ i $...
1988
F
Heartbeat
["combinatorics", "dp", "fft", "math"]
3000
https://codeforces.com/problemset/problem/1988/F
1721054100
en
codeforces
# Heartbeat ## Problem Description For an array $ u_1, u_2, \ldots, u_n $ , define - a prefix maximum as an index $ i $ such that $ u_i>u_j $ for all $ j<i $ ; - a suffix maximum as an index $ i $ such that $ u_i>u_j $ for all $ j>i $ ; - an ascent as an index $ i $ ( $ i>1 $ ) such that $ u_i>u_{i-1} $ . You are g...
1988
E
Range Minimum Sum
["binary search", "brute force", "data structures", "divide and conquer", "implementation"]
2300
https://codeforces.com/problemset/problem/1988/E
1721054100
en
codeforces
# Range Minimum Sum ## Problem Description For an array $ [a_1,a_2,\ldots,a_n] $ of length $ n $ , define $ f(a) $ as the sum of the minimum element over all subsegments. That is, $ $$$f(a)=\sum_{l=1}^n\sum_{r=l}^n \min_{l\le i\le r}a_i. $ $ </p><p>A permutation is a sequence of integers from $ 1 $ to $ n $ of le...
1988
D
The Omnipotent Monster Killer
["brute force", "dfs and similar", "dp", "trees"]
2000
https://codeforces.com/problemset/problem/1988/D
1721054100
en
codeforces
# The Omnipotent Monster Killer ## Problem Description You, the monster killer, want to kill a group of monsters. The monsters are on a tree with $ n $ vertices. On vertex with number $ i $ ( $ 1\le i\le n $ ), there is a monster with $ a_i $ attack points. You want to battle with monsters for $ 10^{100} $ rounds. I...
1988
C
Increasing Sequence with Fixed OR
["bitmasks", "constructive algorithms", "greedy"]
1300
https://codeforces.com/problemset/problem/1988/C
1721054100
en
codeforces
# Increasing Sequence with Fixed OR ## Problem Description You are given a positive integer $ n $ . Find the longest sequence of positive integers $ a=[a_1,a_2,\ldots,a_k] $ that satisfies the following conditions, and print the sequence: - $ a_i\le n $ for all $ 1\le i\le k $ . - $ a $ is strictly increasing. That ...
1988
B
Make Majority
["greedy", "implementation"]
900
https://codeforces.com/problemset/problem/1988/B
1721054100
en
codeforces
# Make Majority ## Problem Description You are given a sequence $ [a_1,\ldots,a_n] $ where each element $ a_i $ is either $ 0 $ or $ 1 $ . You can apply several (possibly zero) operations to the sequence. In each operation, you select two integers $ 1\le l\le r\le |a| $ (where $ |a| $ is the current length of $ a $ )...
1988
A
Split the Multiset
["brute force", "greedy", "implementation", "math"]
900
https://codeforces.com/problemset/problem/1988/A
1721054100
en
codeforces
# Split the Multiset ## Problem Description A multiset is a set of numbers in which there can be equal elements, and the order of the numbers does not matter. For example, $ \{2,2,4\} $ is a multiset. You have a multiset $ S $ . Initially, the multiset contains only one positive integer $ n $ . That is, $ S=\{n\} $ ...
1983
G
Your Loss
["bitmasks", "brute force", "dp", "trees"]
3000
https://codeforces.com/problemset/problem/1983/G
1720362900
en
codeforces
# Your Loss ## Problem Description You are given a tree with $ n $ nodes numbered from $ 1 $ to $ n $ , along with an array of size $ n $ . The value of $ i $ -th node is $ a_{i} $ . There are $ q $ queries. In each query, you are given 2 nodes numbered as $ x $ and $ y $ . Consider the path from the node numbered a...
1983
F
array-value
["binary search", "bitmasks", "data structures", "greedy", "two pointers"]
2500
https://codeforces.com/problemset/problem/1983/F
1720362900
en
codeforces
# array-value ## Problem Description You have an array of non-negative integers $ a_1, a_2, \ldots, a_n $ . The value of a sub-array of length $ \ge 2 $ , $ a[l, r] = [a_l, a_{l+1}, \ldots, a_r] $ is the minimum value of $ a_i \oplus a_j $ such that $ l \le i < j \le r $ , where $ \oplus $ is the xor (exclusive-or) ...
1983
E
I Love Balls
["combinatorics", "math", "probabilities"]
2300
https://codeforces.com/problemset/problem/1983/E
1720362900
en
codeforces
# I Love Balls ## Problem Description Alice and Bob are playing a game. There are $ n $ balls, out of which $ k $ are special. Each ball has a value associated with it. The players play turn by turn. In each turn, the player randomly picks a ball and adds the value of the ball to their score, which is $ 0 $ at the b...
1983
D
Swap Dilemma
["constructive algorithms", "data structures", "divide and conquer", "greedy", "math", "sortings"]
1700
https://codeforces.com/problemset/problem/1983/D
1720362900
en
codeforces
# Swap Dilemma ## Problem Description Given two arrays of distinct positive integers $ a $ and $ b $ of length $ n $ , we would like to make both the arrays the same. Two arrays $ x $ and $ y $ of length $ k $ are said to be the same when for all $ 1 \le i \le k $ , $ x_i = y_i $ . Now in one move, you can choose so...
1983
C
Have Your Cake and Eat It Too
["binary search", "brute force", "greedy", "implementation"]
1400
https://codeforces.com/problemset/problem/1983/C
1720362900
en
codeforces
# Have Your Cake and Eat It Too ## Problem Description Alice, Bob and Charlie want to share a rectangular cake cut into $ n $ pieces. Each person considers every piece to be worth a different value. The $ i $ -th piece is considered to be of value $ a_i $ by Alice, $ b_i $ by Bob and $ c_i $ by Charlie. The sum over...
1983
B
Corner Twist
["constructive algorithms", "greedy", "implementation", "math"]
1200
https://codeforces.com/problemset/problem/1983/B
1720362900
en
codeforces
# Corner Twist ## Problem Description You are given two grids of numbers $ a $ and $ b $ , with $ n $ rows and $ m $ columns. All the values in the grid are $ 0 $ , $ 1 $ or $ 2 $ . You can perform the following operation on $ a $ any number of times: - Pick any subrectangle in the grid with length and width $ \ge ...
1983
A
Array Divisibility
["constructive algorithms", "math"]
800
https://codeforces.com/problemset/problem/1983/A
1720362900
en
codeforces
# Array Divisibility ## Problem Description An array of integers $ a_1,a_2,\cdots,a_n $ is beautiful subject to an integer $ k $ if it satisfies the following: - The sum of $ a_{j} $ over all $ j $ such that $ j $ is a multiple of $ k $ and $ 1 \le j \le n $ , itself, is a multiple of $ k $ . - More formally, if $ ...
187568
A
「Cfz Round 5」Non-breath Oblige
["数学", "贪心", "位运算", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11485?contestId=187568
1735452000
zh
luogu
# 「Cfz Round 5」Non-breath Oblige ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U517656). **You must submit your code at the Chinese version of the statement.** --- それぞれの好きを守るため 为了保护各自的喜爱之物 君と防空壕で呼吸する 与你在防空壕中一同呼吸 ## 题目描述 给定三个整数 $n,s,t$,其中 $0 \le s,t \lt 2^n$。 你可以进行若干次操作。每次操作,你可以选择一个非负整数 $x$ 并把...
187568
B
「Cfz Round 5」Mata rainen
["连通块", "树论", "构造", "洛谷原创", "洛谷月赛", "Special Judge", "O2优化"]
普及+/提高
https://www.luogu.com.cn/problem/P11486?contestId=187568
1735452000
zh
luogu
# 「Cfz Round 5」Mata rainen ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U517657). **You must submit your code at the Chinese version of the statement.** --- **如您希望对本题难度评分、数据强度等事项提出宝贵意见,请移步 [关于本题难度评分、数据强度等事项的说明](https://www.luogu.com.cn/discuss/1030705),而不要新开帖子!**(2024.12.30 rui_er 添加,本条保留至 2025.1.31...
187568
C
「Cfz Round 5」Gnirts 10
["组合数学", "洛谷原创", "洛谷月赛", "O2优化"]
提高+/省选−
https://www.luogu.com.cn/problem/P11487?contestId=187568
1735452000
zh
luogu
# 「Cfz Round 5」Gnirts 10 ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U517658). **You must submit your code at the Chinese version of the statement.** --- In Memory of $\text{F}\rule{66.8px}{6.8px}$. ## 题目描述 题面还是简单一点好。 - 给定 $n, m$,以及一个长为 $n + m$ 的 $\tt{01}$ 串 $S$。 - 对于 $\tt 01$ 串 $T$,定义 $f(T)$ 为 ...
187568
D
「Cfz Round 5」Zhòng shù
["洛谷原创", "洛谷月赛"]
省选/NOI−
https://www.luogu.com.cn/problem/P11488?contestId=187568
1735452000
zh
luogu
# 「Cfz Round 5」Zhòng shù ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U517659). **You must submit your code at the Chinese version of the statement.** --- > 我想要种一棵香蕉树 上面挂满我的所有祝福 ## 题目描述 小 C 喜欢种树。 它种了一棵香蕉树,但是这棵树似乎需要人工维护才能生长。 因此,它经常会在树上的某一个位置挂上一些「祝福」。所谓「祝福」,其实就是一条链。 而有的时候树的一部分长得太好了,会导致整棵树长歪,所以它又不...
210959
A
「ALFR Round 3」A 调皮的学生
["洛谷原创", "洛谷月赛", "O2优化"]
入门
https://www.luogu.com.cn/problem/P11445?contestId=210959
1734762600
zh
luogu
# 「ALFR Round 3」A 调皮的学生 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/U517303). 在小山所在的学校中,有着一群非常调皮的学生。比如,在给老师的教学水平评分时,他们常常会给出不正经的评分。 ## 题目描述 又到了一学期一度的评分大赛,每位同学都可以为本班某门科目的老师评分(一共有语、数、英三门科目)。每位同学应当只为一位老师评分。但有些学生常常会为多位老师评分,或者不为任何老师评分,我们称这样的学生为调皮的学生。现在给出小山所在班级的三门科目的老师的评分情况,请你求出该班级的调皮的学生的数量。 ## 输入格式 第一...
210959
B
「ALFR Round 3」B Swap & Delete
["洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11446?contestId=210959
1734762600
zh
luogu
# 「ALFR Round 3」B Swap & Delete ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/U517304) ## 题目描述 给定一个长为 $n$ 的序列 $a_1, a_2,a_3, \dots ,a_n$,你需要执行 $k$ 次操作使这个序列为空。 每次操作可以执行下列内容之一: 1. 选择两个数 $i, j$,交换 $a_i, a_j$(需要满足 $1 \le i < j \le n$)。 2. 选择两个数 $i, j$,删除 $a_i,a_{i+1}, \dots ,a_j$(需要满足 $1 \le i \le j \l...
210959
C
「ALFR Round 3」C 割
["字符串", "贪心", "鸽笼原理", "洛谷原创", "洛谷月赛", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11447?contestId=210959
1734762600
zh
luogu
# 「ALFR Round 3」C 割 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/U517305). **upd:** 添加的 hack 在 Sub 7。 ## 题目描述 设 $f(S)$ 表示字符串 $S$ 字典序最大的子序列,给定 $k$,你需要将原字符串 $S$ 分割成 $k$ 段,设第 $i$ 段子串为 $a_i$,则该分割方案的权值为 $\max f(a_i)$,其中 $1\le i\le k$。由于分割方案有很多种,你需要求出所有分割方案中**字典序最小的权值**。 注:这里的权值实际上指的是字符串。 关于子序列的定义:某个序列...
210959
D
「ALFR Round 3」D 核裂变
["广度优先搜索 BFS", "洛谷原创", "洛谷月赛", "O2优化"]
普及+/提高
https://www.luogu.com.cn/problem/P11448?contestId=210959
1734762600
zh
luogu
# 「ALFR Round 3」D 核裂变 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/U517306). 可爱的松鼠跑去学 PhO 啦。 ## 题目描述 有 $n$ 个放射性原子要进行 $k$ 秒的裂变反应。如果在第 $t$ 秒开始时原子 $i$ 被 $b\ (b>0)$ 个中子轰击了,那它就会在第 $t$ 秒内释放 $a_i + b$ 单位能量,并向编号为 $x_{i,1},x_{i,2},\dots,x_{i,a_i}$ 的所有原子各释放 $1$ 个中子。这样,在第 $t+1$ 秒开始时分别击中的 $x_{i,1},x_{i,2},\dot...
218363
A
喵喵喵幼儿园
["洛谷原创", "洛谷月赛", "Special Judge"]
入门
https://www.luogu.com.cn/problem/P11395?contestId=218363
1734156000
zh
luogu
# 喵喵喵幼儿园 ## 题目描述 喵喵喵群里面,吃喵喵是坏文明。 现在群友有 $q$ 个问题,每个问题形如 `A or B?`,其中 $A,B$ 为仅含小写字母的非空字符串。 对于每个问题,你可以回答 $A$ 或 $B$ 中的任意一个不是 `eat` 的字符串。特别地,如果 $A$ 和 $B$ 都是 `eat`,你需要回答 `or`。 ## 输入格式 输入的第一行有一个正整数 $q$,表示问题的数量。 之后有 $q$ 行,每行有一个问题。 ## 输出格式 对于每个问题,输出一行一个字符串,表示你对于这个问题的答案。 ## 样例 #1 ### 样例输入 #1 ``` 4 yummy or yucky? eat ...
218363
B
排队
["洛谷原创", "洛谷月赛"]
普及/提高−
https://www.luogu.com.cn/problem/P11396?contestId=218363
1734156000
zh
luogu
# 排队 ## 题目描述 第一届喵喵喵编程大赛即将开始,本次比赛有 $n$ 只喵喵参赛,编号依次为 $1,2,\ldots, n$,已经分成了若干组,每一组喵喵的编号都是连续的一段。 根据报名情况,你已经知道第 $i$ 只喵喵会第 $p_i$ 个到达现场,保证 $p_i$ 构成 $1\sim n$ 的排列。 一组喵喵的到达时间被定义为这一组喵喵中**最早到达**的喵喵的到达时间。 喵喵的排队规则如下: - 先把所有的喵喵组按每组喵喵的到达时间从小到大排序。 - 然后对于同一组喵喵,按照每只喵喵的到达时间从小到大排序。 按照这个排队规则,可以得到一个新的排列 $q_1,\ldots,q_n$,其中 $q_i$ 表示从前往...
218363
C
界分数
["数论", "Ad-hoc", "洛谷原创", "洛谷月赛", "洛谷比赛", "2024"]
普及+/提高
https://www.luogu.com.cn/problem/P11397?contestId=218363
1734156000
zh
luogu
# 界分数 ## 题目背景 [标分数](https://www.luogu.com.cn/problem/P8319) ## 题目描述 定义函数 $f(x)$: 有一个 $\frac{0}{x}$ 的分数。你可以进行以下两种操作直到这个分数为 $1$: 1. 分子 $+1$,然后如果这个分数可以约分,约分到最简形式。 2. 分子分母同时 $+1$,然后如果这个分数可以约分,约分到最简形式。 $f(x)$ 的值为最小操作次数。 给定 $n$,求 $\sum\limits_{i=1}^n f(i) \bmod 998244353$。 ## 输入格式 一行一个正整数 $n$。 ## 输出格式 一行一个自然数,表示答...
218363
D
众数
["洛谷原创", "洛谷月赛"]
省选/NOI−
https://www.luogu.com.cn/problem/P11398?contestId=218363
1734156000
zh
luogu
# 众数 ## 题目描述 你有 $n$ 个数对 $(a_1,b_1),\ldots,(a_n,b_n)$。 定义**下标** $i(1\le i\le n)$ 的权值为将 $a_1$ 个 $b_1$,$a_2$ 个 $b_2$,...,$a_i$ 个 $b_i$ 拼接在一起后形成的数组的**最大众数**(特别地,若所有数出现次数相同则为最大数)乘以 $a_i$。 接下来你有 $m$ 个操作,分两种: - `1 x y`,将 $a_x$ 增加 $y$。**保证 $y$ 非负。** - `2 q`,求最小的正整数 $k$ 使得**下标** $n-k+1 \sim n$ 的权值异或和为 $q$。 2 操作保证有解,且所有答案之和...
183429
A
茫茫的不归路
["鸽笼原理", "分类讨论", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11308?contestId=183429
1732341600
zh
luogu
# 茫茫的不归路 ## 题目背景 [The English statement for T1](https://www.luogu.com.cn/problem/U508230) You can also see the pdf at the bottom of the chinese problem statement. NoitaCesaE 的匹配机制总是很奇怪,小 $ \zeta $ 总是被匹配到与他的其他车队成员不同的阵营,这时他就没法享受被优质队友带飞的快感了。 ## 题目描述 具体的,有 $ n $ 个阵营,每个阵营最多 $ m $ 人。已经有 $ p $ 个人被分配了所属的阵营,且此时每个阵营人数均不超限。...
183429
B
纷飞的樱花雨
["贪心", "分类讨论", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11309?contestId=183429
1732341600
zh
luogu
# 纷飞的樱花雨 ## 题目背景 [The English statement for T2](https://www.luogu.com.cn/problem/U508231) You can also see the pdf at the bottom of the chinese problem statement. 高中的时候做过樱花雨实验,氯化钴遇到氢氧化钠溶液产生的沉淀物就像是一场铺天盖地的樱花雨。 小 $ \zeta $ 问她,你见过樱花吗? 她抬头摇起眼睛,碎亮的光倒映在少女乌黑的瞳孔里。 她侧头定定看了我一会儿,然后淡淡地笑了。 她说,「我知道你想考武汉大学。」 「我也会去武汉大学。」 「今年九...
183429
C
无穷的迭代器
["洛谷原创", "洛谷月赛", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11310?contestId=183429
1732341600
zh
luogu
# 无穷的迭代器 ## 题目背景 [The English statement for T3](/problem/U508232) You can also see the pdf at the bottom of the chinese problem statement. ## 题目描述 对于实数 $ r $,记一次操作为: * 找到不小于 $ r $ 的最小整数即 $ \lceil r \rceil $,并将 $ r $ 的值乘上 $ \lceil r \rceil $。 现在给定非负整数 $ k $,对于 $ r=k+\frac{1}{2} $,至少需要对 $ r $ 进行几次操作才能使 $ r $ 为整数? ...
183429
D
漫长的小纸带
["动态规划 DP", "排序", "洛谷原创", "洛谷月赛"]
提高+/省选−
https://www.luogu.com.cn/problem/P11311?contestId=183429
1732341600
zh
luogu
# 漫长的小纸带 ## 题目背景 [The English statement for T4](https://www.luogu.com.cn/problem/U508235) You can also see the pdf at the bottom of the chinese problem statement. 小 $ \zeta $ 是一个喜欢打暴力的 OIer。在每次模拟赛中,他秉持着“10 分钟想不出来正解那就把暴力糊上去”的理念,每次都稳定地拿到很高的分数;平时训练时,他会关注题目的部分分,针对部分分任务进行求解,有时在部分分求解上使用的时间比这个题正解的思考都长。 ## 题目描述 小 $ \zeta...
183429
E
神奇的小江鸟
["数学", "数论", "枚举", "调和级数", "洛谷原创", "洛谷月赛", "Special Judge", "O2优化"]
普及+/提高
https://www.luogu.com.cn/problem/P11312?contestId=183429
1732341600
zh
luogu
# 神奇的小江鸟 ## 题目背景 [The English statement for T5](https://www.luogu.com.cn/problem/U508234) You can also see the pdf at the bottom of the chinese problem statement. 感谢 [ineverleft](https://www.luogu.com.cn/user/362679) 为本题提供的本地调试 checker。 「愿有前程可奔赴,亦有岁月可回首。」 ## 题目描述 小 $ \zeta $ 在探险过程中看到了一个大锁。 这个大锁有 $ n $ 个拨圈,第 $ i...
210735
A
「GFOI Round 2」Abstract String Basic
["洛谷原创", "洛谷月赛", "Special Judge", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11279?contestId=210735
1731736800
zh
luogu
# 「GFOI Round 2」Abstract String Basic ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T533480). You must submit your code at the Chinese version of the statement.** ## 题目描述 Charlie 正在上一门叫做《抽象字符串基础》的课。 > **定义 3.1:** 对于两个长度相同的小写字母串 $S$ 和 $T$,定义它们的**相似度**为它们相同的对应位置个数。形式化地,设 $|S|=|T|=n$,则 $S$ 和 $T$ 的相似度...
210735
B
「GFOI Round 2」Jom & Terry
["洛谷原创", "洛谷月赛", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11280?contestId=210735
1731736800
zh
luogu
# 「GFOI Round 2」Jom & Terry ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T533492). You must submit your code at the Chinese version of the statement.** 我在做 [#3406. 「2020-2021 集训队作业」Tom & Jerry](https://loj.ac/p/3406)…… 你说得对,但是: > Tom and Jerry is an American animated media franchise and series of ...
210735
C
「GFOI Round 2」Aob & Blice
["洛谷原创", "洛谷月赛", "O2优化"]
提高+/省选−
https://www.luogu.com.cn/problem/P11281?contestId=210735
1731736800
zh
luogu
# 「GFOI Round 2」Aob & Blice ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T533501). You must submit your code at the Chinese version of the statement.** ## 题目描述 Aob 和 Blice 在玩游戏。 现在有一个长为 $n$ 的排列 $p$,且 Aob 和 Blice 手里分别有一个初始为空的**不可重**集合 $S_A,S_B$。定义一轮游戏过程如下: - 首先 Aob 会**随机**选取两个满足 $1 \leq x < y \le...
210735
D
「GFOI Round 2」Colors
["分类讨论", "洛谷原创", "洛谷月赛", "O2优化"]
提高+/省选−
https://www.luogu.com.cn/problem/P11282?contestId=210735
1731736800
zh
luogu
# 「GFOI Round 2」Colors ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T533508). You must submit your code at the Chinese version of the statement.** > 世界が鮮やかに 染まって ## 题目描述 有 $n$ 个球排成一排,从左到右依次编号为 $1 \sim n$。每个球初始都是红色的。第 $i$ 个球的初始权值为 $p_i$。**保证 $\bm{n}$ 为奇数且 $\bm{p}$ 是一个 $\bm{1 \sim n}$ 的排列。** 你需要恰好...
210736
C
「GFOI Round 2」Turtle and Nediam
["单调栈", "洛谷原创", "洛谷月赛", "O2优化"]
省选/NOI−
https://www.luogu.com.cn/problem/P11283?contestId=210736
1731736800
zh
luogu
# 「GFOI Round 2」Turtle and Nediam ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T533511). You must submit your code at the Chinese version of the statement.** ## 题目描述 对一个元素互不相同的长度 $\ge 3$ 的正整数序列 $a$,定义 $a$ 的“肿胃数(nediam)”$f(a)$ 为: - 当 $|a| = 3$ 时,$f(a)$ 为 $a$ 的中位数; - 当 $|a| > 3$ 时,取 $a$ 的任意一个长度为 $3...
210736
D
「GFOI Round 2」Strings
["洛谷原创", "洛谷月赛", "O2优化"]
NOI/NOI+/CTSC
https://www.luogu.com.cn/problem/P11284?contestId=210736
1731736800
zh
luogu
# 「GFOI Round 2」Strings ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T533519). You must submit your code at the Chinese version of the statement.** ## 题目描述 给你两个正整数 $n, m$。 我们称一个长度为 $k$ 的正整数序列 $a_1, a_2, \ldots, a_k$ 是好的当且仅当: - $\forall i \in [1, k], 1 \le a_i \le m$; - 存在一个正整数 $l \in [1, \frac{k...
127930
A
「Diligent-OI R1 A」DlgtPattern
["洛谷原创", "洛谷月赛"]
入门
https://www.luogu.com.cn/problem/P11271?contestId=127930
1731220200
zh
luogu
# 「Diligent-OI R1 A」DlgtPattern ## 题目描述 现有一个水杯放在一个不透明的盒子中。水杯的底面可以看成一个圆形。盒子可以看成一个长方体,其厚度忽略不计。 现将盒子的底面放在一个平面直角坐标系中,它的四个顶点分别位于 $(0,0)$,$(x,0)$,$(0,y)$ 和 $(x,y)$。 你只知道水杯底面的圆心位于 $(p,q)$。那水杯底面的半径最大可以是多少呢? ## 输入格式 只输入一行,四个整数 $x,y,p,q$。 ## 输出格式 只输出一个数,水杯底面半径的最大值。 ## 样例 #1 ### 样例输入 #1 ``` 10 5 3 4 ``` ### 样例输出 #1 `...
127930
B
「Diligent-OI R1 B」DlgtArray
["洛谷原创", "洛谷月赛"]
普及−
https://www.luogu.com.cn/problem/P11272?contestId=127930
1731220200
zh
luogu
# 「Diligent-OI R1 B」DlgtArray ## 题目描述 现给定一个长为 $n$ 的序列 $a_1\sim a_n$,其中 $a_i\in\{0,1\}$。 $q$ 次询问,每次给定 $l,r,k$,要你更改一些位置上的数值(只能改为 $0$ 或 $1$)使得 $\sum\limits_{i=l}^ra_i=k+\prod\limits_{i=l}^ra_i$。也就是说要让 $a_l\sim a_r$ 的和要恰好等于 $a_l\sim a_r$ 的乘积再加上 $k$。你需要求出最少的修改次数。如果无解,输出 $-1$。 **请注意每次的更改不会对后续询问产生影响。** ## 输入格式 第一行输入 $n,...
127930
C
「Diligent-OI R1 C」DlgtRank
["洛谷原创", "洛谷月赛"]
普及/提高−
https://www.luogu.com.cn/problem/P11273?contestId=127930
1731220200
zh
luogu
# 「Diligent-OI R1 C」DlgtRank ## 题目描述 给你一个长为 $n$ 的序列 $a_1\sim a_n$。这里定义 $a_i$ 的**排名**为 $a$ 中**严格大于** $a_i$ 的数的个数 $+1$。 现有一些操作来更改 $a$ 中的元素。所有操作之前会事先给你一个常量 $k$。每次操作前,定义 $a_i$ 是**可移动**的,当且仅当**仅将 $a_i$ 的值加上 $k$,其他值不变**后,$a_i$ 的排名不变。否则 $a_i$ 在这次操作是不可移动的。然后这次操作为:将序列中所有可移动的数加上 $k$。 可以证明经过若干次操作后,$a$ 中所有值都会变成可移动的,并且第一次达到这种状态...
127930
D
「Diligent-OI R1 D」DlgtTemplate
["动态规划 DP", "背包 DP", "洛谷原创", "洛谷月赛", "Special Judge"]
普及+/提高
https://www.luogu.com.cn/problem/P11274?contestId=127930
1731220200
zh
luogu
# 「Diligent-OI R1 D」DlgtTemplate ## 题目背景 棋盘是用板子做成的。这题是棋盘的题,所以…… ## 题目描述 有一个 $1$ 行 $n$ 个格子的棋盘编号 $1\sim n$,上面每个格子写着一个得分 $a_i$。 现在你需要**从左到右**依次地选择一些格子,可以不选。有些格子选了之后,会将当前选的最靠前的 $b_i$ 个格子清除为未选格子,但你**不能**回去把这些格子重新选上。特殊地,如果该格子之前的已选格子不到 $b_i$ 个,那么该格子以及该格子以后的格子**不会**被清除为未选格子。 请你找出一种从左到右选择的方案,使得已选格子的得分之和最大。 ## 输入格式 第一行输入...
187558
A
碧树
["数学", "树论", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11242?contestId=187558
1730527200
zh
luogu
# 碧树 ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U505210). **You must submit your code at the Chinese version of the statement.** 小 T 不知道交流是什么。 是为了弄懂一串奇怪的符号,然后再把它放入他人的大脑吗? 是为了得到一些抽象的知识,然后再用它打破自己的习惯吗? 为了交流,小 T 最终决定接通了 $\text{220V}$ 的电压。 ## 题目描述 > t1k1x1ww。 小 T 注视着这一串自己不能理解的符号,决定先和你交流一个 OI 题目。 ...
187558
B
繁花
["递推", "双指针 two-pointer", "洛谷原创", "洛谷月赛", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11243?contestId=187558
1730527200
zh
luogu
# 繁花 ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U505208). **You must submit your code at the Chinese version of the statement.** 我已经知道,在设置好循环播放时就已经知道,我是在麻痹自己,在逃避问题。 我承认如此,可捞起那些沉于水底的细节时,却一瞬间突然和所有所有真实的心跳共鸣。 那时总想的太少,现在常想得太多,不知所措似荒塘里的绿藻蔓延着。 然而这世间情感太多,小 R 也只能体会更开心和更难过。 ## 题目描述 小 R 想对上面的问题进行探究,她想先做一...
187558
C
吻秋
["模拟", "暴力数据结构", "枚举", "排序", "洛谷原创", "洛谷月赛", "O2优化"]
普及+/提高
https://www.luogu.com.cn/problem/P11244?contestId=187558
1730527200
zh
luogu
# 吻秋 ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U500140). **You must submit your code at the Chinese version of the statement.** 秋雨刚刚亲吻过大地,白云便卷起赤橙黄绿青蓝紫。 波长在可见光范围内自由落体,让蒸腾的水汽都带上了递进的旋律。 渐变色模糊的印象总被晴天匆匆带过,但往往反常的极差让我们更加记忆犹新。 所以有序,真的最优吗? ## 题目描述 小 C 有 $m$ 个整数序列 $a_1\dots a_m$,每个序列的长度都为 $n$。 小 C 想要把...
187558
D
残雪
["贪心", "构造", "洛谷原创", "洛谷月赛", "Special Judge", "O2优化"]
省选/NOI−
https://www.luogu.com.cn/problem/P11245?contestId=187558
1730527200
zh
luogu
# 残雪 ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U500139). **You must submit your code at the Chinese version of the statement.** 如果我再和你走在同一条路上的话,我也会把远方的星星讲过无限的话再跟你说一遍吧。 你微笑着把竖起的手指放在嘴角,似乎是在暗示我,原来你就是远方的 Polestar 罢了。 令人伤感的事情是,这个世界上没有了小王子,也没有了去年今日的那位飞行员。 试问闲愁都几许?一川烟草,满城风絮,梅子黄时雨。 ![](https://pic.img...
200849
A
「KDOI-10」商店砍价
["动态规划 DP", "洛谷原创", "洛谷月赛", "O2优化", "2024"]
普及+/提高
https://www.luogu.com.cn/problem/P11188?contestId=200849
1728801000
zh
luogu
# 「KDOI-10」商店砍价 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/T514759). You must submit your code at the Chinese version of the statement. 您可以点击 [这里](https://www.luogu.com.cn/fe/api/problem/downloadAttachment/3jbtilzv) 下载本场比赛的选手文件。 You can click [here](https://www.luogu.com.cn/fe/api/problem/download...
200849
B
「KDOI-10」水杯降温
["动态规划 DP", "贪心", "二分", "洛谷原创", "洛谷月赛", "O2优化", "2024"]
省选/NOI−
https://www.luogu.com.cn/problem/P11189?contestId=200849
1728801000
zh
luogu
# 「KDOI-10」水杯降温 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/T514967). You must submit your code at the Chinese version of the statement. **本场比赛所有题目从标准输入读入数据,输出到标准输出。** ## 题目描述 小 S 有一棵包含 $n$ 个节点的有根树,且根为节点 $1$。节点 $i$ $(1\le i\le n)$ 上放置了一个初始水温为 $a_i$ 的水杯。 在不知道水温的情况下拿起水杯喝水并被烫了 inf 次的小 S 决定将这些水杯的水温全部...
200849
C
「KDOI-10」反回文串
["洛谷原创", "洛谷月赛", "Special Judge", "O2优化", "2024"]
提高+/省选−
https://www.luogu.com.cn/problem/P11190?contestId=200849
1728801000
zh
luogu
# 「KDOI-10」反回文串 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/T519008). You must submit your code at the Chinese version of the statement. **本场比赛所有题目从标准输入读入数据,输出到标准输出。** ## 题目描述 我们称一个长度为 $m$ 的字符串 $r$ 是回文的,当且仅当 $r_i=r_{m+1-i}$ 对所有 $1\le i\le m$ 均成立。 给定一个长度为 $n$ 的字符串 $s$,你需要把 $s$ 分成若干个非空子序列,使得每一个子序列都...
200849
D
「KDOI-10」超级演出
["线段树", "扫描线", "根号分治", "洛谷原创", "洛谷月赛", "O2优化", "2024"]
省选/NOI−
https://www.luogu.com.cn/problem/P11191?contestId=200849
1728801000
zh
luogu
# 「KDOI-10」超级演出 ## 题目背景 [English Statement](https://www.luogu.com.cn/problem/T519360). You must submit your code at the Chinese version of the statement. **本场比赛所有题目从标准输入读入数据,输出到标准输出。** ## 题目描述 巡准备了一场超级演出。舞台和候场室可以看作一个包含 $n$ 个点 $m$ 条边的有向图,并且这个图当中没有环,也就是说,这是一张有向无环图(DAG)。 舞台为 $1$ 号节点,**保证所有节点均有到达节点 $\bm 1$ 的路径**。其余的节...
200686
A
带余除法
["洛谷原创", "洛谷月赛"]
普及−
https://www.luogu.com.cn/problem/P11184?contestId=200686
1728779400
zh
luogu
# 带余除法 ## 题目背景 **注意:提交至洛谷时,请使用标准输入输出,而非文件输入输出。** **NOTICE: When submitting your code on Luogu site, please use standard IO instead of file IO.** [点我(或在本题底部)下载中文试题 PDF。](https://www.luogu.com.cn/fe/api/problem/downloadAttachment/asjh3my3?contestId=200686) [Click here (or at the bottom of this page) to download the...
200686
B
奖牌排序
["洛谷原创", "洛谷月赛"]
普及−
https://www.luogu.com.cn/problem/P11185?contestId=200686
1728779400
zh
luogu
# 奖牌排序 ## 题目描述 有 $n$ 个小朋友参加了若干场比赛,其中第 $i$ 个小朋友获得了 $g_i$ 枚金牌、$s_i$ 枚银牌和 $b_i$ 枚铜牌。老师希望**每个小朋友**制作一张**所有小朋友**的排行榜。 然而小朋友们为了让自己的排名尽量靠前,自然是可以动一些小心思的,体现在排序标准上——每个小朋友可以选择按照金牌数从大到小排序,也可以选择按照银牌数从大到小排序,也可以选择按照铜牌数从大到小排序。在小朋友自制的排行榜里,如果自己和别的小朋友并列,那么他可以把自己写在最前面。 给出每个小朋友获得的金牌数、银牌数和铜牌数,请对于每个小朋友 $i$,计算他在他自己的排行榜里最好能排第几名。 ## 输入格式 ...
200686
C
三目运算
["洛谷原创", "洛谷月赛"]
普及+/提高
https://www.luogu.com.cn/problem/P11186?contestId=200686
1728779400
zh
luogu
# 三目运算 ## 题目描述 三目运算是一种比较特殊的运算,功能类似于 `if` 语句,其语法格式如下: `条件?数值1:数值2`,三目运算得到的结果也是数值。当条件成立时得到的结果是数值 1,不成立时得到的结果为数值 2。 例如,`x>5?8:6` 就是一种三目运算表达式(也是分段常数表达式,见下文)。当 $x=7$ 时,该表达式的结果为 $8$,而 $x=3$ 时,该表达式的结果为 $6$。 --- 本题中,称满足下列条件中**至少一条**的字符串 $S$ 是**分段常数表达式**: - 十进制正整数 $a$,如 `243`,是分段常数表达式。 - 如果 $a$ 为一个十进制正整数,$p,q$ 为两个分段常数表达式...
200686
D
配对序列
["洛谷原创", "洛谷月赛"]
普及+/提高
https://www.luogu.com.cn/problem/P11187?contestId=200686
1728779400
zh
luogu
# 配对序列 ## 题目描述 一个序列 $s_1,\ldots s_{2k}$ 是**配对的**,当且仅当: - 对于任意 $1\le i \le k$,$s_{2i}=s_{2i-1}$。 - 对于任意 $1\le i<k$,$s_{2i}\ne s_{2i+1}$。 注意,配对的序列长度必然为偶数。 例如,$3,3,5,5,2,2$ 是配对的,而 $2,2,2,2,5,5$($s_2=s_3$ 不满足第二条要求)或者 $1,2,3,3,1,1$($s_1\ne s_2$ 不满足第一条要求)都不是配对的。 给出一个数列 $a_1,\ldots, a_n$,求所有配对的子序列长度的最大值。 ## 输入格式 输入的第一...
179008
A
「SFMOI Round I」Strange Cake Game
["贪心", "博弈论", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11143?contestId=179008
1727848800
zh
luogu
# 「SFMOI Round I」Strange Cake Game ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T510646). **You must submit your code at the Chinese version of the statement.** 小 $\mathcal{W}$ 和 小 $\mathcal{M}$ 在 CF 庄园里分蛋糕。 ## 题目描述 有一块面积为 $n\times m$ 的矩形蛋糕。记其左上角顶点为 $(0,0)$,右下角顶点为 $(n,m)$,右上角顶点为 $(0,m)$。 蛋糕上分布着 $k...
179008
B
「SFMOI Round I」Strange Madoka Game
["数论", "不定方程", "洛谷原创", "洛谷月赛", "交互题", "Special Judge", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11144?contestId=179008
1727848800
zh
luogu
# 「SFMOI Round I」Strange Madoka Game ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T510969). **You must submit your code at the Chinese version of the statement.** > いつも君の側にいるから / 无论何时我都与你同在 \ > 儚すぎて / 世界如此虚幻 \ > 消えて行きそうな世界 / 似乎随时随地都会消失 \ > だけど君がいる / 然而只要有你 \ > それだけで守りたいと思った / 我就心甘情愿将它守护 ## 题目描述 **本...
179008
C
「SFMOI Round I」Strange Homura Game
["Ad-hoc", "洛谷原创", "洛谷月赛", "交互题", "Special Judge", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11145?contestId=179008
1727848800
zh
luogu
# 「SFMOI Round I」Strange Homura Game ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T514577). **You must submit your code at the Chinese version of the statement.** > 伝えたいコトバは たったひとつ / 想要传达的言语 唯有一个 \ > キミがいたから 強くなれた / 因有你在 我变坚强了 \ > 2 人ならどんな空も飛べるね / 只要两人一起就能任意飞翔 \ > キミをいつでも 信じてるから / 因为一直都 坚信着你 \ > ずっとず...
179008
D
「SFMOI Round I」Strange Train Game
["贪心", "并查集", "图论建模", "线性基", "随机化", "洛谷原创", "洛谷月赛", "O2优化"]
提高+/省选−
https://www.luogu.com.cn/problem/P11146?contestId=179008
1727848800
zh
luogu
# 「SFMOI Round I」Strange Train Game ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T512993). **You must submit your code at the Chinese version of the statement.** SFM 团队又断网了,于是玩起了 Mini Metro,结果发现游戏更新了,列车要自己组装,于是有了这题。 ## 题目描述 **提示**:我们在题目描述的最后提供了一份简要的、形式化描述的题面。 SFM 号列车由 $n$ 节车厢组成,编号为 $1\sim n$。每节车厢有...
179008
E
「SFMOI Round I」Strange Dino Game
["模拟", "动态规划 DP", "贪心", "二分", "洛谷原创", "洛谷月赛", "O2优化"]
省选/NOI−
https://www.luogu.com.cn/problem/P11147?contestId=179008
1727848800
zh
luogu
# 「SFMOI Round I」Strange Dino Game ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T517979). **You must submit your code at the Chinese version of the statement.** ![](https://cdn.luogu.com.cn/upload/image_hosting/59joca92.png?x-oss-process=image/resize,m_lfit,h_600) ![](https://cdn.luogu.com.cn/uploa...
163361
A
「FSLOI Round I」单挑
["数学", "洛谷原创", "洛谷月赛", "O2优化"]
入门
https://www.luogu.com.cn/problem/P11076?contestId=163361
1726984800
zh
luogu
# 「FSLOI Round I」单挑 ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/T491159). You must submit your code at the Chinese version of the statement.** 小 F 和小 S 经常进行篮球单挑,但小 S 总是被盖帽。 ## 题目描述 每次单挑的结果一定是小 F 获胜或者小 S 获胜,不存在平局的情况。 由于小 F 和小 S 实力不均衡,于是他们制定规则如下: 给定两个整数 $x,y$,若小 F 先赢 $x$ 场,则小 F 获胜。若小 S 先赢 $y$ 场,...
163361
B
「FSLOI Round I」石子
["博弈论", "Ad-hoc", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11077?contestId=163361
1726984800
zh
luogu
# 「FSLOI Round I」石子 ## 题目背景 **[English statement.](https://www.luogu.com.cn/problem/T500971) You must submit your code at the Chinese version of the statement.** 小 F 和小 L 正在玩一种古老的博弈游戏的改版。 ## 题目描述 给定 $n$ 堆石子,第 $i$ 堆有 $a_i$ 个石子。设序列 $a_1,a_2,\cdots,a_n$ 的平均数为 $x$。此外,还会给定一个不大于 $x$ 的数字 $k$。小 F 和小 L 将轮流进行以下操作直至一方胜出,小 F ...
163361
C
「FSLOI Round I」迷雾
["线段树", "差分", "洛谷原创", "洛谷月赛", "O2优化"]
普及/提高−
https://www.luogu.com.cn/problem/P11078?contestId=163361
1726984800
zh
luogu
# 「FSLOI Round I」迷雾 ## 题目背景 **[English statement.](https://www.luogu.com.cn/problem/T500989) You must submit your code at the Chinese version of the statement.** 小 F 来到了迷雾之森。 ## 题目描述 整个迷雾之森可以由一个 $n \times m$ 的矩阵表示,`X` 代表有迷雾的地块,`.` 代表空地。从上到下给每行标号为 $1,2,\cdots,n$,从左到右给每列标号为 $1,2,\cdots,m$。除此之外,还会给定一个迷雾系数 $k$。 小 F 进...
163361
D
「FSLOI Round I」山峦
["动态规划 DP", "洛谷原创", "洛谷月赛", "O2优化"]
提高+/省选−
https://www.luogu.com.cn/problem/P11079?contestId=163361
1726984800
zh
luogu
# 「FSLOI Round I」山峦 ## 题目背景 **[English statement.](https://www.luogu.com.cn/problem/T501030) You must submit your code at the Chinese version of the statement.** 山峦是造物主弃的酒杯。 ## 题目描述 如果一个长度至少为三的序列 $a$ 满足以下条件,则称其为一个**山峰**: - 设其长度为 $m$。存在一个 $x$,满足 $2\leq x \leq m-1$,并且使得 $a_1,a_2,\cdots,a_x$ 严格单调递增,$a_x,a_{x+1},\cdo...
157920
A
「LAOI-6」[太阳]] 请使用最新版手机 QQ 体验新功能
["模拟", "字符串", "洛谷原创", "洛谷月赛", "O2优化"]
入门
https://www.luogu.com.cn/problem/P11019?contestId=157920
1725688800
zh
luogu
# 「LAOI-6」[太阳]] 请使用最新版手机 QQ 体验新功能 ## 题目背景 **[English statement](https://www.luogu.com.cn/problem/U481351). You must submit your code at the Chinese version of the statement.** 「」 --- ![](https://cdn.luogu.com.cn/upload/image_hosting/05xcfhr8.png) ## 题目描述 你的 QQ 收到了一条新消息!但是你很生气,因为你看不到别人发送的超级表情。 消息形如一个字符串 $S$,包含且仅...
157920
B
「LAOI-6」Radiation
["贪心", "构造", "洛谷原创", "洛谷月赛", "Special Judge", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P11020?contestId=157920
1725688800
zh
luogu
# 「LAOI-6」Radiation ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T503655). You must submit your code at the Chinese version of the statement. ## 题目描述 小 T 和 小 U 在一个 $n \times m$ 的初始为空的棋盘上玩游戏。小 T 先在上面摆 $k$ 个石头,然后小 U 会使用宇宙射线毁掉所有石头。但是小 U 的宇宙射线威力有限,只能每次销毁一行或一列的石头。 小 U 不想过多用他的宇宙射线发射器,所以他会按照最优策略销毁石头。反之,小 ...
157920
C
「LAOI-6」区间测速
["数学", "贪心", "二分", "洛谷原创", "洛谷月赛", "O2优化"]
普及+/提高
https://www.luogu.com.cn/problem/P11021?contestId=157920
1725688800
zh
luogu
# 「LAOI-6」区间测速 ## 题目背景 [English statement](https://www.luogu.com.cn/problem/T503704). You must submit your code at the Chinese version of the statement. ## 题目描述 小 A 正在一条笔直的公路上行驶(可以随时掉头,掉头的时间和路程忽略不计),这条公路可以被抽象为一条数轴。 你现在得到了 $n$ 个监控的信息,第 $i$ 条信息记录到:小 A 在 $t_i$ 时刻经过了坐标为 $x_i$ 之处。 有 $m$ 次询问,第 $i$ 次询问给定 $u_i$ 和 $v_i$,表...
157920
D
「LAOI-6」Yet Another Graph Coloration Problem
["图论", "深度优先搜索 DFS", "拓扑排序", "Tarjan", "双连通分量", "构造", "圆方树", "洛谷原创", "洛谷月赛", "Special Judge", "O2优化"]
普及+/提高
https://www.luogu.com.cn/problem/P11022?contestId=157920
1725688800
zh
luogu
# 「LAOI-6」Yet Another Graph Coloration Problem ## 题目背景 [English statement](https://www.luogu.com.cn/problem/U477166). You must submit your code at the Chinese version of the statement. ## 题目描述 小 R 有一张 $n$ 个节点和 $m$ 条的边简单无向图,节点的编号依次为 $1 \sim n$。她想要为图中的每个节点分配黑色或白色的颜色,使得: - 有至少 $1$ 个黑色节点; - 有至少 $1$ 个白色节点; - 对于任何一对点对 $...
157929
A
『FLA - I』冲云霄
["数学", "位运算", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P10835?contestId=157929
1722666600
zh
luogu
# 『FLA - I』冲云霄 ## 题目背景 **[English statement.](/problem/U458236) You must submit your code at the Chinese version of the statement.** 住在呼和浩特的小 R 很久以前就学会了异或。异或使用符号 $\oplus$ 表示,在 C++ 中可用符号 `^` 表示。非负整数 $x$ 和 $y$ 的异或是指对它们二进制表示中的每一位进行如下运算得到的结果: - 若 $x$ 和 $y$ 的第 $k$ 个二进制位相同,结果的第 $k$ 个二进制位为 $0$; - 若 $x$ 和 $y$ 的第 $k$ 个二进制位不...
157929
B
『FLA - I』歌静河
["模拟", "字符串", "贪心", "洛谷原创", "洛谷月赛", "O2优化"]
普及−
https://www.luogu.com.cn/problem/P10836?contestId=157929
1722666600
zh
luogu
# 『FLA - I』歌静河 ## 题目背景 **[English statement.](/problem/U458237) You must submit your code at the Chinese version of the statement.** > You can cry > > Drinking your eyes > > Do you miss the sadness when it's gone > > And you let the river run wild > > And you let the river run wild — _The River_ by _AURORA_ ## 题目描...