question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
You are given a string s of length n, which consists only of the first k letters of the Latin alphabet. All letters in string s are uppercase.
A subsequence of string s is a string that can be derived from s by deleting some of its symbols without chan... |
Solve the programming task below in a Python markdown code block.
Sergey Semyonovich is a mayor of a county city N and he used to spend his days and nights in thoughts of further improvements of Nkers' lives. Unfortunately for him, anything and everything has been done already, and there are no more possible improveme... |
Solve the programming task below in a Python markdown code block.
A multi-subject competition is coming! The competition has m different subjects participants can choose from. That's why Alex (the coach) should form a competition delegation among his students.
He has n candidates. For the i-th person he knows subjec... |
Solve the programming task below in a Python markdown code block.
Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.
Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wa... |
Solve the programming task below in a Python markdown code block.
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:
* a12 + a22 + ... + an2 β₯ x
* a1 + a2 + ... + an β€ y
Input
The first line contains three space-separated inte... |
Solve the programming task below in a Python markdown code block.
Long ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the sbegin and ending with the send... |
Solve the programming task below in a Python markdown code block.
Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it:
* deletes all the vo... |
Solve the programming task below in a Python markdown code block.
Your program fails again. This time it gets "Wrong answer on test 233"
.
This is the harder version of the problem. In this version, 1 β€ n β€ 2β
10^5. You can hack this problem if you locked it. But you can hack the previous problem only if you locked b... |
Solve the programming task below in a Python markdown code block.
[INSPION FullBand Master - INSPION](https://www.youtube.com/watch?v=kwsciXm_7sA)
[INSPION - IOLITE-SUNSTONE](https://www.youtube.com/watch?v=kwsciXm_7sA)
On another floor of the A.R.C. Markland-N, the young man Simon "Xenon" Jackson, takes a break aft... |
Solve the programming task below in a Python markdown code block.
Your task is to calculate the number of arrays such that:
* each array contains n elements;
* each element is an integer from 1 to m;
* for each array, there is exactly one pair of equal elements;
* for each array a, there exists an index i ... |
Solve the programming task below in a Python markdown code block.
There are two sisters Alice and Betty. You have n candies. You want to distribute these n candies between two sisters in such a way that:
* Alice will get a (a > 0) candies;
* Betty will get b (b > 0) candies;
* each sister will get some intege... |
Solve the programming task below in a Python markdown code block.
Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A β€ B β€ C β€ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A β€ x β€ B β€ y β€ C β€ z β€ D h... |
Solve the programming task below in a Python markdown code block.
Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells.
There are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals y damage to the monster and double... |
Solve the programming task below in a Python markdown code block.
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled 1,2,3,β¦. There is a directed edge from vertex u to vertex u+v if and only if u\&v=v, where \& denot... |
Solve the programming task below in a Python markdown code block.
Given an array a of length n, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.
A sequence b is a subsequence of an array a if b can be obtained from a by deleting some (possibly zero) element... |
Solve the programming task below in a Python markdown code block.
Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be... |
Solve the programming task below in a Python markdown code block.
A long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.
The total income A of his kingdom during 0-th year is known, as well as the total income B during n-t... |
Solve the programming task below in a Python markdown code block.
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square t. As the king is not in habit of wasting his time, he w... |
Solve the programming task below in a Python markdown code block.
It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are n tasks for the day and each animal should do each of these tasks. For each task, they have eval... |
Solve the programming task below in a Python markdown code block.
Cheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. Cheaterius makes them himself. Th... |
Solve the programming task below in a Python markdown code block.
Colonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor, which shows how much it's owner reached. Coolness factor can be increased by one for the cost of one coin.
For every pair of soldiers one of... |
Solve the programming task below in a Python markdown code block.
For months Maxim has been coming to work on his favorite bicycle. And quite recently he decided that he is ready to take part in a cyclists' competitions.
He knows that this year n competitions will take place. During the i-th competition the participa... |
Solve the programming task below in a Python markdown code block.
Ayrat is looking for the perfect code. He decided to start his search from an infinite field tiled by hexagons. For convenience the coordinate system is introduced, take a look at the picture to see how the coordinates of hexagon are defined:
<image> ... |
Solve the programming task below in a Python markdown code block.
Paul is at the orchestra. The string section is arranged in an r Γ c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including at least k of them. Paul can tak... |
Solve the programming task below in a Python markdown code block.
You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal.
Input
The first line contains integer n (1 β€ n β€ 3Β·105) β the number of points on the line.
The second line contains ... |
Solve the programming task below in a Python markdown code block.
The programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prepare only problems and editorial. As the ... |
Solve the programming task below in a Python markdown code block.
PolandBall has such a convex polygon with n veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve it and draw some red segments.
He chose a number k such that gcd(n, k) = 1. Vertices of the polygon are numb... |
Solve the programming task below in a Python markdown code block.
The Holmes children are fighting over who amongst them is the cleverest.
Mycroft asked Sherlock and Eurus to find value of f(n), where f(1) = 1 and for n β₯ 2, f(n) is the number of distinct ordered positive integer pairs (x, y) that satisfy x + y = n a... |
Solve the programming task below in a Python markdown code block.
Tonio has a keyboard with only two letters, "V" and "K".
One day, he has typed out a string s with only these two letters. He really likes it when the string "VK" appears, so he wishes to change at most one letter in the string (or do no changes) to ma... |
Solve the programming task below in a Python markdown code block.
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.
Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, a... |
Solve the programming task below in a Python markdown code block.
Recall that the bracket sequence is considered regular if it is possible to insert symbols '+' and '1' into it so that the result is a correct arithmetic expression. For example, a sequence "(()())" is regular, because we can get correct arithmetic expr... |
Solve the programming task below in a Python markdown code block.
Ralph has a magic field which is divided into n Γ m blocks. That is to say, there are n rows and m columns on the field. Ralph can put an integer in each block. However, the magic field doesn't always work properly. It works only if the product of integ... |
Solve the programming task below in a Python markdown code block.
Let's define a split of n as a nonincreasing sequence of positive integers, the sum of which is n.
For example, the following sequences are splits of 8: [4, 4], [3, 3, 2], [2, 2, 1, 1, 1, 1], [5, 2, 1].
The following sequences aren't splits of 8: [1,... |
Solve the programming task below in a Python markdown code block.
Translator's note: in Russia's most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system.
The term is coming to an end and students start thi... |
Solve the programming task below in a Python markdown code block.
Chandu is weak in maths. His teacher gave him homework to find maximum possible pair XOR in a matrix of size N x M with some conditions. Condition imposed is that, the pair can be formed between sum of elements in a column and sum of elements in a row. ... |
Solve the programming task below in a Python markdown code block.
Little Deepu and Little Kuldeep are the two best warriors in the realm of Westeros. But, their priorities and their loyalties are very much divided. Little Kuldeep fights for the right, just while Little Deepu fights for the wrong reasons, and supports ... |
Solve the programming task below in a Python markdown code block.
Little Jhool is friend with the magical creature from Koi Mil Gaya as we all know, called Jaadu.
Now, Jhool is learning Mathematics from Jaadu; he wants to know about the Mathematics of the other planet, too.
In Jaadu's planet, the sequence of pow... |
Solve the programming task below in a Python markdown code block.
There is a sale in the market on clothes , so as usual N girls gathered there to grab great deals.But due to huge popularity of sale crowd has gone uncontrollable. You being head of management team of the mall has been assigned the task to make them for... |
Solve the programming task below in a Python markdown code block.
Dark with his love for the prime numbers wanted to do some arithmetic so he decided to do some additions.
He wants to generate all prime numbers between two given numbers and add them up and decide whether that addition of numbers is a prime number or ... |
Solve the programming task below in a Python markdown code block.
Given a string S which contains only lowercase characters ['a'-'z'] and an integer K you have to find number of substrings having weight equal to K.
Weight of characters is defined as :
Weight['a']=1
Weight['b']=2
Weight['c']=3
Weight['d']=4
Weig... |
Solve the programming task below in a Python markdown code block.
We have a tree with N vertices and N-1 edges, respectively numbered 1, 2,\cdots, N and 1, 2, \cdots, N-1. Edge i connects Vertex u_i and v_i.
For integers L, R (1 \leq L \leq R \leq N), let us define a function f(L, R) as follows:
* Let S be the set o... |
Solve the programming task below in a Python markdown code block.
You are visiting a large electronics store to buy a refrigerator and a microwave.
The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th micro... |
Solve the programming task below in a Python markdown code block.
Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i.
In the contest, N f... |
Solve the programming task below in a Python markdown code block.
You are given a string s consisting of `A`, `B` and `C`.
Snuke wants to perform the following operation on s as many times as possible:
* Choose a contiguous substring of s that reads `ABC` and replace it with `BCA`.
Find the maximum possible numbe... |
Solve the programming task below in a Python markdown code block.
AtCoDeer the deer wants a directed graph that satisfies the following conditions:
* The number of vertices, N, is at most 300.
* There must not be self-loops or multiple edges.
* The vertices are numbered from 1 through N.
* Each edge has either an int... |
Solve the programming task below in a Python markdown code block.
AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of [0,1] and the horizontal range of [a,a+W], and... |
Solve the programming task below in a Python markdown code block.
Counting was a difficult task in ancient Rome. The Arabic numerals 0,1,2,3,β¦, 9 have not yet been disseminated. Instead, the following symbols were used:
Arabic numerals | Roman numerals | Arabic numerals | Roman numerals | Arabic numerals | Roman nume... |
Solve the programming task below in a Python markdown code block.
Write a program to calculate values of arithmetic expressions which may involve complex numbers. Details of the expressions are described below.
In this problem, basic elements of expressions are non-negative integer numbers and the special symbol "`i`... |
Solve the programming task below in a Python markdown code block.
Once upon a time when people still believed in magic, there was a great wizard Aranyaka Gondlir. After twenty years of hard training in a deep forest, he had finally mastered ultimate magic, and decided to leave the forest for his home.
Arriving at his... |
Solve the programming task below in a Python markdown code block.
Problem A Secret of Chocolate Poles
Wendy, the master of a chocolate shop, is thinking of displaying poles of chocolate disks in the showcase. She can use three kinds of chocolate disks: white thin disks, dark thin disks, and dark thick disks. The thin... |
Solve the programming task below in a Python markdown code block.
Bridge Construction Planning
There is a city consisting of many small islands, and the citizens live in these islands. Citizens feel inconvenience in requiring ferry rides between these islands. The city mayor decided to build bridges connecting all th... |
Solve the programming task below in a Python markdown code block.
You decide to develop a game with your friends. The title of the game is "Battle Town". This is a game with the theme of urban warfare with tanks. As the first step in game development, we decided to develop the following prototype.
In this prototype, ... |
Solve the programming task below in a Python markdown code block.
Japanese video game company has developed the music video game called Step Step Evolution. The gameplay of Step Step Evolution is very simple. Players stand on the dance platform, and step on panels on it according to a sequence of arrows shown in the f... |
Solve the programming task below in a Python markdown code block.
The time was 3xxx, and the highly developed civilization was in a stagnation period. Historians decided to learn the wisdom of the past in an attempt to overcome this situation. What I paid attention to was the material left by the genius of the early d... |
Solve the programming task below in a Python markdown code block.
Make a wish to a shooting star
The mysterious organization JAG (Japanese Alumni Group) holds regular meetings. One day, the agenda was "How to enable participating teams to demonstrate their strength in the upcoming ICPC (International Collegiate Progr... |
Solve the programming task below in a Python markdown code block.
D --Invisible
Problem Statement
You are trying to play a card game called "Invisible" with your friends. This card game uses two types of cards, a "scoring card" and a "jamming card". A positive value is written on each score card. The rules of this c... |
Solve the programming task below in a Python markdown code block.
Alice has a lovely piece of cloth. It has the shape of a square with a side of length a centimeters. Bob also wants such piece of cloth. He would prefer a square with a side of length b centimeters (where b < a). Alice wanted to make Bob happy, so she c... |
Solve the programming task below in a Python markdown code block.
In this problem we consider a very simplified model of Barcelona city.
Barcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is a detail which makes Barcelona di... |
Solve the programming task below in a Python markdown code block.
Today's morning was exceptionally snowy. Meshanya decided to go outside and noticed a huge snowball rolling down the mountain! Luckily, there are two stones on that mountain.
Initially, snowball is at height h and it has weight w. Each second the follo... |
Solve the programming task below in a Python markdown code block.
You are given an array consisting of n integers a_1, a_2, ... , a_n and an integer x. It is guaranteed that for every i, 1 β€ a_i β€ x.
Let's denote a function f(l, r) which erases all values such that l β€ a_i β€ r from the array a and returns the resulti... |
Solve the programming task below in a Python markdown code block.
Natasha's favourite numbers are n and 1, and Sasha's favourite numbers are m and -1. One day Natasha and Sasha met and wrote down every possible array of length n+m such that some n of its elements are equal to 1 and another m elements are equal to -1. ... |
Solve the programming task below in a Python markdown code block.
You have a fence consisting of n vertical boards. The width of each board is 1. The height of the i-th board is a_i. You think that the fence is great if there is no pair of adjacent boards having the same height. More formally, the fence is great if an... |
Solve the programming task below in a Python markdown code block.
DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew n distinct lines, given by equations y = x + p_i for some distinct p_1, p_2, β¦, p_n.
Then JLS drew on the same paper sheet m distinct lines g... |
Solve the programming task below in a Python markdown code block.
Bob is playing a game of Spaceship Solitaire. The goal of this game is to build a spaceship. In order to do this, he first needs to accumulate enough resources for the construction. There are n types of resources, numbered 1 through n. Bob needs at leas... |
Solve the programming task below in a Python markdown code block.
Input
The input contains a single integer a (0 β€ a β€ 63).
Output
Output a single number.
Examples
Input
2
Output
2
Input
5
Output
24
Input
35
Output
50
The input will be give
Read the inputs from stdin solve the problem an... |
Solve the programming task below in a Python markdown code block.
You are given two integers a and b. Print a+b.
Input
The first line contains an integer t (1 β€ t β€ 10^4) β the number of test cases in the input. Then t test cases follow.
Each test case is given as a line of two integers a and b (-1000 β€ a, b β€ 1000... |
Solve the programming task below in a Python markdown code block.
Anna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has a vanilla cookies and b chocolate cookies for the party.
She invited n guests of the first type a... |
Solve the programming task below in a Python markdown code block.
You are playing a computer game. In this game, you have to fight n monsters.
To defend from monsters, you need a shield. Each shield has two parameters: its current durability a and its defence rating b. Each monster has only one parameter: its strengt... |
Solve the programming task below in a Python markdown code block.
Bandits appeared in the city! One of them is trying to catch as many citizens as he can.
The city consists of n squares connected by n-1 roads in such a way that it is possible to reach any square from any other square. The square number 1 is the main ... |
Solve the programming task below in a Python markdown code block.
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an n Γ m matrix consisting of "*" and ".".
<image>
To find eve... |
Solve the programming task below in a Python markdown code block.
The only difference between the easy and the hard version is the limit to the number of queries.
This is an interactive problem.
There is an array a of n different numbers. In one query you can ask the position of the second maximum element in a subse... |
Solve the programming task below in a Python markdown code block.
Omkar's most recent follower, Ajit, has entered the Holy Forest. Ajit realizes that Omkar's forest is an n by m grid (1 β€ n, m β€ 2000) of some non-negative integers. Since the forest is blessed by Omkar, it satisfies some special conditions:
1. For a... |
Solve the programming task below in a Python markdown code block.
Given the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.
Input
The first line of the input contains integer n (1 β€ n β€ 1000).
Output
Output the smalle... |
Solve the programming task below in a Python markdown code block.
Our old friend Alexey has finally entered the University of City N β the Berland capital. Alexey expected his father to get him a place to live in but his father said it was high time for Alexey to practice some financial independence. So, Alexey is liv... |
Solve the programming task below in a Python markdown code block.
One day Vasya got hold of information on the Martian dollar course in bourles for the next n days. The buying prices and the selling prices for one dollar on day i are the same and are equal to ai. Vasya has b bourles. He can buy a certain number of dol... |
Solve the programming task below in a Python markdown code block.
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and b, eras... |
Solve the programming task below in a Python markdown code block.
The School β0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know va... |
Solve the programming task below in a Python markdown code block.
Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t.
Help Chewbacca to transform the initial number x to the minimum possible p... |
Solve the programming task below in a Python markdown code block.
Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word s. It is considered that Vasya managed to say hello if several letters can be deleted from the ... |
Solve the programming task below in a Python markdown code block.
They say "years are like dominoes, tumbling one after the other". But would a year fit into a grid? I don't think so.
Limak is a little polar bear who loves to play. He has recently got a rectangular grid with h rows and w columns. Each cell is a squar... |
Solve the programming task below in a Python markdown code block.
There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.
The game is played on a square field consistin... |
Solve the programming task below in a Python markdown code block.
Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always mo... |
Solve the programming task below in a Python markdown code block.
Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi nearby. The i-th taxi is located at point (xi, yi) and moves with a speed v... |
Solve the programming task below in a Python markdown code block.
Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's introduce a coordinate system so that the car r... |
Solve the programming task below in a Python markdown code block.
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.
Each bid is define by two int... |
Solve the programming task below in a Python markdown code block.
You are given an integer m, and a list of n distinct integers between 0 and m - 1.
You would like to construct a sequence satisfying the properties:
* Each element is an integer between 0 and m - 1, inclusive.
* All prefix products of the sequenc... |
Solve the programming task below in a Python markdown code block.
Petya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves:
* Extract the first character of s and append t with this char... |
Solve the programming task below in a Python markdown code block.
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.
Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a commander, and h... |
Solve the programming task below in a Python markdown code block.
A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.
You are given a set of strings. A string (not necessarily from this set) is called good if all eleme... |
Solve the programming task below in a Python markdown code block.
You are given two arrays A and B, each of size n. The error, E, between these two arrays is defined <image>. You have to perform exactly k1 operations on array A and exactly k2 operations on array B. In one operation, you have to choose one element of t... |
Solve the programming task below in a Python markdown code block.
Little Jhool considers Jaadu to be a very close friend of his. But, he ends up having some misunderstanding with him a lot of times, because Jaadu's English isn't perfect, and Little Jhool sucks at the language Jaadu speaks. So, he's in a fix - since he... |
Solve the programming task below in a Python markdown code block.
Caesar Cipher is one of the earliest and simplest encryption technique.
To encrypt a message, we shift the alphabets of the message by a fixed position or key.
For example, if message is ABC , and we shift each character by 3 characters, we will get ... |
Solve the programming task below in a Python markdown code block.
Inspired by the tv series Stranger Things, bear Limak is going for a walk between two mirror worlds.
There are two perfect binary trees of height H, each with the standard numeration of vertices from 1 to 2^H-1. The root is 1 and the children of x are ... |
Solve the programming task below in a Python markdown code block.
Given is a positive integer N.
We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.
* Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.
In how many... |
Solve the programming task below in a Python markdown code block.
We held two competitions: Coding Contest and Robot Maneuver.
In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the ... |
Solve the programming task below in a Python markdown code block.
Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).
He is dividing the problems into two categories by choosing an integer K... |
Solve the programming task below in a Python markdown code block.
You are given a connected undirected simple graph, which has N vertices and M edges. The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i connects vertices A_i and B_i. Your task is to find a path that satisfies the foll... |
Solve the programming task below in a Python markdown code block.
There is a triangle formed by three points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ on a plain.
Write a program which prints "YES" if a point $P$ $(x_p, y_p)$ is in the triangle and "NO" if not.
Constraints
You can assume that:
* $ -100 \leq x_1, y_... |
Solve the programming task below in a Python markdown code block.
On the Internet, data is divided into packets, and each packet is transferred to a destination via a relay device called a router. Each router determines the next router to forward from the destination described in the packet. In addition, a value calle... |
Solve the programming task below in a Python markdown code block.
problem
Do you know Just Odd Inventions? The business of this company is to "just odd inventions". Here we call it JOI for short.
JOI has two offices, each of which has square rooms of the same size arranged in a grid pattern. All the rooms that are i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.