task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
The Nobel Thief (NBLTHIEF)
The Nobel Prize of Kabiguru Rabindranath Thagore was stolen from a museum of Viswa Bharati University in West Bengal. The Central Bureau of Investigation (CBI) has been assigned the job to investigate the crime and recover the prize. CBI has identified some suspects and linked each one of th... | 31,500 |
Prime Number Theorem (CPRIME)
English
Vietnamese
In number theory, the Prime Number Theorem describes the asymptotic distribution of prime numbers. Let π(x) be the number of prime numbers not greater than x. The Prime Number Theorem states that:
Your task is to write a program to verify how well the Pr... | 31,501 |
Game on board (BGAME)
English
Vietnamese
Two players, A and B, play a game on a square board of size n×n. The squares of the board are either white or black. The game is played only on the white squares — the black ones are excluded from the game. Each player has
one piece, initially placed at this player’s star... | 31,502 |
Matrica (MATRICA)
A matrix is a rectangular table of letters. A square matrix is a matrix with an equal number of rows and columns. A square matrix M is called symmetric if its letters are symmetric with respect to the main diagonal (M
i,j
= M
j,i
for all pairs of i and j).
For example, the following two matrices ... | 31,503 |
Binary Search Tree (BST)
A binary search tree is a tree in which every node has at most two children nodes (a left and a right child). Each node has an integer written inside it. If the number X is written inside a node, then the numbers in its left subtree are less than X and the numbers in its right subtree are grea... | 31,504 |
Najkraci (NAJKRACI)
A road network in a country consists of N cities and M one-way roads. The cities are numbered 1 through N. For each road we know the origin and destination cities, as well as its length.
We say that the road F is a continuation of road E if the destination city of road E is the same as the origin... | 31,505 |
Choosing Gloves (GLOVE)
English
Vietnamese
In the dark basement of chemistry professor Acidrain’s house there are two drawers with gloves — one with left hand and other with right hand gloves. In each of them there are gloves of n different colours. Professor knows how many gloves of each colour there ar... | 31,506 |
Boy Scouts (BOYSCOUT)
Boy Scouts of New England organize Scout Olympics every year. They
ask each team to perform certain tasks, sum up their points, announce
winners, and then stay up all night by the fire plying guitar and
singing scout songs.
This year, Scouts decided to organize the Olympics in one of the mo... | 31,507 |
Parity (PARITY)
You are given n binary strings s
1
... s
n
, each of the same
length m. Along with each s
i
you are given a bit b
i
. You are
also given some nonnegative integer k and want to know whether there
exists a subset S of {0, 1 ... m-1} of size at most k such
that for each i = 1, 2 ... n, the bit b
i... | 31,508 |
Hashing (HASH)
Consider the hash function h(y) = a*y + b (mod m) which maps each
integer to some integer between 0 and m-1. You are given
x, n, c, d and are curious how many of the hash values
h(x), h(x+1) ... h(x+n) land in the interval [c, d].
Input
The first line contains a positive integer t, the number ... | 31,509 |
Disjoint Paths (DISJPATH)
One of your classes has K students in it who really don't like each other. In fact, they dislike each other so much that they want to find routes to class that don't cross at any intersection so that they won't ever see each other outside of class. Can you find such routes?
Input
The ... | 31,510 |
Tree Similarity (TREESIM)
You are given two labeled and ordered rooted trees T and T' and
would like to calculate the
distance
from T to T', which is
the minimum number of operations you can perform on T to make it
equivalent
to T'. For each operation you can choose to do one of three things:
change
the ... | 31,511 |
Restaurant Tab (RSTAURNT)
After eating dinner at a restaurant with some friends, you determine
how much money each person owes. Each of you has some cash and some
change, but very few of you have exact change. Can you make change
for each other so that each person ends up paying the exact right
amount?
Input
... | 31,512 |
Prime Again (PAGAIN)
English
Vietnamese
In this problem, you have to find the nearest prime number smaller than N. (3 <= N <= 2^32)
Input
The first line contains an integer T specifying the number of test cases. (T <= 10000)
T lines follow, each line contains an integer N.
Output
For each test case, o... | 31,513 |
Patting Heads (PATHEADS)
It's Bessie's birthday and time for party games! Bessie has instructed the N (1 ≤ N ≤ 100,000) cows conveniently numbered 1..N to sit in a circle (so that cow i [except at the ends] sits next to cows i-1 and i+1; cow N sits next to cow 1). Meanwhile, Farmer John fills a barrel with one billion... | 31,514 |
Minimum Rotations (MINMOVE)
English
Vietnamese
Given a string S[1..n] . A rotation on S is that we move the first character to the right-most of the string. More specific, after a rotation, S becomes T = S[2..n] + S[1].
For example: S = abcaa, then after a rotation we have S = bcaaa.
Find the minimum... | 31,515 |
Word Counting (WORDCNT)
English
Vietnamese
Nguyen is writing a small software for counting words in a string. He becomes bored after finishing the software very fast. He now wants to find the number of words P in the longest consecutive sequence of words of the same length.
Given a string containing only c... | 31,516 |
Lucky Numbers (LUCKYNUM)
English
Vietnamese
In some Asian countries, 8 and 6 are considered lucky digits. Any number containing only 8s and 6s is considered lucky number, e.g. 6, 8, 66, 668, 88, 886 ….
Nguyen is a student who likes mathematics very much. Nguyen likes lucky numbers but only of the form
... | 31,517 |
Hanoi Subway System Construction (HNSUBWAY)
English
Vietnamese
Hanoi is constructing a subway system. The subway system consists of M stations which are numbered from 1 to M and K two-way subway lines connecting pairs of stations directly. Hanoi metropolitan area is covered by T separated resident blocks e... | 31,518 |
Earthquakes (EARTHQK)
English
Vietnamese
In 3010, a group of people from the Earth has moved to live in the planet Alpha. Because the climatic condition of the planet is very severe, only a certain part of land can be cultivated.
Suppose that the surface of the planet is a plane, and the cultivable land ha... | 31,519 |
Pretty Printing (PRETTYP)
English
Vietnamese
An IT company decided to publish an internal newsletter describing the projects that have been successfully completed. Each department submits a text paragraph that will be printed in a corresponding designated box of the newsletter. Let’s assume that the paragraph c... | 31,520 |
Traffic Network (TRAFFICN)
The city traffic network consists of n nodes numbered from 1 to n and m one-way roads connecting pairs of nodes. In order to reduce the length of the shortest path between two different critical nodes s and t, a list of k two-way roads are proposed as candidates to be constructed. Your task... | 31,521 |
Winning Strategy (WINSTRAT)
English
Vietnamese
A table has n rows labeled by numbers from 0 to n-1 and n columns also labeled by numbers from 0 to n-1. The coordinate of a cell belonging to the ith row and jth column is (i,j). Each cell has a value of 0 or 1. In this table, there are m cells having the value of... | 31,522 |
Farthest Headquarters (HEADQRT)
English
Vietnamese
Microhoo and Googloo are two competing IT companies from the same city. Each company has offices scattered across the city. To protect their critical information from each other, both companies have agreed to locate their headquarters as far from each othe... | 31,523 |
Adventure Tourism (ATOURISM)
English
Vietnamese
There has been a growing interest in adventure tourism lately. However, organizing adventure tours is not an easy task. It requires very careful preparation with attention to specific details.
This tour has p young male and q female participants. In addition t... | 31,524 |
Moebius (MOEBIUS)
English
Vietnamese
The game of Moebius is not well known, but there are some fanatics who spend their whole day playing it. In this game, the player is to find the way to clear a pair of squares containing x and z on a Moebius with the minimum cost.
A Moebius is made from a rectangular M×N... | 31,525 |
Cattle Bruisers (CATTLEB)
Canmuu is out for revenge after being utterly defeated by Bessie in paintball and has challenged Bessie to a video game.
In this game, Bessie starts out at point (BX, BY) in the coordinate grid (-1,000 <= BX <= 1,000; -1000 <= BY <= 1,000), and tries to escape, starting at time 0. She m... | 31,526 |
Moo University - Emergency Pizza Order (MOOPIZZA)
Moo U's cafeteria has run out of hay and so must order pizzas for
the C (1 <= C <= 1,000) calves attending Moo U. Conveniently, a
large pizza from the local pizzeria, Pizza Farm, serves exactly one
calf.
Pizza Farm is willing to make a pizza for each calf, bu... | 31,527 |
Maximum Sum (KGSS)
You are given a sequence A[1], A[2] ... A[N] (0 ≤ A[i] ≤ 10
8
, 2 ≤ N ≤ 10
5
). There are two types of operations and they are defined as follows:
Update:
This will be indicated in the input by a 'U' followed by space and then two integers i and x.
U i x
, 1 ≤ i ≤ N, and x, 0 ≤ x ≤ 10
8
.
... | 31,528 |
Primitive Root (PROOT)
In the field of Cryptography, prime numbers play an important role. We are interested in a scheme called "Diffie-Hellman" key exchange which allows two communicating parties to exchange a secret key. This method requires a prime number
p
and
r
which is a primitive root of p to be publicly kn... | 31,529 |
Snooker (SNOOKER)
Consider a rectangular snooker table with pockets only at the 4 corners of the rectangle as shown in the image below. Consider all integer points on the boundary of the table. At each point, except the four corners (four pockets), you are allowed to hit the ball at an angle of
45
degrees from the s... | 31,530 |
Rainbow Ride (RAINBOW)
Mr.Raju and his extended family are on vacation in Chennai. They visit MGM and see the Rainbow ride. They want to enjoy the ride. However, there are some problems.
Each person in the family likes some other people in the family. Each person insists that he or she will go on the ride only if ... | 31,531 |
Taming a T-REX (TREX)
Although evolution theory suggests that mammals started to dominate this world only after the mass extinction of the dinosaurs, there are some people who say man and dinosaurs may have co-existed for some time. Some argue that man even tamed and used some of these animals like the Flintstones. Sh... | 31,532 |
Slikar (SLIKAR)
English
Vietnamese
Josip is a strange painter. He wants to paint a picture consisting of N×N pixels, where N is a power of
two (1, 2, 4, 8, 16 etc.). Each pixel will be either black or white. Josip already has an idea of how each
pixel will be coloured.
This would be no problem if Josip's paint... | 31,533 |
Trezor (TREZOR)
English
Vietnamese
Mirko decided to open a new business – bank vaults. A branch of the bank can be visualized in a plane, vaults being points in the plane. Mirko's branch contains exactly L·(A+1+B) vaults, so that each point
with integer coordinates inside the rectangle with corners (1, −A) and (... | 31,534 |
Periodni (PERIODNI)
English
Vietnamese
Luka is bored in chemistry class so he is staring at a large periodic table of chemical elements hanging from a wall above the blackboard. To kill time, Luka decided to make his own table completely different from the one in the classroom.
His table consists of N ... | 31,535 |
Subset Sums (SUBSUMS)
Given a sequence of N (1 ≤ N ≤ 34) numbers S
1
, ..., S
N
(-20,000,000 ≤ S
i
≤ 20,000,000), determine how many subsets of S (including the empty one) have a sum between A and B (-500,000,000 ≤ A ≤ B ≤ 500,000,000), inclusive.
Input
The first line of standard input contains the three integer... | 31,536 |
JEDNAKOST (JEDNAKOS)
English
Vietnamese
While browsing a math book, Mirko found a strange equation of the form A=S. What makes the equation strange is that A and S are not the same, which makes the equation incorrect. Mirko realized that the left side of the equation should have addition operations between... | 31,537 |
GONDOR (GONDOR)
English
Vietnamese
The legendary land of Gondor had a network of sparks to quickly alert the entire land of an emergency.
Every spark is manned by an archer with several arrows and instruction in which order to light the other sparks.
More precisely, when his own spark is lit, the arche... | 31,538 |
MAJMUN (MAJMUN)
English
Vietnamese
Coming home after a hard day at school, Ivica is ready to relax playing the computer game "Monkey & Banana". In the game, the monkey is located in a jungle, modeled as a coordinate plane. Every point with integer coordinates represents a tree. The monkey is initially lo... | 31,539 |
Bread Tree (BRTREE)
English
Vietnamese
Breadtree is a kind of tree that produces bread. At its first year, a breadtree is only a node with a bread of weight 0 on this node which is also called zeronode. Every year after that, the weight of bread on each node of the tree will increase by 1, and another branch wit... | 31,540 |
George (GEORGE)
Last week Mister George visited Croatia. Since Mister George is a very important person, while he was in a street, the police
disallowed entry
to that street, but vehicles that entered the street before Mister George could continue driving.
While Mister George was visiting, Luka drove his truck aro... | 31,541 |
Street (STREET)
There are
n
lots on one side of a street (where
n
≤ 500). We would like to erect at most
k
apartment buildings on these lots. Each building must occupy an interval of at most
t
consecutive lots. Moreover, each lot
i
has a height restriction
r[i]
(where
r[i]
≤ 100). A building cannot excee... | 31,542 |
Lubenica (LUBEN)
Children in school are having fun instead of listening to the teacher. With their iPhone devices the children throw watermelons at each other on the Facebook social site.
The game started when Goran threw one watermelon at each of his friends during the first class that day. During subsequent classe... | 31,543 |
Kruska (KRUS)
Aladdin has become bored of life at the palace. He has a steady job, his wife Jasmine, kids are on the way and life is becoming monotonous. Prompted by all this, he has decided to have one more adventure before settling down.
He has decided to find the Golden Pear, an extremely valuable legendary artef... | 31,544 |
Tresnja (TRES)
Lana lives in a small but merry village. There is a row of cherry trees next to the main street. Lana numbered the trees with consecutive integers starting with 1.
After much studying, Lana noticed that the number of the tree uniquely determines the amount of cherries the tree gives.
For one tree, c... | 31,545 |
Laser Phones (MLASERP)
English
Vietnamese
The cows have a new laser-based system so they can have casual
conversations while out in the pasture which is modelled as a W × H
grid of points (1 <= W <= 100; 1 <= H <= 100).
The system requires a sort of line-of-sight connectivity in order
to sustain communicat... | 31,546 |
Area of circles (VCIRCLES)
Given N circles. Calculate the total area that these N circles cover.
Input
First line: N (1 <= n <= 50)
- In the i-th line of the next n lines contains 3 integers Xi, Yi and Ri, separated by spaces. These are the coordinates of the center and the radius of the i-th circle (-10000 <=... | 31,547 |
Reljef (RELJEF)
Two groups of cavemen got into a land dispute and decided to settle it the old fashion-way, by throwing sticks at each other. The fight was organized in a cave, high enough that the ceiling is of no concern, but mineral deposits on the ground get in the way of flying sticks.
The cave can be divided i... | 31,548 |
Finding Palindromes (VPALIN)
A word is called a palindrome if we read from right to left is as same as we read from left to right. For example, "dad", "eye" and "racecar" are all palindromes, but "odd", "see" and "orange" are not palindromes.
Given n palindromes, you can generate n × n pairs of them and concatenate... | 31,549 |
Who is The Boss (VBOSS)
Several surveys indicate that the taller you are, the higher you can climb the corporate ladder. At TALL Enterprises Inc. this "de facto standard" has been properly formalized: your boss is always at least as tall as you are. Furthermore, you can safely assume that your boss earns a bit more th... | 31,550 |
Total Flow (MTOTALF)
English
Vietnamese
Farmer John always wants his cows to have enough water and thus has
made a map of the N (1 <= N <= 700) water pipes on the farm that
connect the well to the barn. He was surprised to find a wild mess
of different size pipes connected in an apparently haphazard way.
He wan... | 31,551 |
Military Story (VMILI)
Military headquarters plan to develop a better protection for a spaceport. They suppose that the spaceport would be best protected if it is surrounded with as many fences as possible and each fence is patrolled by armed guards. The corresponding order was issued and military engineers started to... | 31,552 |
GCD Extreme (GCDEX)
Given the value of N, you will have to find the value of G. The meaning of G is given in the following code
G = 0;
for (i = 1; i < N; i++)
for (j = i+1; j <= N; j++)
G += gcd(i, j);
Here gcd() is a function that finds the greatest common divisor of the two input numbers.
Inpu... | 31,553 |
Party At School (VPARTY)
Today there is a party at school. N girls and M boys attend this party. The principal wants to give some presents to the girl and he decides to make the boy do that. Each boy has told the principal the name of the two girls that he wants to give the present to so the principal wants the form t... | 31,554 |
Tablica (TABLIC)
English
Vietnamese
Ivo has an N×N table. The table has the integers 1 through N
2
inscribed in row-major order. The following operations can be done on the table:
1. Rotate a row – all cells in a single row are rotated right, so that the number in the last column moves to the first.
2. Rota... | 31,555 |
Cvjetici (CVJETICI)
On a faraway planet, strange plants with two stems can be found. Every plant on the planet can be described by three numbers: the x-coordinates of the stems L and R, and the height H at which the stems are connect. The image depicts a plant with L=2, R=5 and H=4.
Every day a new plant grows on ... | 31,556 |
Rectangles Perimeter (MMAXPER)
English
Vietnamese
Given are n rectangles, numbered from 1 to n. We place them tightly on the axis OX, from left to right, according to rectangles' numbers. Each rectangle stays on the axis OX either by its shorter or by its longer side (see the picture below). Comp... | 31,557 |
Majstor (MAJSTOR)
English
Vietnamese
Rock-paper-scissors is a popular two-player game. In the game, each of the players uses their hand to
show one of three symbols: rock, paper or scissors. If both players show the same symbol, the game is
a tie. Otherwise, scissors beat paper, paper beats rock and rock beats s... | 31,558 |
Cijevi (CIJEVI)
English
Vietnamese
To help design the new gas pipeline which will be used to deliver Russian gas to Croatia, Zagreb and Moscow are using the computer game Pipe Mania. In the game, Europe is divided into R rows and C columns. Each cell can be empty or contain one of the seven basic pipelin... | 31,559 |
LATGACH3 (M3TILE)
English
Vietnamese
In how many ways can you tile a 3×n rectangle with 2×1 dominoes?
Here is a sample tiling of a 3×12 rectangle.
Input consists of several test cases followed by a line containing -1.
Each test case is a line containing an integer 0 ≤ n ≤ 30. For each test
case, output one... | 31,560 |
When (You Believe) (WHEN)
It's said: there can be miracles, when you believe. The following programming language shows the power of "when". It has a very simple (case insensitive) grammar, shown below:
PROGRAM := WHEN | PROGRAM WHEN
WHEN := 'when ' EXPRESSION <ENTER> STATEMENTS 'end when' <ENTER>
STATEMENTS := STA... | 31,561 |
Coins Game (MCOINS)
English
Vietnamese
Asen and Boyan are playing the following game. They choose two different positive integers K and L, and start the game with a tower of N coins. Asen always plays first, Boyan – second, after that – Asen again, then Boyan, and so on. The boy in turn can take 1, K or L co... | 31,562 |
Closest Number (MCLONUM)
English
Vietnamese
Consider two n-digit positive decimal integers A and B with no leading
zeroes. We need to find the two closest to A n-digit numbers (the
first one – greater or equal to A, the other – strictly less than A),
with decimal writings containing all the digits of B in so... | 31,563 |
Rectangles Counting (MRECTCNT)
Let R be a rectangle with integer side lengths. The rectangle is divided into unit squares. Considering one of the diagonals, we denote by f(R) the number of squares which have a common interior point with it. For example, if the side lengths of R are 2 and 4 then f(R)=4. Write a progra... | 31,564 |
Space settlement (SPACESET)
English
Vietnamese
A long time ago in a galaxy far far away ... The empire has built a grand new space colony. This colony has m levels and each level consists of n settlements. Space settlements are connected by routes along which spacecrafts fly.
A level is a ring shaped construc... | 31,565 |
Bouncing Balls (BOBALLS)
Consider a grid having NxM squares. The top left square is (0, 0) and the bottom right is (N-1, M-1). Each square in the grid is either occupied by a platform or has a number written on it. Two balls are released from the top of the grid (from locations (0, Y1) and (0, Y2), 0 <= Y1, Y2 < M). E... | 31,566 |
Matrix Game (MTRGAME)
English
Vietnamese
Players P1 and P2 are playing a game. The game is played using a matrix M of integers, the size of which is given to be m × n.
In each turn, P1 selects a number i lying between 0 and m-1 (inclusive) while P2 selects a number j lying between 0 and n-1 (again inclusive).... | 31,567 |
Maximal Independent Set (MAXISET)
English
Vietnamese
You are given an unweighted undirected graph G. Each vertex has a positive weighted associated with it. Weight of a set of vertices is defined as the sum of weights of all vertices in the set.
A set of vertices is called independent if there is no edge in t... | 31,568 |
Convex Polygons (CVXPOLY)
English
Vietnamese
You are given n points in the 2-D cartesian coordinate system. You are to determine the number of convex polygons with 3 or more vertices which can be formed by choosing a subset of the given points. To make matters simple, the input obeys the following conditions:
... | 31,569 |
Even Palindrome (PALDR)
Vietnamese
English
Palindrome is a string that has the property of reading the same in either direction (left to right or right to left). You are to determine whether a given string can be expressed as a concatenation of palindromes of even length.
Note: A string can be formed by ... | 31,570 |
Finding Fractions (FINFRAC)
English
Vietnamese
Given a, b, c, d, find a fraction p/q with minimum q, and satisfied a/b < p/q < c/d.
Input
For each test case, one line contains four integers a, b, c, d.
Output
For each test case, print the fraction(see the sample for details).If multiple solution ... | 31,571 |
MinCut Query (MCQUERY)
English
Vietnamese
You are given a weighted undirected graph with edge weight denoting the capacity of the edge.
Now given a number x, output how many unordered (s,t) pairs are there in the graph such that minCut(s,t) <= x.
A Cut is a partition of the vertices of a graph into two set... | 31,572 |
Black and White Nim (BNWNIM)
English
Vietnamese
Black-White-Nim is played as follows. There are one or more horizontal rows, each containing several black and white beads. Two players take turns removing beads until there are none left. During each turn, a player must remove one or more consecutive beads from th... | 31,573 |
Fight with functions (FWFUNC)
English
Vietnamese
Multiplicative functions are defined as functions such that f(m×n) = f(m) × f(n). Now, we put an extra constraint on multiplicative functions that if m and n are coprime , then f(m) and f(n) are also coprime. Additionally it is also provided that f(1)=1. f(x) is... | 31,574 |
CALCULATE POW(2004,X) MOD 29 (MMOD29)
English
Vietnamese
Consider a positive integer X, and let S be the sum of all positive integer
divisors of 2004
X
. Your job is to determine S modulo 29 (the remainder of the
division of S by 29).
Take X = 1 for an example. The positive integer
divisors of 2004
1
... | 31,575 |
Color a tree (MTREECOL)
English
Vietnamese
Bob is very interested in the data structure of a tree. A tree is a directed graph in which a special node is singled out, called the "root" of the tree, and there is a unique path from the root to each of the other nodes.
Bob intends to color all the nodes of ... | 31,576 |
Star Polygon or Not (MPOLSTAR)
After counting so many stars in the sky in his childhood, Isaac, now an astronomer
and a mathematician, uses a big astronomical telescope and lets his image
processing program count stars. The hardest part of the program is to judge
if a shining object in the sky is really a star. As ... | 31,577 |
Lucius Dungeon (BYTESE1)
There are a set of rooms in a dungeon, arranged in an M × N rectangular grid. In one of the rooms, evil Lucius Malfoy has imprisoned Hermione, owing to his hatred towards the mudbloods. The noble Harry potter is on his way to rescue Hermione. Harry potter starts in the room at the top left cor... | 31,578 |
The Great Ball (BYTESE2)
Hogwarts has organized The Great Ball to welcome the schools participating in the Triwizard Tournament. The ball is being held in the Great Hall and The Weird Sisters have been called to play the band. The students drift in to dance and then go out when they get tired. Hagrid is stationed at t... | 31,579 |
Mystical River (BYTESM1)
Harry Potter was punished for his impudence by Snape and was sent to the forbidden forest for detention. He has now lost his way amidst the forest. He has come across 3 mystical rivers flowing in his way to the school but he is not sure which river does he have to cross.
Alongside each mystic... | 31,580 |
Philosophers Stone (BYTESM2)
One of the secret chambers in Hogwarts is full of philosopher’s stones. The floor of the chamber is covered by h × w square tiles, where there are h rows of tiles from front (first row) to back (last row) and w columns of tiles from left to right. Each tile has 1 to 100 stones on it.
Ha... | 31,581 |
Filchs Dilemna (BYTESH1)
Argus Filch, the caretaker of Hogwarts, has been given the task to carpet the way to Hogwarts through the grounds. The way is 2 units wide and ‘N’ units long. He has only two types of carpets available, one is 1 unit wide and 2 units long and the other one is L shaped, having 3 square units. H... | 31,582 |
Manhattan Wire (MMAHWIRE)
There is a rectangular area containing n × m cells. Two cells are marked
with “2”, and another two with “3”. Some cells are occupied by obstacles.
You should connect the two “2”s and also the two “3”s with non-intersecting
lines. Lines can run only vertically or horizontally connecting cen... | 31,583 |
Polygon on the Grid (MPOLGRID)
The ultimate Tantra is said to have been kept in the most distinguished
temple deep in the sacred forest somewhere in Japan. Paleographers
finally identified its location, surprisingly a small temple in Hiyoshi,
after years of eager research. The temple has an underground secret
room... | 31,584 |
Counting Digits (MDIGITS)
English
Vietnamese
Given two integers a and b, we write the numbers between a and b, inclusive, in a list. Your task is to calculate the number of occurrences of each digit.
For example, if a = 1024 and b = 1032, the list will be 1024 1025 1026 1027 1028 1029 1030 1031 1032 there are ... | 31,585 |
Different Digits (MDIGITS1)
English
Vietnamese
Given a positive integer n, your task is to find a positive integer m,
which is a multiple of n, and that m contains the least number of different
digits when represented in decimal. For example, number 1334 contains three
different digits 1, 3 and 4.
Inp... | 31,586 |
Group Partition (MPART)
English
Vietnamese
Jamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The contact list has become so long that it often takes a long time for her to browse through the whole list to find a friend’s number.
... | 31,587 |
Maximum Triangle Area (MTRIAREA)
English
Vietnamese
Given n distinct points on a plane, your task is to find the triangle that have the maximum area, whose vertices are from the given points.
Input
The input consists of several test cases. The first line of each test case contains an integer n, indicat... | 31,588 |
Point Connection Game in a Circle (MCIRGAME)
English
Vietnamese
This is a small but ancient game. You are supposed to write down the
numbers 1, 2, 3, . . . , 2n − 1, 2n consecutively in clockwise order
on the ground to form a circle, and then, to draw some straight line
segments to connect them into number pai... | 31,589 |
Minimum Permutation (MMINPER)
English
Vietnamese
The inversion number of an integer sequence a1, a2 ... an is the number
of pairs (ai, aj) that satisfy i < j and ai > aj . Given n and the inversion
number m, your task is to find the smallest permutation of the set { 1, 2 ... n } ,
whose inversion number is exact... | 31,590 |
Recaman’s Sequence (MRECAMAN)
English
Vietnamese
The Recaman’s sequence is defined by a0 = 0 ; for m > 0, a(m) = a(m−1) − m if the resulting a(m) is positive and not already in the sequence, otherwise a(m) = a(m−1) + m. The first few numbers in the Recaman’s Sequence is 0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, ... | 31,591 |
SHIFT Operator on Matrix (MMATRIX)
English
Vietnamese
Given an n×n matrix A, whose entries Ai,j are integer numbers (0 ≤ i < n,
0 ≤ j < n). An operation SHIFT at row i (0 ≤ i < n) will move the integers
in the row one position right, and the rightmost integer will wrap around
to the leftmost column.
... | 31,592 |
Repair City Hall (MCITYHAL)
English
Vietnamese
Because of its age, the City Hall has suffered damage to one of its walls.
A matrix with M rows and N columns represents the encoded image of that wall,
where 1 represents an intact wall and 0 represents a damaged wall (like in Figure-1).
1110000111
1100001... | 31,593 |
Wooden Sticks (MSTICK)
English
Vietnamese
There is a pile of n wooden sticks. The length and weight of each stick
are known in advance. The sticks are to be processed by a woodworking machine
in one by one fashion. It needs some time, called setup time, for the machine
to prepare processing a stick. The setup ti... | 31,594 |
Search of Concatenated Strings (MCONSTR)
English
Vietnamese
The amount of information on the World Wide Web is growing quite rapidly.
In this information explosion age, we must survive by accessing only the
Web pages containing information relevant to our own needs. One of the key
technologies for this purpose... | 31,595 |
Sum of Primes (MPRIME1)
English
Vietnamese
Some positive integers can be represented by a sum of one or more consecutive prime numbers.
How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and 53. The integer 41 has three... | 31,596 |
Kth Shortest Path (MKTHPATH)
English
Vietnamese
Isaac is tired of his daily trip to his office, using the same shortest route everyday. Although this saves his time, he must see the same scenery again and again. He cannot stand such a boring commutation any more.
One day, he decided to improve the situat... | 31,597 |
Cleaning Robot (MCLEAN)
English
Vietnamese
Here, we want to solve path planning for a mobile robot cleaning a rectangular
room floor with furniture.
Consider the room floor paved with square tiles whose size fits the cleaning
robot (1 × 1). There are 'clean tiles' and 'dirty tiles', and the robot can
cha... | 31,598 |
Nested Dolls (MDOLLS)
English
Vietnamese
Dilworth is the world's most prominent collector of Russian nested dolls:
he literally has thousands of them! You know, the wooden hollow dolls of
different sizes of which the smallest doll is contained in the second smallest,
and this doll is in turn contained in t... | 31,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.