Category Archives: Algorithm
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…
Google CodeJam 2022 – Qualification – 1. Punched Cards
Problem A secret team of programmers is plotting to disrupt the programming language landscape and bring punched cards back by introducing a new language called Punched Card Python that lets people code in Python using punched cards! Like good disrupters, they are going to launch a viral campaign to promote their new language before even having the…
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…
Google KickStart – Round A – Problem 1
Barbara is a speed typer. In order to check her typing speed, she performs a speed test. She is given a string I that she is supposed to type. While Barbara is typing, she may make some mistakes, such as pressing the wrong key. As her typing speed is important to her, she does not 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 B
Original problem statement taken from this link. Madoka and the Elegant Gift time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Madoka’s father just reached 11 million subscribers on Mathub! So the website decided to send him a personalized award — The Mathhub’s Bit Button! The Bit Button is…
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…