Tag Archives: greedy

Codeforces Round #793 – Problem C
C. LIS or Reverse LIS? time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output You are given an array a of n positive integers. Let LIS(a) denote the length of longest strictly increasing subsequence of a. For example, LIS([2,1,1,3]) = 2. LIS([3,5,10,20]) = 4. LIS([3,1,2,4]) =…

Google CodeJam 2022 – Qualification – 3. d1000000
Problem While the most typical type of dice have 6 sides, each of which shows a different integer 1 through 6, there are many games that use other types. In particular, a dk is a die with k sides, each of which shows a different integer 1 through k. A d6 is a typical die, a d4 has four sides, and a d1000000 has one million sides. In this problem, we start with…

Google CodeJam 2022 – Qualification – 2. 3D printing
Problem You are part of the executive committee of the Database Design Day festivities. You are in charge of promotions and want to print three D’s to create a logo of the contest. You can choose any color you want to print them, but all three have to be printed in the same color. You…

Codeforces Round #778 – Problem B
B. Prefix Removals time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output You are given a string s consisting of lowercase letters of the English alphabet. You must perform the following algorithm on s: Let x be the length of the longest prefix of s which occurs somewhere else in s as a contiguous substring…

Codeforces Round #778 – Problem A
A. Maximum Cake Tastiness time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output There are n pieces of cake on a line. The i-th piece of cake has weight ai (1≤i≤n). The tastiness of the cake is the maximum total weight of two adjacent pieces of cake (i. e., max(a1+a2,a2+a3,…,an−1+an)). You want to…

Codeforces Round #777 Div 2 – Problem C
Original problem statement taken from this link. Madoka and the Childish Pranks time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Madoka as a child was an extremely capricious girl, and one of her favorite pranks was drawing on her wall. According to Madoka’s memories, the…

Codeforces Round #777 Div 2 – Problem A
Original problem statement taken from this link. Madoka and Math Dad time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Madoka finally found the administrator password for her computer. Her father is a well-known popularizer of mathematics, so the password is the answer to the following…