name stringlengths 2 112 | description stringlengths 29 13k | private_tests dict | public_tests dict | generated_tests dict |
|---|---|---|---|---|
p01644 Collector | * This story is fiction and has nothing to do with real people or groups.
Social games have become very popular these days, and many companies are developing social games.
You are infiltrating one of the competing social game developers as a spy.
problem
The company you work for develops social games. The game we a... | {
"input": [],
"output": []
} | {
"input": [
"N (Sレアカードの種類)\nP_1 (カード1が好きな人の割合)\nP_2 (カード2が好きな人の割合)\n...\nP_N (カードNが好きな人の割合)"
],
"output": [
"10000"
]
} | {
"input": [],
"output": []
} |
p01796 JAG-channel II | Example
Input
7 4
DEFG
FEDA
EFGB
BGEA
AGFD
DABC
CADE
Output
ABCDEFG | {
"input": [],
"output": []
} | {
"input": [
"7 4\nDEFG\nFEDA\nEFGB\nBGEA\nAGFD\nDABC\nCADE"
],
"output": [
"ABCDEFG"
]
} | {
"input": [
"7 4\nDEFG\nFEDA\nEFGB\nBGEA\nAGFD\nDABC\nCEDA",
"7 4\nDEFG\nFECA\nEFGB\nBGEA\nAGFD\nDABC\nCADE",
"7 4\nDEFG\nFEDA\nEFGB\nBGEA\nAGFD\nDABC\nADEC",
"7 4\nDEFG\nFEDA\nEFGB\nBGEA\nAGFD\nCBAD\nADEC",
"7 4\nDEGF\nFEDA\nEFGB\nBGEA\nAGFD\nDACB\nCADE",
"7 4\nDEFG\nFEDA\nEFGB\nBGEA\nDGFA\n... |
p01930 Big Maze | Big Maze
You work in the Jumbo Amusement Garden, a huge amusement park called "JAG" for short. The site of this amusement park is vast, and all the attractions are huge.
This time, a new huge maze attraction "Big Maze" will be introduced to JAG. Looking at the plan view, the shape of the Big Maze will be a rectangle ... | {
"input": [],
"output": []
} | {
"input": [
"3 2\n#.#\n...\n#.#\n###\n...\n###\n3 2\n#.#\n...\n#.#\n###\n#.#\n###\n3 3\n#..\n..#\n###\n..#\n#.#\n#..\n#..\n..#\n###\n5 3\n.....\n#####\n##...\n##.##\n##...\n.....\n#####\n.....\n#####\n.....\n...##\n##.##\n...##\n#####\n.....\n3 2\n#.#\n...\n#.#\n#.#\n#.#\n#.#\n0 0"
],
"output": [
"Yes\nN... | {
"input": [
"3 2\n#.#\n...\n#.#\n###\n...\n##$\n3 2\n#.#\n...\n#.#\n###\n#.#\n###\n3 3\n#..\n..#\n###\n..#\n#.#\n#..\n#..\n..#\n###\n5 3\n.....\n#####\n##...\n##.##\n##...\n.....\n#####\n.....\n#####\n.....\n...##\n##.##\n...##\n#####\n.....\n3 2\n#.#\n...\n#.#\n#.#\n#.#\n#.#\n0 0",
"3 2\n#.#\n...\n#.#\n###\... |
p02068 Non-trivial Common Divisor | Problem Statement
You are given a positive integer sequence $A$ of length $N$. You can remove any numbers from the sequence to make the sequence “friendly". A sequence is called friendly if there exists an integer $k$ (>1) such that every number in the sequence is a multiple of $k$. Since the empty sequence is friendl... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
p02210 Divide Cake into Five | Divide Cake into Five
Segtree is a quintuplet tutor. Today is Christmas Eve, so I'm trying to divide the round cake into five equal parts for the quintuplets.
The cake is divided into $ N $ pieces from the center in a fan shape, $ i $ th and $ i + 1 $ th ($ 1 \ leq i \ leq N -1 $), $ N $ th and $ 1 $ The second piece... | {
"input": [],
"output": []
} | {
"input": [
"5 0\n1 1 1 1 1"
],
"output": [
"1"
]
} | {
"input": [
"5 0\n1 1 1 0 2",
"5 2\n6 1 1 0 1",
"4 0\n1 1 1 0 2",
"4 0\n1 1 0 0 2",
"4 0\n2 1 0 0 2",
"4 0\n2 1 1 0 2",
"4 0\n2 1 1 1 2",
"4 0\n4 1 1 1 2",
"3 0\n4 1 1 1 2",
"3 0\n4 1 1 0 2",
"3 1\n4 1 1 0 2",
"3 1\n4 1 1 0 1",
"3 1\n8 1 1 0 1",
"2 0\n1 1 1 1 1... |
p02364 Minimum Spanning Tree | Find the sum of weights of edges of the Minimum Spanning Tree for a given weighted undirected graph G = (V, E).
Constraints
* 1 ≤ |V| ≤ 10,000
* 0 ≤ |E| ≤ 100,000
* 0 ≤ wi ≤ 10,000
* The graph is connected
* There are no parallel edges
* There are no self-loops
Input
|V| |E|
s0 t0 w0
s1 t1 w1
:
s|E|-1 t|E|-1 w|E|-... | {
"input": [],
"output": []
} | {
"input": [
"6 9\n0 1 1\n0 2 3\n1 2 1\n1 3 7\n2 4 1\n1 4 3\n3 4 1\n3 5 1\n4 5 6",
"4 6\n0 1 2\n1 2 1\n2 3 1\n3 0 1\n0 2 3\n1 3 5"
],
"output": [
"5",
"3"
]
} | {
"input": [
"6 9\n0 1 1\n0 2 3\n1 2 2\n1 3 7\n2 4 1\n1 4 3\n3 4 1\n3 5 1\n4 5 6",
"4 6\n0 1 2\n1 2 1\n2 3 1\n3 0 1\n0 2 1\n1 3 5",
"6 9\n0 2 1\n0 2 3\n0 2 2\n1 3 7\n2 4 1\n1 4 3\n3 2 1\n3 5 1\n2 5 6",
"6 9\n0 1 1\n0 2 3\n1 2 2\n1 3 7\n2 4 1\n1 4 3\n3 4 1\n3 1 1\n4 5 6",
"6 2\n0 2 1\n0 2 3\n1 2 2\... |
cb01 | This is a very simple problem. Given the value of N and K, you need to tell us the value of the binomial coefficient C(N,K). You may rest assured that K ≤ N and the maximum value of N is 1,000,000,000,000,000. Since the value may be very large, you need to compute the result modulo 1009.
Input
The first line of the in... | {
"input": [],
"output": []
} | {
"input": [
"3\n3 1\n5 2\n10 3"
],
"output": [
"3\n10\n120"
]
} | {
"input": [],
"output": []
} |
crancrd | Little johny was working on the co-ordinate plane.As he is still a novice he calculates the distance between two points P1 and P2 in the wrong way.He calculates the distance between P1(x1,y1) and P2(x2,y2) as :
D(P1,P2) = |x1 - x2| + |y1 - y2|
His teacher gave him a homework to calculate the area of a circle of radius ... | {
"input": [],
"output": []
} | {
"input": [
"1\n1"
],
"output": [
"2."
]
} | {
"input": [
"1\n0",
"1\n-1",
"1\n-2",
"1\n-4",
"1\n-5",
"1\n-10",
"1\n-15",
"1\n-7",
"1\n-8",
"1\n-3",
"1\n-9",
"1\n-16",
"1\n-12",
"1\n-14",
"1\n-24",
"1\n-35",
"1\n-70",
"1\n-88",
"1\n-52",
"1\n-57",
"1\n-28",
"1\n-18",
"1\... |
gshuff | Presti Digitator, the world-famous magician, is highly dissatisfied with his way of shuffling cards. Just yesterday, a perky guy in the audience demanded that he shuffle the cards once again, and he was aghast to see that the bottom card had not changed. Even though Mr. Digitator pacified the crowd with a few excellent... | {
"input": [],
"output": []
} | {
"input": [
"2\n2\n4"
],
"output": [
"1\n9"
]
} | {
"input": [],
"output": []
} |
mdosa | Harish has decided to go to Arya's hotel this morning. We all know he is crazy for masala dosas. And as usual he is always hungry. He decided to order all the masala dosas at once. But then he realised that he did not have enough money to buy all of them. So he decided to share the amount with his friend Ozil. But both... | {
"input": [],
"output": []
} | {
"input": [
"2 \n16 \n27"
],
"output": [
"YES\nNO"
]
} | {
"input": [],
"output": []
} |
reciibks | Shrija's brother Vaibhav is a very mischievous boy . He has messed a lot of books of Shrija on floor . Now Shrija is very angry . Seeing her sister angry he promises to arrange them on N empty stacks numbered from 1 to N .
Shrija also felt that she should help her brother in arranging the books. So she gives Vaibhav a ... | {
"input": [],
"output": []
} | {
"input": [
"5 3\n2 4\n1 3\n3 5"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} |
tr004 | Problem Statement
Chef Diablo has set up a stall for selling his famous Modaks in the Trinity fest. He wants to earn as much profit as he can. So he has bought a chemical that increases the taste level of the Modaks. The tastier the Modaks the higher he can price them. This chemical is very costly hence he applies on... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 1\n2 2\n123123123123 2"
],
"output": [
"1\n4\n293883007"
]
} | {
"input": [],
"output": []
} |
1423_G. Growing flowers | Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left untouched for centuries, from watching icebergs in freezing weath... | {
"input": [],
"output": []
} | {
"input": [
"5 5\n1 2 3 4 5\n2 3\n1 1 2 5\n2 4\n1 2 4 5\n2 2\n"
],
"output": [
"9\n6\n4\n"
]
} | {
"input": [
"5 5\n1 2 3 4 5\n2 3\n1 1 3 5\n2 4\n1 2 4 5\n2 2\n",
"5 5\n2 2 3 4 5\n2 3\n1 1 2 5\n2 4\n1 2 4 5\n2 2\n",
"5 5\n1 2 3 4 1\n2 3\n1 1 3 5\n2 4\n1 2 4 5\n2 2\n",
"5 5\n1 2 3 4 1\n2 3\n1 1 3 5\n2 4\n1 2 4 5\n2 4\n",
"5 5\n2 2 1 4 5\n2 3\n2 1 2 5\n2 4\n1 2 4 5\n2 2\n",
"5 5\n1 2 3 4 1\... |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | {
"input": [],
"output": []
} | {
"input": [
"4\n3 3 1\n1\n7 3 3\n1 5 7\n10 5 3\n4 5 6\n13 7 7\n1 3 5 7 9 11 12\n"
],
"output": [
"\nNO\nYES\nNO\nYES\n"
]
} | {
"input": [
"4\n3 3 1\n1\n7 3 3\n1 5 7\n10 5 3\n4 5 6\n13 7 7\n2 3 5 7 9 11 12\n",
"4\n3 5 1\n1\n8 3 3\n1 5 7\n10 5 3\n4 5 6\n13 7 7\n2 3 5 7 9 11 12\n",
"4\n3 5 1\n1\n7 3 3\n1 3 7\n15 5 3\n4 5 6\n13 7 7\n2 3 5 7 9 11 12\n",
"4\n3 3 1\n2\n7 3 3\n1 5 7\n10 5 3\n4 5 6\n13 7 7\n1 3 5 7 9 11 12\n",
"... |
1543_A. Exciting Bets | Welcome to Rockport City!
It is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet a dollars and Ronnie has bet b dollars. But the fans seem to be disappointed. The excitement of the fans is given by gcd(a,b), where gcd(x, y) denotes the [greatest common divisor (GCD)]... | {
"input": [],
"output": []
} | {
"input": [
"4\n8 5\n1 2\n4 4\n3 9\n"
],
"output": [
"3 1\n1 0\n0 0\n6 3\n"
]
} | {
"input": [
"4\n8 5\n1 2\n4 5\n3 9\n",
"4\n8 5\n1 2\n1 5\n3 9\n",
"4\n8 0\n1 2\n1 5\n3 9\n",
"4\n8 0\n1 2\n1 5\n2 9\n",
"4\n7 0\n1 2\n1 5\n2 9\n",
"4\n6 0\n1 2\n1 5\n2 9\n",
"4\n6 0\n2 2\n1 5\n2 9\n",
"4\n8 5\n1 2\n4 4\n6 9\n",
"4\n8 5\n1 2\n4 5\n3 10\n",
"4\n8 5\n1 2\n1 4\n3 ... |
451_C. Predict Outcome of the Game | There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played.
You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of your friend for these k games. Your friend did not tell exact number of wins of each... | {
"input": [],
"output": []
} | {
"input": [
"5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 3 3 0\n3 3 3 2\n"
],
"output": [
"yes\nyes\nyes\nno\nno\n"
]
} | {
"input": [
"5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 6 3 0\n3 3 3 2\n",
"5\n3 0 0 0\n3 2 0 0\n6 4 1 0\n6 3 3 -1\n3 3 3 2\n",
"5\n3 1 0 0\n3 2 0 0\n6 4 1 0\n6 3 3 -1\n3 3 3 2\n",
"5\n3 2 0 0\n3 2 0 0\n6 4 0 0\n6 3 4 -1\n3 3 3 2\n",
"5\n3 0 0 0\n3 5 0 0\n6 3 1 0\n6 6 3 0\n1 3 3 4\n",
"5\n3 2 0 0\n3 2 1... |
474_B. Worms | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.
Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with number... | {
"input": [],
"output": []
} | {
"input": [
"5\n2 7 3 4 9\n3\n1 25 11\n"
],
"output": [
"1\n5\n3\n"
]
} | {
"input": [
"5\n2 7 3 4 9\n3\n1 4 11\n",
"5\n2 12 3 4 9\n3\n1 25 11\n",
"5\n2 3 3 4 9\n3\n1 4 11\n",
"5\n2 1 3 4 9\n3\n1 4 11\n",
"5\n1 1 3 4 9\n3\n1 4 6\n",
"5\n2 12 3 4 9\n3\n1 25 17\n",
"5\n2 1 3 4 2\n3\n1 2 11\n",
"5\n1 1 3 4 9\n3\n2 4 15\n",
"5\n1 1 6 7 9\n3\n1 4 7\n",
"5... |
917_E. Upside Down | As we all know, Eleven has special abilities. Thus, Hopper convinced her to close the gate to the Upside Down World with her mind. Upside down monsters like to move between the worlds, so they are going to attack Hopper and Eleven in order to make them stop. The monsters live in the vines. The vines form a tree with n ... | {
"input": [],
"output": []
} | {
"input": [
"10 6 7\n1 3 s\n10 1 d\n2 6 s\n5 2 d\n7 4 l\n8 9 d\n8 10 l\n7 2 d\n8 7 l\ndl\ndssld\nd\nd\nl\nsl\n4 5 4\n3 7 5\n10 6 2\n3 1 4\n7 5 6\n10 9 4\n9 8 4\n",
"6 4 5\n1 6 b\n2 3 a\n1 2 b\n5 3 b\n4 5 b\na\nb\nbb\naa\n1 2 1\n6 2 3\n1 6 2\n4 5 4\n1 6 2\n"
],
"output": [
"2\n2\n0\n0\n0\n1\n1\n",
... | {
"input": [
"6 4 5\n1 6 b\n2 3 a\n1 2 b\n5 3 b\n4 3 b\na\nb\nbb\naa\n1 2 1\n6 2 3\n1 6 2\n4 5 4\n1 6 2\n",
"10 6 7\n1 3 s\n10 1 d\n2 6 s\n5 2 d\n7 4 l\n8 9 d\n8 10 l\n7 2 d\n8 7 l\ndl\ndssld\nd\nd\nl\nls\n4 5 4\n3 7 5\n10 6 2\n3 1 4\n7 5 6\n10 9 4\n9 8 4\n",
"6 4 5\n1 6 b\n2 3 a\n1 2 b\n5 3 b\n4 5 b\na\n... |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | {
"input": [],
"output": []
} | {
"input": [
"1\n2 1\n\nSAMPLE"
],
"output": [
"1\n"
]
} | {
"input": [
"1\n3 1\n\nSAMPLE",
"1\n6 1\n\nSALPME",
"1\n6 0\n\nSALPME",
"1\n7 0\n\nSALPME",
"1\n2 0\n\nSAMPLE",
"1\n14 0\n\nEMPSAL",
"1\n4 0\n\nSAMPME",
"1\n1 1\n\nEMPLAS",
"1\n27 0\n\nEMPSAL",
"1\n37 0\n\nEMPSAL",
"1\n35 0\n\nEMPSAL",
"1\n11 0\n\nELPSBM",
"1\n26 0... |
guess-it-1 | Gazi is a very talented mathematician, recently he discovered the majestic power of the number '9' so he wants to play a game with you. He tells you to pick any real integer [from 10 to 10^200], then subtract sum of digits of this number from the number itself.
You will get another number, now omit any digit from this ... | {
"input": [],
"output": []
} | {
"input": [
"4\n4_1\n52_2\n63_124\n25141452_5575\n\nSAMPLE"
],
"output": [
"4\n0 or 9\n2\n8\n"
]
} | {
"input": [
"4\n4_1\n52_2\n63_124\n25141452_5575\n\nS@MPLE",
"4\n4_1\n52_2\n63_124\n25141452_5575\n\nR@MPLE",
"4\n4_1\n52_2\n63_124\n25141452_5575\n\nELPM@R",
"4\n4_1\n52_2\n63_124\n25141452_5575\n\nM@SPLE",
"4\n4_1\n52_2\n63_124\n25141452_5575\n\nR@MPME",
"4\n4_1\n52_2\n63_124\n25141452_5575... |
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians | 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:
* the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;
* the dogs numbered 27,28,29,\... | {
"input": [],
"output": []
} | {
"input": [
"27",
"2",
"123456789"
],
"output": [
"aa",
"b",
"jjddja"
]
} | {
"input": [
"40",
"1",
"71095103",
"51",
"50389265",
"4",
"56744729",
"3",
"61759127",
"6",
"5740262",
"9",
"4285476",
"7",
"805087",
"5",
"1388428",
"1331551",
"1930001",
"3667940",
"811828",
"1437069",
"2795337",
"20888... |
p02760 AtCoder Beginner Contest 157 - Bingo | We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.
The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.
Determine whether we will have a bi... | {
"input": [],
"output": []
} | {
"input": [
"60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34",
"84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30",
"41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17"
],
"output": [
"Yes",
"Yes",
"No"
]
} | {
"input": [
"60 88 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34",
"41 7 46\n26 89 2\n78 92 8\n5\n12\n45\n16\n57\n17",
"84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n146\n79\n24\n84\n30",
"60 106 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34",
"84 97 66\n79 89 1... |
p02895 AtCoder Grand Contest 039 - Pairing Points | There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the segments UV, WX, and YZ do not intersect at the same point. Additionally... | {
"input": [],
"output": []
} | {
"input": [
"4\n01111100\n10011111\n10011100\n11101111\n11110111\n11111011\n01011101\n01011110",
"3\n011111\n101111\n110111\n111011\n111101\n111110",
"8\n0111101111111111\n1011101111111111\n1101101111011101\n1110111111111111\n1111011111110111\n0001101111111111\n1111110111011111\n1111111011111111\n1111111... | {
"input": [
"4\n01111100\n10011111\n10011100\n11101111\n11110111\n11111011\n01011101\n00011110",
"3\n011111\n101111\n110111\n110011\n111101\n111110",
"8\n0111101111111111\n1011101111111111\n1101101111011101\n1110111111111111\n1111011111110111\n0001101111111111\n1111110111011111\n1111111011111111\n1111111... |
p03030 AtCoder Beginner Contest 128 - Guidebook | You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score.
You want to in... | {
"input": [],
"output": []
} | {
"input": [
"6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40",
"10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100"
],
"output": [
"3\n4\n6\n1\n5\n2",
"10\n9\n8\n7\n6\n5\n4\n3\n2\n1"
]
} | {
"input": [
"6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 20\nkhabarovsk 40",
"10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakktsu 80\nyakutsk 90\nyakutsk 100",
"10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 2\nyakutsk 50\nyakutsk 60\nyakutsk 70\ny... |
p03171 Educational DP Contest - Deque | Taro and Jiro will play the following game against each other.
Initially, they are given a sequence a = (a_1, a_2, \ldots, a_N). Until a becomes empty, the two players perform the following operation alternately, starting from Taro:
* Remove the element at the beginning or the end of a. The player earns x points, whe... | {
"input": [],
"output": []
} | {
"input": [
"4\n10 80 90 30",
"10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1",
"3\n10 100 10",
"1\n10",
"6\n4 2 9 7 1 5"
],
"output": [
"10",
"4999999995",
"-80",
"10",
"2"
]
} | {
"input": [
"4\n10 103 90 30",
"10\n1000000000 0 1000000000 1 1000000000 1 1000000000 1 1000000000 1",
"3\n10 101 10",
"1\n8",
"6\n4 0 9 7 1 5",
"4\n10 103 1 30",
"3\n10 101 2",
"6\n4 0 9 7 2 5",
"4\n5 103 1 30",
"3\n10 100 2",
"1\n1",
"4\n5 103 1 29",
"3\n5 100 2"... |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | {
"input": [],
"output": []
} | {
"input": [
"8 3\n7 3 1 8 4 6 2 5",
"4 3\n2 3 1 4",
"3 3\n1 2 3"
],
"output": [
"4",
"2",
"1"
]
} | {
"input": [
"8 3\n14 3 1 8 4 6 2 5",
"7 3\n2 3 1 4",
"3 3\n2 2 3",
"12 3\n0 4 0 4",
"20 3\n-1 4 0 4",
"34 3\n-1 4 0 6",
"31 3\n-1 4 0 6",
"31 8\n-2 2 0 6",
"4 3\n2 3 2 4",
"64 3\n-1 4 0 6",
"57 3\n-2 4 0 6",
"44 3\n-4 3 1 6",
"31 5\n-8 3 1 6",
"8 2\n14 5 1 4 2 ... |
p03473 AtCoder Beginner Contest 084 - New Year | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
Constraints
* 1≤M≤23
* M is an integer.
Input
Input is given from Standard Input in the following format:
M
Output
If we have x hours until New Year at M o'clock on 30th, December, print x.
Examples
Input
21
Output... | {
"input": [],
"output": []
} | {
"input": [
"12",
"21"
],
"output": [
"36",
"27"
]
} | {
"input": [
"9",
"34",
"8",
"25",
"14",
"49",
"0",
"4",
"-1",
"1",
"-2",
"2",
"-4",
"3",
"-5",
"5",
"-3",
"-8",
"-6",
"-13",
"-10",
"-21",
"-15",
"-31",
"-12",
"-35",
"-11",
"6",
"-20",
"-16",
... |
p03636 AtCoder Beginner Contest 069 - i18n | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`.
You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way.
Constraints
* 3 ≤ |s| ≤ 100 (|s| denotes ... | {
"input": [],
"output": []
} | {
"input": [
"smiles",
"internationalization",
"xyz"
],
"output": [
"s4s",
"i18n",
"x1z"
]
} | {
"input": [
"selims",
"intfrnationalization",
"xxz",
"smilet",
"noitazilanoitanrftni",
"xx{",
"stilem",
"ooitazilanoitanrftni",
"x{x",
"melits",
"w{x",
"melhtt",
"w{y",
"x|y",
"llfhtt",
"onilazitanojianrftot",
"y|x",
"tthfll",
"xz|",
"to... |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | {
"input": [],
"output": []
} | {
"input": [
"aabcdefghijklmnopqrstuvwxyz\n1\n1 27",
"yzyyyzyzyyyz\n8\n1 6\n7 12\n1 12\n6 11\n1 1\n1 3\n4 9\n3 8",
"axxxxza\n2\n1 7\n2 6"
],
"output": [
"Yes",
"Yes\nYes\nYes\nYes\nNo\nNo\nNo\nNo",
"No\nYes"
]
} | {
"input": [
"aabcdefghijklmnopqrstuvwxyz\n1\n2 27",
"yzyyyzyzyyyz\n8\n1 6\n9 12\n1 12\n6 11\n1 1\n1 3\n4 9\n3 8",
"axxxxza\n2\n1 7\n2 5",
"axxxxza\n2\n2 7\n2 6",
"yzyyyzyzyyyz\n8\n1 6\n7 12\n1 12\n0 11\n1 1\n1 3\n4 9\n3 8",
"yzyyyzyzyyyz\n8\n1 6\n9 12\n1 12\n0 11\n1 1\n1 3\n4 9\n3 8",
"zy... |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | {
"input": [],
"output": []
} | {
"input": [
"3 1 4",
"3 3 33"
],
"output": [
"3",
"2"
]
} | {
"input": [
"3 2 4",
"27 1 1",
"2 2 2",
"3 1 33",
"3 2 0",
"3 0 33",
"3 4 0",
"5 0 33",
"3 7 0",
"5 -1 33",
"3 10 0",
"5 -2 33",
"3 17 0",
"5 -2 1",
"3 17 -1",
"5 -4 1",
"3 12 -1",
"8 -4 1",
"6 12 -1",
"8 0 1",
"11 12 -1",
"14 0 ... |
p00053 Sum of Prime Numbers | Let p (i) be the i-th prime number from the smallest. For example, 7 is the fourth prime number from the smallest, 2, 3, 5, 7, so p (4) = 7.
Given n, the sum of p (i) from i = 1 to n s
s = p (1) + p (2) + .... + p (n)
Create a program that outputs. For example, when n = 9, s = 2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 ... | {
"input": [],
"output": []
} | {
"input": [
"2\n9\n0"
],
"output": [
"5\n100"
]
} | {
"input": [
"2\n2\n0",
"2\n17\n0",
"2\n7\n0",
"2\n0\n0",
"2\n14\n0",
"2\n10\n0",
"2\n11\n0",
"2\n22\n0",
"2\n15\n0",
"2\n5\n0",
"2\n18\n0",
"2\n1\n0",
"2\n24\n0",
"2\n12\n0",
"2\n3\n0",
"2\n13\n0",
"2\n8\n0",
"2\n16\n0",
"2\n6\n0",
"2\n4... |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | {
"input": [],
"output": []
} | {
"input": [
"bbw\nwbw\n+b+\nbwb\nwbw\nwbw\n0"
],
"output": [
"b\nNA"
]
} | {
"input": [
"bbw\nwbw\n+b+\nbwb\nwbx\nwbw\n0",
"bbw\nbww\n+b+\nbwb\nwbx\nwbw\n0",
"bbw\nwwb\n+a+\nbwb\nxbw\nwvb\n0",
"bbw\nwbw\n+b+\nbbw\nwcw\nbww\n0",
"bbw\nwcw\n+c+\nwbb\nwcw\nwwb\n0",
"cwb\nwwb\n++b\nbwb\nwbw\nxyb\n0",
"bbw\nwbw\n+b+\nbwb\nwcw\nwbw\n0",
"cbw\nwbw\n+b+\nbwb\nwbx\nwb... |
p00339 Game Strategy | You found an old board game in your programming department's room. It looks interesting so I decided to play with it.
This game consists of M events and you must capture event i at time ti. However, at that time your strength must be si or better, and if you can't be si or better, the game is over. Your strength is 0 ... | {
"input": [],
"output": []
} | {
"input": [
"5 4\n3 3\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n10 4\n12 30",
"5 4\n3 3\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n10 4\n12 17"
],
"output": [
"-1",
"2"
]
} | {
"input": [
"5 4\n3 3\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n10 4\n21 30",
"5 4\n3 6\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n10 4\n21 30",
"5 3\n2 3\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n10 4\n12 30",
"5 4\n3 6\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n10 4\n21 13",
"5 3\n2 3\n2 1\n1 5\n4 2\n2 6\n4 1\n8 2\n8 4\n12 30",
"5 3\n0... |
p00530 Bubble Sort | Bubble Sort
Bubble sort is one of the algorithms for sorting columns. Suppose you want to sort the sequence A of length N in ascending order. Bubble sort exchanges the positions of two adjacent numbers if the magnitude relationship is broken. This is done while scanning the sequence from the front. That is, if there i... | {
"input": [],
"output": []
} | {
"input": [
"5\n10\n3\n6\n8\n1"
],
"output": [
"0"
]
} | {
"input": [
"5\n10\n2\n6\n8\n1",
"5\n9\n1\n12\n8\n1",
"5\n9\n0\n12\n8\n1",
"5\n0\n2\n0\n2\n1",
"5\n1\n2\n-1\n3\n0",
"5\n9\n2\n6\n8\n1",
"5\n9\n1\n6\n8\n1",
"5\n9\n0\n12\n8\n0",
"5\n9\n0\n13\n8\n0",
"5\n6\n0\n13\n8\n0",
"5\n6\n1\n13\n8\n0",
"5\n6\n1\n13\n12\n0",
"5\... |
p00697 Jigsaw Puzzles for Computers | Ordinary Jigsaw puzzles are solved with visual hints; players solve a puzzle with the picture which the puzzle shows on finish, and the diverse patterns of pieces. Such Jigsaw puzzles may be suitable for human players, because they require abilities of pattern recognition and imagination.
On the other hand, "Jigsaw pu... | {
"input": [],
"output": []
} | {
"input": [
"6\nWwRR wwrg RRGb rGBG RGrb RrRg RGrg rgBB Wrgr\nRrGb WWGR rGgb Wbrg wgBb GgBg WbBG Wwwg WWGG\nRBbr Wrbr wGGG wggR WgGR WBWb WRgB wBgG WBgG\nwBrg rGgb WRrB WWbw wRRB RbbB WRrb wrbb WgrG\nWrwB WWww wRRB WGGb Wbbg WBgG WrbG Wrww RBgg\nWWgg RBrr Rggr RGBg Wbgr WGbg WBbr WGWB GGGg"
],
"output": [
... | {
"input": [
"6\nWwRR wwrg RRGb rGBG RGrb RrRg RGrg rgBB Wrgr\nRrGb WWGR rGgb Wbrg wgBb GgBg WbBG Wwwg WWGG\nRBbr Wrbr wGGG wggR WgGR WBWb WRgB wBgH WBgG\nwBrg rGgb WRrB WWbw wRRB RbbB WRrb wrbb WgrG\nWrwB WWww wRRB WGGb Wbbg WBgG WrbG Wrww RBgg\nWWgg RBrr Rggr RGBg Wbgr WGbg WBbr WGWB GGGg",
"6\nWwRR rwwg RR... |
p00838 Colored Cubes | There are several colored cubes. All of them are of the same size but they may be colored differently. Each face of these cubes has a single color. Colors of distinct faces of a cube may or may not be the same.
Two cubes are said to be identically colored if some suitable rotations of one of the cubes give identical l... | {
"input": [],
"output": []
} | {
"input": [
"3\nscarlet green blue yellow magenta cyan\nblue pink green magenta cyan lemon\npurple red blue yellow cyan green\n2\nred green blue yellow magenta cyan\ncyan green blue yellow magenta red\n2\nred green gray gray magenta cyan\ncyan green gray gray magenta red\n2\nred green blue yellow magenta cyan\nm... | {
"input": [
"3\nscarlet green blue yellow magenta cyan\nblue pink green magenta cyan lemon\npurple red blue yellow cyan green\n2\nred green blue yellow magenta cyan\ncyan green blue yellow magenta red\n2\nred green gray gray magenta cyan\ncyan green gray fray magenta red\n2\nred green blue yellow magenta cyan\nm... |
p00970 Emergency Evacuation | Emergency Evacuation
The Japanese government plans to increase the number of inbound tourists to forty million in the year 2020, and sixty million in 2030. Not only increasing touristic appeal but also developing tourism infrastructure further is indispensable to accomplish such numbers.
One possible enhancement on t... | {
"input": [],
"output": []
} | {
"input": [
"5 2 7\n1 1\n1 2\n1 3\n2 3\n2 4\n4 4\n5 2"
],
"output": [
"9"
]
} | {
"input": [
"5 2 7\n1 1\n1 2\n1 3\n2 3\n2 4\n4 0\n5 2",
"5 2 7\n1 1\n1 2\n1 3\n3 3\n2 4\n4 4\n5 2",
"5 6 5\n1 1\n1 3\n1 3\n2 3\n2 4\n4 0\n5 3",
"5 8 7\n2 1\n1 2\n1 3\n5 3\n2 7\n4 4\n5 2",
"5 8 7\n2 1\n1 2\n0 3\n5 3\n2 7\n4 4\n5 2",
"5 6 5\n0 1\n1 3\n1 3\n2 3\n2 4\n3 0\n5 2",
"5 3 3\n1 1\n... |
p01102 Almost Identical Programs | Almost Identical Programs
The programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two different inputs to be accepted as a correct solution. Each of the submissions should include the pr... | {
"input": [],
"output": []
} | {
"input": [
"print\"hello\";print123\nprint\"hello\";print123\nread\"B1input\";solve;output;\nread\"B2\";solve;output;\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"\"\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"faster\"program\"\n... | {
"input": [
"print\"hello\";print123\nprint\"hello\";print123\nread\"B1input\";solve;output;\nread\"B2\";solve;output;\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"#\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"faster\"program\"\nX... |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | {
"input": [],
"output": []
} | {
"input": [
"4\n0 1 0 9\n10 1 10 9\n1 0 9 0\n1 10 9 10\n2\n1.2 3.4 5.6 7.8\n5.6 3.4 1.2 7.8\n0"
],
"output": [
"Case 1: 36.24264\nCase 2: 16.84508"
]
} | {
"input": [
"4\n0 1 0 9\n10 1 10 9\n1 0 9 0\n1 10 9 10\n2\n1.2 3.4 5.766243403304967 7.8\n5.6 3.4 1.2 7.8\n0",
"4\n0 1 0 9\n10 1 10 9\n1 0 9 0\n1 10 9 10\n2\n1.2 3.4 5.766243403304967 7.8\n5.6 4.333234465483725 1.2 7.8\n0",
"4\n0 1 0 9\n10 1 10 9\n1 0 9 0\n1 10 9 4\n2\n1.2 3.4 5.766243403304967 7.8\n5.6 ... |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | {
"input": [],
"output": []
} | {
"input": [
"10 10\nS . . . . . . . . .\n. . . . . . . . . .\n. . . . 1 . . . . .\n. . . . . . . . . .\n. . . . . . . . . .\n. . . . . . . 3 . .\n. . . . . . . . . .\n. . . . . 4 . . . .\n. . . . . . . . . .\n2 . . . . . . . . G\n10 10\nS . . . . . 3 . . .\n. . 3 . . . . . . .\n. . . . 1 . . . . .\n. . . . . . 4... | {
"input": [
"10 10\nS . . . . . . . . .\n. . . . . . . . . .\n. . . . 1 . . . . .\n. . . . . . . . . .\n. . . . . . . . . .\n. . . . . . . 3 . .\n. . . . . . . . . .\n. . . . . 4 . . . .\n. . . . . . . . . .\n2 . . . . . . . . G\n10 10\nS . . . . . 3 . . .\n. . 3 . . . . . . .\n. . . . 1 . . . . .\n. . . . . . 4... |
p01555 FizzBuzz | FizzBuzz is a game in which integers of 1 or more are spoken in order according to the following rules.
* "Fizz" when divisible by 3
* "Buzz" when divisible by 5
* "FizzBuzz" when divisible by both 3 and 5
* At other times, that number
An example of the progress of the game is shown below.
1, 2, Fizz, 4, Buzz,... | {
"input": [],
"output": []
} | {
"input": [
"20",
"10000000000",
"1"
],
"output": [
"zzBuzz11Fizz1314Fizz",
"93FizzBuzz1418650796",
"12Fizz4BuzzFizz78Fiz"
]
} | {
"input": [
"8",
"10010000000",
"14",
"10010000001",
"13",
"10000000001",
"2",
"10000001001",
"4",
"3",
"10000000010",
"6",
"10010001000",
"25",
"10010010001",
"23",
"10000000011",
"11000001001",
"5",
"10010100000",
"11",
"100100... |
p01710 Website Tour | Problem Statement
You want to compete in ICPC (Internet Contest of Point Collection). In this contest, we move around in $N$ websites, numbered $1$ through $N$, within a time limit and collect points as many as possible. We can start and end on any website.
There are $M$ links between the websites, and we can move be... | {
"input": [],
"output": []
} | {
"input": [
"5 4 10\n4 3 1\n6 4 3\n3 2 4\n2 2 1\n8 5 3\n1 2\n2 3\n3 4\n4 5\n3 3 1000\n1000 1 100\n1 7 100\n10 9 100\n1 2\n2 3\n3 2\n1 0 5\n25 25 2\n1 0 25\n25 25 2\n5 5 100\n1 1 20\n1 1 20\n10 1 1\n10 1 1\n10 1 1\n1 2\n2 1\n3 4\n4 5\n5 3\n3 3 100\n70 20 10\n50 15 20\n90 10 10\n1 2\n2 2\n2 3\n0 0 0"
],
"outpu... | {
"input": [
"5 4 10\n4 3 1\n6 4 3\n3 2 4\n2 2 1\n8 5 3\n1 2\n2 3\n3 4\n4 5\n3 3 1000\n1000 1 100\n1 7 100\n10 9 100\n1 2\n2 3\n3 2\n1 0 5\n25 25 2\n1 0 25\n25 25 2\n5 5 100\n1 1 20\n1 1 20\n10 1 1\n10 1 1\n10 1 1\n1 2\n2 1\n3 4\n4 5\n5 3\n3 3 100\n70 20 10\n50 16 20\n90 10 10\n1 2\n2 2\n2 3\n0 0 0",
"5 4 10\... |
p01855 Checkered Pattern | Problem statement
There are rectangles with vertical and horizontal lengths of h and w, and square squares with a side length of 1 are spread inside. If the upper left cell is (0,0) and the cell to the right of j below (0,0) is represented as (i, j), (i, j) is i + j. If is even, it is painted red, and if it is odd, it... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 3\n3 3\n4 3"
],
"output": [
"1 1\n1 0\n1 1"
]
} | {
"input": [
"3\n1 3\n3 3\n4 3",
"3\n2 4\n3 3\n4 3",
"3\n2 4\n3 3\n3 3",
"3\n1 4\n3 2\n4 3",
"3\n2 4\n3 6\n3 3",
"3\n2 2\n3 2\n2 3",
"3\n4 4\n3 6\n3 3",
"3\n2 2\n4 2\n1 3",
"3\n1 3\n3 3\n4 4",
"3\n1 4\n3 7\n4 3",
"3\n1 5\n3 2\n3 3",
"3\n1 1\n3 3\n4 4",
"3\n1 5\n3 3\... |
p01990 Pivots | B: Pivots
problem
Given a permutation of length N, a_1, a_2, ..., a_N, which is a permutation of integers from 1 to N. Also, Q queries are given in order for this permutation. In the i-th query, you have to do the following:
* The value q_i (1 \ leq q_i \ leq N) is given. In the permutation \\ {a_1, a_2, ..., a_N \\... | {
"input": [],
"output": []
} | {
"input": [
"5 2\n1 5 3 2 4\n5 2"
],
"output": [
"4 5 1 2 3"
]
} | {
"input": [
"5 2\n1 5 3 2 4\n5 3",
"5 0\n1 5 3 2 4\n5 3",
"5 2\n1 5 3 2 4\n3 2",
"5 1\n1 5 3 2 4\n5 3",
"5 2\n1 5 3 2 4\n3 1",
"5 1\n1 5 3 2 4\n1 3",
"5 1\n1 5 3 2 4\n4 2",
"5 1\n1 5 3 2 4\n3 2",
"1 0\n1 5 3 2 4\n9 1",
"5 1\n1 5 3 2 4\n2 1",
"5 2\n1 5 3 2 4\n2 1",
"2 0... |
p02136 Manhattan Bomb | Problem
There are $ n $ bombs on a two-dimensional plane. Each bomb is numbered from 1 to $ n $, and the $ i $ th bomb is located at coordinates $ (x_i, y_i) $.
It is known that all bombs have the same Manhattan distance from the origin.
When the $ i $ th bomb explodes, the bombs that are within $ r_i $ in Manhattan f... | {
"input": [],
"output": []
} | {
"input": [
"2\n-1 -1 10\n1 1 1",
"3\n3 2 2\n4 -1 4\n1 -4 7"
],
"output": [
"0\n1",
"2\n1\n0"
]
} | {
"input": [
"2\n-1 -1 9\n1 1 1",
"3\n3 2 2\n4 -1 1\n1 -4 7",
"3\n3 2 2\n4 -1 1\n1 -4 4",
"3\n3 2 3\n3 -1 1\n0 -4 8",
"2\n-1 -1 3\n2 0 1",
"3\n3 0 3\n3 -1 1\n0 -4 8",
"3\n3 1 2\n3 -1 1\n0 -4 8",
"3\n0 2 2\n2 1 2\n0 -3 8",
"3\n0 2 5\n3 1 2\n0 -3 8",
"3\n3 2 2\n2 -1 4\n1 -4 7",
... |
p02277 Quick Sort | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode:
Partition(A, p, r)
1 x = A[r]
2 i = p-1
3 for j = p to r-1
4 do if A[j] <= x
5 then i = i+1
6 ... | {
"input": [],
"output": []
} | {
"input": [
"2\nS 1\nH 1",
"6\nD 3\nH 2\nD 1\nS 3\nD 2\nC 1"
],
"output": [
"Stable\nS 1\nH 1",
"Not stable\nD 1\nC 1\nD 2\nH 2\nD 3\nS 3"
]
} | {
"input": [
"6\nD 3\nH 2\nD 1\nS 3\nC 2\nC 1",
"6\nD 3\nH 2\nD 1\nS 3\nC 2\nC 2",
"6\nD 3\nH 2\nC 1\nS 3\nC 2\nC 2",
"6\nD 5\nH 2\nC 1\nS 3\nC 2\nC 2",
"6\nD 5\nH 2\nC 2\nS 3\nC 2\nC 2",
"6\nD 5\nH 0\nC 2\nS 3\nC 2\nC 1",
"2\nS 1\nH 2",
"6\nD 3\nH 2\nD 1\nS 3\nD 2\nC 0",
"6\nD 3\n... |
p02424 Bit Operation II | Given two non-negative decimal integers $a$ and $b$, calculate their AND (logical conjunction), OR (logical disjunction) and XOR (exclusive disjunction) and print them in binary representation of 32 bits.
Constraints
* $0 \leq a, b \leq 2^{32} - 1$
Input
The input is given in the following format.
$a \; b$
Outp... | {
"input": [],
"output": []
} | {
"input": [
"8 10"
],
"output": [
"00000000000000000000000000001000\n00000000000000000000000000001010\n00000000000000000000000000000010"
]
} | {
"input": [
"13 10",
"20 10",
"20 1",
"15 1",
"1 1",
"2 1",
"2 0",
"1 0",
"-1 1",
"-1 2",
"-1 4",
"-1 3",
"-1 0",
"-1 -1",
"0 0",
"1 3",
"2 3",
"4 0",
"4 -2",
"7 -2",
"0 -2",
"2 2",
"5 2",
"10 2",
"10 3",
"10 0",
... |
approx2 | You are given an array of N integers a1, a2, ..., aN and an integer K. Find the number of such unordered pairs {i, j} that
i ≠ j
|ai + aj - K| is minimal possible
Output the minimal possible value of |ai + aj - K| (where i ≠ j) and the number of such pairs for the given array and the integer K.
Input
The first lin... | {
"input": [],
"output": []
} | {
"input": [
"1 \n4 9\n4 4 2 6"
],
"output": [
"1 4\n"
]
} | {
"input": [
"1 \n4 14\n4 4 2 6",
"1 \n4 14\n4 1 2 6",
"1 \n4 14\n4 -1 2 11",
"1 \n4 14\n4 -1 0 11",
"1 \n4 14\n4 -1 0 7",
"1 \n4 14\n1 -1 0 7",
"1 \n4 26\n1 -1 0 7",
"1 \n4 14\n4 1 1 0",
"1 \n4 17\n4 0 2 6",
"1 \n4 14\n1 -1 0 4",
"1 \n4 51\n1 -1 -1 7"... |
cielnum2 | Recently, chef Ciel often hears about lucky numbers.
Everybody knows that lucky numbers are positive integers
whose decimal representation contains only the lucky digits 4 and 7.
For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Ciel decides to make Ciel numbers.
As you know, Ciel likes the digi... | {
"input": [],
"output": []
} | {
"input": [
"6\nmilk 58\nCiel's Drink 80\nThe curry 2nd edition 888888\nrice omelet 85855\nunagi 1\n The first and last letters can be a space 358"
],
"output": [
"3\n"
]
} | {
"input": [
"6\nmilk 58\nCiel's Drink 35\nThe curry 2nd edition 888888\nrice omelet 85855\nunagi 1\n The first and last letters can be a space 358",
"6\nmilk 64\nCsel'i Drink 35\nThf curry 2nd edition 888888\nrice omelet 85855\nunagi 1\n The first dna last letters can be a space 358",
"6\... |
exam | An exam consists of N questions. The marks of the N questions are m1, m2, m3, .. mN respectively.
Jam is giving the exam and he wants to maximise his number of marks.
However he takes some time to solve each question. The time taken by him to solve the questions are t1, t2, t3, .. tN respectively.
The exams lasts for a... | {
"input": [],
"output": []
} | {
"input": [
"3\n10\n1 2 3\n4 3 4"
],
"output": [
"8"
]
} | {
"input": [],
"output": []
} |
lastdig | For a non-negative integer N, define S(N) as the sum of the odd digits of N
plus twice the sum of the even digits of N.
For example, S(5)=5, S(456)=2*4+5+2*6=25, and S(314159)=3+1+2*4+1+5+9=27.
Define D(N) as the last digit of S(N).
So D(5)=5, D(456)=5, and D(314159)=7.
Given 2 non-negative integers A and B, compute th... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 8\n28 138\n314159 314159"
],
"output": [
"36\n495\n7\n"
]
} | {
"input": [
"3\n1 6\n28 138\n314159 314159",
"3\n1 6\n28 138\n314159 559966",
"3\n1 5\n28 138\n314159 559966",
"3\n1 5\n28 181\n314159 559966",
"3\n2 5\n28 181\n314159 559966",
"3\n1 8\n28 102\n314159 314159",
"3\n1 5\n28 181\n314159 486259",
"3\n2 5\n28 315\n314159 559966",
"3\n2... |
pd31 | You are given an unweighted, undirected graph. Write a program to check if it's a tree topology.
Input
The first line of the input file contains two integers N and M --- number of nodes and number of edges in the graph (0 < N ≤ 10000, 0 ≤ M ≤ 20000). Next M lines contain M edges of that graph --- Each line contains ... | {
"input": [],
"output": []
} | {
"input": [
"3 2\n1 2\n2 3"
],
"output": [
"YES\n"
]
} | {
"input": [
"3 2\n1 3\n2 3",
"3 2\n1 2\n1 3",
"3 2\n2 3\n1 3",
"3 2\n1 2\n3 1",
"3 2\n1 2\n3 2",
"1 0\n1 3\n1 3",
"1 0\n1 3\n2 3",
"1 0\n1 6\n2 3",
"3 2\n1 3\n3 2",
"1 0\n1 6\n1 3",
"3 2\n1 3\n2 1",
"1 0\n1 3\n1 4",
"1 0\n1 3\n2 2",
"1 0\n1 6\n3 3",
"1 0\n1... |
stepup | Statement
Given a directed graph G with N vertices and M edges. For each vertex u, you must assign positive integer F(u) such that:
For each edge e from a to b, F(b) > F(a)
The maximum value m = max( F(u) ) is minimized
Output the maximum value m. If no such assignment is possible output "IMPOSSIBLE" (quotes ... | {
"input": [],
"output": []
} | {
"input": [
"2\n2 2\n1 2\n2 1\n3 2\n1 2\n1 3\n\n\nSAMPLE"
],
"output": [
"IMPOSSIBLE\n2"
]
} | {
"input": [
"2\n2 2\n1 2\n2 1\n3 2\n1 2\n1 1\n\n\nSAMPLE",
"2\n2 2\n2 2\n2 1\n3 2\n1 2\n1 1\n\n\nSAMPLE",
"2\n2 2\n1 2\n2 1\n4 2\n1 1\n0 1\n\n\nSAMPLE",
"2\n2 2\n1 2\n2 0\n3 2\n1 1\n0 1\n\n\nSAMPLE",
"2\n2 2\n1 2\n2 0\n3 2\n2 1\n0 1\n\n\nSAMPLE",
"2\n2 2\n1 1\n2 2\n4 2\n1 2\n-1 2\n\n\nSAMPLE"... |
1184_C3. Heidi and the Turing Test (Hard) | The Cybermen have again outwitted the Daleks! Unfortunately, this time the Daleks decided to abandon these tasks altogether, which means the Doctor has to deal with them.
The Doctor can handle the Daleks on his own, but Heidi now has to make sure that the Cybermen are kept busy with this next task.
There are k rings ... | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} |
1305_A. Kuroni and the Gifts | Kuroni has n daughters. As gifts for them, he bought n necklaces and n bracelets:
* the i-th necklace has a brightness a_i, where all the a_i are pairwise distinct (i.e. all a_i are different),
* the i-th bracelet has a brightness b_i, where all the b_i are pairwise distinct (i.e. all b_i are different).
Kuro... | {
"input": [],
"output": []
} | {
"input": [
"2\n3\n1 8 5\n8 4 5\n3\n1 7 5\n6 1 2\n"
],
"output": [
"1 5 8\n4 5 8\n1 5 7\n1 2 6\n"
]
} | {
"input": [
"2\n3\n1 8 10\n8 4 5\n3\n1 7 5\n6 1 2\n",
"2\n3\n1 8 5\n8 4 5\n3\n1 7 5\n3 1 2\n",
"2\n3\n1 8 10\n8 4 5\n3\n1 7 5\n6 1 4\n",
"2\n3\n1 8 5\n8 8 5\n3\n1 7 5\n3 1 2\n",
"2\n3\n1 8 10\n15 4 5\n3\n1 7 5\n6 1 4\n",
"2\n3\n1 8 5\n8 8 5\n3\n1 7 3\n3 1 2\n",
"2\n3\n1 8 16\n15 4 5\n3\n1... |
1481_A. Space Navigation | You were dreaming that you are traveling to a planet named Planetforces on your personal spaceship. Unfortunately, its piloting system was corrupted and now you need to fix it in order to reach Planetforces.
<image>
Space can be represented as the XY plane. You are starting at point (0, 0), and Planetforces is locate... | {
"input": [],
"output": []
} | {
"input": [
"6\n10 5\nRRRRRRRRRRUUUUU\n1 1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n1 2\nLLLLUU\n3 -2\nRDULRLLDR\n-1 6\nRUDURUUUUR\n"
],
"output": [
"\nYES\nYES\nYES\nNO\nYES\nNO\n"
]
} | {
"input": [
"6\n10 5\nRRRRRRRRRRUUUUU\n1 1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n1 2\nUULLLL\n3 -2\nRDULRLLDR\n-1 6\nRUDURUUUUR\n",
"6\n10 5\nRRRRRRRRRRUUUUU\n1 1\nUDDDRLLL\n-5 -5\nLDLDLDDDR\n2 2\nUULLLL\n3 -1\nRDULRLLDR\n-1 6\nRUDURUUUUR\n",
"6\n10 5\nRRRRRRRRRRUUUUU\n1 1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n1 2\nUULLLL... |
1534_C. Little Alawn's Puzzle | When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n.
The goal of Little Alawn's puzzle is to make sure no numbers on the same column or ... | {
"input": [],
"output": []
} | {
"input": [
"2\n4\n1 4 2 3\n3 2 1 4\n8\n2 6 5 1 4 3 7 8\n3 8 7 5 1 2 4 6\n"
],
"output": [
"\n2\n8\n"
]
} | {
"input": [],
"output": []
} |
840_A. Leha and Function | Leha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation of the minimal element among all k-element subsets.
But only function does not interest him. He wan... | {
"input": [],
"output": []
} | {
"input": [
"5\n7 3 5 3 4\n2 1 3 2 3\n",
"7\n4 6 5 8 8 2 6\n2 1 2 2 1 1 2\n"
],
"output": [
"5 7 3 4 3 \n",
"6 8 5 4 8 6 2 \n"
]
} | {
"input": [
"5\n7 3 5 3 4\n2 1 3 2 0\n",
"7\n4 6 5 8 8 2 6\n2 1 2 3 1 1 2\n",
"5\n7 3 5 3 4\n2 0 3 2 0\n",
"7\n4 6 5 8 8 2 0\n2 1 2 3 1 1 2\n",
"5\n7 3 5 3 8\n2 0 3 2 0\n",
"7\n2 6 5 8 8 2 0\n2 1 2 3 1 1 2\n",
"5\n7 3 5 3 8\n2 0 0 2 0\n",
"7\n0 6 5 8 8 2 0\n2 1 2 3 1 1 2\n",
"5\n7... |
abhinav-and-manav | Abhinav and Manav both being one of the best coders of SVNIT went onto participate in ACM ICPC Regional Contest. Apparently Manav’s team the 3Horsemen stood ahead of Abhinav’s team akatsuki11 in the contest though both solved the same number of questions .Manav is Abhinav’s greatest rival and Abhinav being adamant abou... | {
"input": [],
"output": []
} | {
"input": [
"3\n3 7\n1 1\n8 10\n\nSAMPLE"
],
"output": [
"20\n8\n890"
]
} | {
"input": [
"3\n3 7\n1 1\n15 10\n\nSAMPLE",
"3\n3 7\n1 1\n15 17\n\nSAMPLE",
"3\n3 7\n1 1\n22 17\n\nSAMPLE",
"3\n3 7\n1 1\n26 17\n\nSAMPLE",
"3\n3 3\n1 1\n16 17\n\nELMPAS",
"3\n3 6\n1 1\n16 3\n\nELMOAS",
"3\n3 6\n1 1\n16 1\n\nELMOAS",
"3\n3 6\n0 0\n16 1\n\nELMOAS",
"3\n3 10\n1 1\n1... |
p02577 AtCoder Beginner Contest 176 - Multiple of 9 | An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.
Determine whether N is a multiple of 9.
Constraints
* 0 \leq N < 10^{200000}
* N is an integer.
Input
Input is given from Standard Input in the following format:
N
Output
If N is a multi... | {
"input": [],
"output": []
} | {
"input": [
"123456789",
"0",
"31415926535897932384626433832795028841971693993751058209749445923078164062862089986280"
],
"output": [
"Yes",
"Yes",
"No"
]
} | {
"input": [
"219738792",
"531603",
"1",
"54657569343041921475636299350747138782938284453807770660744571129118363583648327949663",
"255875192",
"2",
"44714514351114560666504103743698688639343869854180837286636073500514855668719638859404",
"74334085",
"3",
"888125506064215474931... |
p02708 AtCoder Beginner Contest 163 - Sum of Large Numbers | We have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.
We will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).
Constraints
* 1 \leq N \leq 2\times 10^5
* 1 \leq K \leq N+1
* All values in input are integers.
Input
Input is given from S... | {
"input": [],
"output": []
} | {
"input": [
"141421 35623",
"200000 200001",
"3 2"
],
"output": [
"220280457",
"1",
"10"
]
} | {
"input": [
"141421 60408",
"206306 200001",
"3 1",
"10931 60408",
"107814 81103",
"3981 3277",
"6048 4398",
"10232 4398",
"1001 598",
"1001 546",
"1001 945",
"1000 945",
"1 1",
"1100 770",
"1101 770",
"1100 130",
"1000 130",
"1000 230",
"10... |
p02837 AtCoder Beginner Contest 147 - HonestOrUnkind2 | There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.
Person i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony say... | {
"input": [],
"output": []
} | {
"input": [
"3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0",
"3\n1\n2 1\n1\n1 1\n1\n2 0",
"2\n1\n2 0\n1\n1 0"
],
"output": [
"0",
"2",
"1"
]
} | {
"input": [
"3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 -1",
"2\n1\n2 0\n1\n1 1",
"3\n1\n3 1\n1\n1 1\n1\n2 0",
"3\n1\n3 1\n1\n1 1\n0\n2 0",
"3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 0\n2 0",
"3\n1\n1 1\n1\n1 1\n0\n2 0",
"3\n2\n2 0\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0",
"3\n1\n2 1\n1\n2 1\n1\n2 0",
... |
p02974 AtCoder Beginner Contest 134 - Permutation Oddness | Let us define the oddness of a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n} as \sum_{i = 1}^n |i - p_i|.
Find the number of permutations of {1,\ 2,\ ...,\ n} of oddness k, modulo 10^9+7.
Constraints
* All values in input are integers.
* 1 \leq n \leq 50
* 0 \leq k \leq n^2
Input
Input is given from... | {
"input": [],
"output": []
} | {
"input": [
"39 14",
"3 2"
],
"output": [
"74764168",
"2"
]
} | {
"input": [
"39 23",
"3 0",
"31 14",
"6 2",
"47 12",
"31 12",
"5 2",
"47 22",
"27 12",
"12 2",
"3 4",
"39 16",
"4 4",
"31 2",
"5 12",
"39 2",
"44 16",
"9 2",
"10 12",
"19 2",
"12 4",
"44 26",
"33 2",
"19 4",
"20 26",
... |
p03110 AtCoder Beginner Contest 119 - Digital Gifts | Takahashi received otoshidama (New Year's money gifts) from N of his relatives.
You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative.
For example, if x_1 = `10000` a... | {
"input": [],
"output": []
} | {
"input": [
"2\n10000 JPY\n0.10000000 BTC",
"3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC"
],
"output": [
"48000.0",
"138000000.0038"
]
} | {
"input": [
"2\n00000 JPY\n0.10000000 BTC",
"2\n00000 JPY\n0.7411383442474536 BTC",
"2\n10000 JPY\n0.7411383442474536 BTC",
"2\n01000 JPY\n0.10000000 BTC",
"2\n00010 JPY\n0.7411383442474536 BTC",
"2\n10000 JPY\n1.729349410778393 BTC",
"2\n10000 JPY\n0.17314902569100102 BTC",
"3\n10000... |
p03257 AtCoder Grand Contest 027 - Modulo Matrix | You are given an integer N.
Construct any one N-by-N matrix a that satisfies the conditions below. It can be proved that a solution always exists under the constraints of this problem.
* 1 \leq a_{i,j} \leq 10^{15}
* a_{i,j} are pairwise distinct integers.
* There exists a positive integer m such that the following h... | {
"input": [],
"output": []
} | {
"input": [
"2"
],
"output": [
"4 7\n23 10"
]
} | {
"input": [
"3",
"4",
"1",
"5",
"9",
"6",
"8",
"14",
"11",
"7",
"10",
"12",
"13",
"16",
"22",
"25",
"30",
"27",
"29",
"35",
"31",
"20",
"55",
"18",
"40",
"97",
"24",
"37",
"42",
"53",
"66",
... |
p03413 AtCoder Regular Contest 092 - Both Sides Merger | You have an integer sequence of length N: a_1, a_2, ..., a_N.
You repeatedly perform the following operation until the length of the sequence becomes 1:
* First, choose an element of the sequence.
* If that element is at either end of the sequence, delete the element.
* If that element is not at either end of the seq... | {
"input": [],
"output": []
} | {
"input": [
"5\n1 4 3 7 5",
"6\n-1 -2 -3 1 2 3",
"4\n100 100 -1 100",
"9\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"
],
"output": [
"11\n3\n1\n4\n2",
"4\n3\n2\n1\n2",
"200\n2\n3\n1",
"5000000000\n4\n2\n2\n2\n2"
]
} | {
"input": [
"5\n1 5 3 7 5",
"6\n-1 -2 -1 1 2 3",
"4\n110 100 -1 100",
"9\n1000000000 1000000000 1001000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000",
"4\n110 100 -1 000",
"5\n0 5 3 10 2",
"6\n-1 -1 -1 1 2 5",
"4\n110 100 -1 011",
"9\n1000001000 1000000000 ... |
p03573 AtCoder Beginner Contest 075 - One out of Three | You are given three integers, A, B and C.
Among them, two are the same, but the remaining one is different from the rest.
For example, when A=5,B=7,C=5, A and C are the same, but B is different.
Find the one that is different from the rest among the given three integers.
Constraints
* -100 \leq A,B,C \leq 100
* A, B ... | {
"input": [],
"output": []
} | {
"input": [
"5 7 5",
"-100 100 100",
"1 1 7"
],
"output": [
"7",
"-100",
"7"
]
} | {
"input": [
"5 8 5",
"5 14 5",
"1 1 4",
"5 13 5",
"1 1 5",
"5 9 5",
"5 12 5",
"5 6 5",
"1 1 15",
"5 16 5",
"1 1 25",
"1 1 40",
"0 0 7",
"1 1 3",
"1 1 2",
"5 18 5",
"1 1 46",
"5 29 5",
"1 1 55",
"-25 100 100",
"5 0 5",
"1 1 72",
... |
p03728 AtCoder Grand Contest 014 - Strange Sorting | Takahashi loves sorting.
He has a permutation (p_1,p_2,...,p_N) of the integers from 1 through N. Now, he will repeat the following operation until the permutation becomes (1,2,...,N):
* First, we will define high and low elements in the permutation, as follows. The i-th element in the permutation is high if the maxi... | {
"input": [],
"output": []
} | {
"input": [
"10\n2 10 5 7 3 6 4 9 8 1",
"5\n5 4 3 2 1",
"5\n3 5 1 2 4"
],
"output": [
"6",
"4",
"3"
]
} | {
"input": [
"5\n5 4 3 2 2",
"5\n5 8 3 2 1",
"10\n2 10 5 2 3 6 4 9 8 1",
"10\n2 10 5 7 2 6 4 9 8 1",
"5\n5 2 3 3 1",
"10\n2 10 5 7 2 8 4 9 16 1",
"10\n2 10 5 7 4 6 4 7 8 1",
"5\n2 5 1 2 4",
"5\n5 5 3 2 2",
"5\n5 3 3 2 1",
"5\n5 2 3 2 2",
"5\n5 3 3 2 2",
"5\n5 2 3 2 ... |
p03892 CODE FESTIVAL 2016 Relay (Parallel) - Segment on Grid Paper | Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the lower left corner of square (C, D), find the number of the squares cro... | {
"input": [],
"output": []
} | {
"input": [
"1 1 3 4",
"2 3 10 7"
],
"output": [
"4",
"8"
]
} | {
"input": [
"1 2 3 4",
"3 3 10 7",
"1 2 6 4",
"3 3 10 5",
"6 3 10 5",
"1 0 11 4",
"1 0 15 4",
"6 6 3 5",
"1 1 15 2",
"6 16 3 5",
"9 16 4 5",
"2 1 24 -1",
"14 16 4 7",
"2 0 26 -1",
"2 0 1 -1",
"14 16 0 8",
"32 16 0 4",
"32 6 0 4",
"32 6 -1 4"... |
p04051 AtCoder Grand Contest 001 - BBQ Hard | Snuke is having another barbeque party.
This time, he will make one serving of Skewer Meal.
He has a stock of N Skewer Meal Packs. The i-th Skewer Meal Pack contains one skewer, A_i pieces of beef and B_i pieces of green pepper. All skewers in these packs are different and distinguishable, while all pieces of beef an... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 1\n1 1\n2 1"
],
"output": [
"26"
]
} | {
"input": [
"3\n1 0\n1 1\n2 1",
"3\n1 0\n2 1\n2 1",
"3\n1 0\n2 1\n1 0",
"3\n1 0\n2 1\n2 0",
"3\n1 2\n1 1\n2 1",
"3\n2 0\n1 1\n2 1",
"3\n1 0\n2 1\n2 2",
"3\n1 1\n2 1\n1 1",
"3\n1 0\n0 1\n2 0",
"3\n2 0\n1 1\n3 1",
"3\n2 1\n2 1\n1 1",
"3\n0 2\n1 1\n0 1",
"3\n3 1\n2 1\... |
p00130 Train | There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor patrolls back and forth in the train, so he may pass through the same ... | {
"input": [],
"output": []
} | {
"input": [
"4\na->e->c->b->d\nb",
"4\na->e->c->b->d\nb<-c<-a<-d<-e\nb->a->c<-a->c->d<-c<-a<-b->a->c->d->e<-d\na->e<-a<-d->a->e<-a<-d<-c->d->a<-d<-c<-b->c->d<-c"
],
"output": [
"aecbd\nedacb\nbacde\nbcdae",
"aecbd\nedacb\nbacde\nbcdae"
]
} | {
"input": [
"4\na->f->c->b->d\nb",
"4\na->e->c->b->d\na",
"4\na->f->c->b->d\na",
"4\na->f->c->b->d\n`",
"4\na->e->c->b->d\nc",
"4\na->f->c->b->d\nc",
"4\n`->f->c->b->d\nc",
"4\n`->f->c->b->d\nd",
"4\na->e->c->b->d\nd",
"4\na->e->c->b->d\n`",
"4\na->f->c->b->d\n_",
"4\n... |
p00263 Kongo Type | Consider a 32-bit real type with 7 bits from the right as the decimal part, the following 24 bits as the integer part, and the leftmost 1 bit as the sign part as shown below (b1, ..., b32). Represents 0 or 1).
<image>
To translate this format into a decimal representation that is easy for humans to understand, inter... | {
"input": [],
"output": []
} | {
"input": [
"8\n00000000\n80000000\n00000080\n00000040\n000000c0\n00000100\n80000780\n80000f70"
],
"output": [
"0.0\n-0.0\n1.0\n0.5\n1.5\n2.0\n-15.0\n-30.875"
]
} | {
"input": [
"8\n00000000\n80000000\n00000080\n00000040\n000000c0\n00000100\n15330257\n80000f70",
"8\n00000000\n80000000\n00000080\n00000040\n000000c0\n00000100\n21251916\n80000f70",
"8\n00000100\n80000000\n00000080\n00000040\n000000c0\n00000100\n21251916\n80000f70",
"8\n00000100\n80000000\n00000080\n... |
p00450 Setting Go Stones | problem
Play by arranging white and black stones on the table. First, place the stones on the left edge of the table. Then place the stones in the second place from the left. Repeat this n times to arrange n stones in a horizontal row. However, when placing a new i-th go stone, replace the go stone on the table accord... | {
"input": [],
"output": []
} | {
"input": [
"8\n1\n0\n1\n1\n0\n0\n0\n0\n8\n1\n0\n1\n1\n0\n0\n0\n1\n0"
],
"output": [
"6\n2"
]
} | {
"input": [
"8\n1\n1\n1\n1\n0\n0\n0\n0\n8\n1\n0\n1\n1\n0\n0\n0\n1\n0",
"8\n1\n1\n1\n1\n0\n0\n0\n0\n8\n1\n0\n0\n1\n0\n0\n0\n1\n0",
"8\n1\n0\n1\n1\n0\n0\n0\n0\n4\n1\n0\n1\n1\n0\n0\n0\n1\n0",
"8\n1\n0\n1\n1\n0\n0\n0\n0\n2\n1\n0\n1\n1\n0\n0\n-1\n1\n0",
"8\n0\n0\n1\n1\n0\n0\n0\n0\n2\n1\n0\n2\n1\n0\n0\... |
p00641 Huge Family | Mr. Dango's family has extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in near future. They all have warm and gracious personality and are close each other.
They usually communicate by a phone... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 1 2 3\n0 1 2 2\n1 2 0 3\n7\n1 2 2 1\n0 2 3 2\n0 1 3 1\n2 1 1 2\n5 3 6 2\n4 3 6 1\n4 2 5 1\n0"
],
"output": [
"1\n2"
]
} | {
"input": [
"3\n1 1 2 3\n0 1 2 2\n1 2 0 3\n7\n1 2 2 1\n0 2 3 2\n0 1 3 1\n2 1 1 2\n5 3 4 2\n4 3 6 1\n4 2 5 1\n0",
"3\n1 2 2 3\n0 1 2 2\n1 2 0 3\n7\n1 2 0 1\n0 2 3 1\n0 0 3 1\n2 1 1 2\n5 3 4 2\n4 3 6 0\n4 -1 5 1\n0",
"3\n1 2 2 3\n0 1 2 2\n1 2 0 3\n7\n1 2 0 1\n0 2 3 2\n0 0 3 2\n2 2 1 2\n5 3 4 2\n4 3 6 1\n4 ... |
p00784 Pipeline Scheduling | An arithmetic pipeline is designed to process more than one task simultaneously in an overlapping manner. It includes function units and data paths among them. Tasks are processed by pipelining: at each clock, one or more units are dedicated to a task and the output produced for the task at the clock is cascading to th... | {
"input": [],
"output": []
} | {
"input": [
"7\nX...XX.\n.X.....\n..X....\n...X...\n......X\n0"
],
"output": [
"34"
]
} | {
"input": [
"7\nX...XX.\n.X.....\n..X/...\n...X...\n......X\n0",
"7\nX...XX.\n.X.....\n..X/...\n...X...\n.-....X\n0",
"7\nX...XX.\n.X.....\n..X...-\n...X...\n......X\n0",
"7\nX...XX.\n.X.....\n..X/...\n./.X...\n......X\n0",
"7\nX...XX.\n.X.....\n..X...-\n..-X...\n......X\n0",
"7\nX...XX.\n.X.... |
p00917 Clock Hands | We have an analog clock whose three hands (the second hand, the minute hand and the hour hand) rotate quite smoothly. You can measure two angles between the second hand and two other hands.
Write a program to find the time at which "No two hands overlap each other" and "Two angles between the second hand and two other... | {
"input": [],
"output": []
} | {
"input": [
"12 0 0 0\n12 11 59 59\n12 1 56 0\n12 1 56 3\n12 1 56 34\n12 3 9 43\n12 3 10 14\n12 7 17 58\n12 7 18 28\n12 7 23 0\n12 7 23 31\n2 0 38 29\n2 0 39 0\n2 0 39 30\n2 1 6 20\n2 1 20 1\n2 1 20 31\n3 2 15 0\n3 2 59 30\n4 0 28 48\n5 1 5 40\n5 1 6 10\n5 1 7 41\n11 0 55 0\n0 0 0 0"
],
"output": [
"0 0 ... | {
"input": [
"12 0 0 0\n12 11 59 59\n12 1 56 0\n12 1 56 3\n12 1 56 34\n12 3 9 43\n12 3 10 14\n12 7 17 58\n12 7 18 28\n12 7 23 0\n12 7 23 31\n2 0 38 29\n2 0 39 0\n2 0 39 30\n2 1 6 20\n2 1 20 1\n2 1 20 31\n3 2 15 0\n3 2 59 30\n4 0 28 48\n5 1 5 37\n5 1 6 10\n5 1 7 41\n11 0 55 0\n0 0 0 0",
"12 0 0 0\n12 11 59 59\... |
p01050 String Compression | Problem
Given the string S, which consists of lowercase letters and numbers. Follow the steps below to compress the length of string S.
1. Change the order of the characters in the character string to any order.
Example: "0ig3he12fz99"-> "efghiz012399"
2. Perform the following operations any number of times.
* Sele... | {
"input": [],
"output": []
} | {
"input": [
"0ig3he12fz99",
"1122334455"
],
"output": [
"9",
"6"
]
} | {
"input": [
"0ig3hd12fz99",
"0hg3hd12fz99",
"833453334",
"2336078995",
"1437005866",
"4037065",
"15423151",
"8181",
"111",
"0hg3hd13fz99",
"90",
"2",
"1496009822",
"0hf3hd12fz99",
"1173329527",
"99zf21dh3fh0",
"0hfdh312fz99",
"1810014501",
"... |
p01182 Restaurant | Steve runs a small restaurant in a city. Also, as he is the only cook in his restaurant, he cooks everything ordered by customers.
Basically he attends to orders by first-come-first-served principle. He takes some prescribed time to prepare each dish. As a customer can order more than one dish at a time, Steve starts ... | {
"input": [],
"output": []
} | {
"input": [
"5 4\nRamen 3 10\nChahan 5 5\nGyoza 5 10\nRice 1 1\nSoup 1 1\n5 2 Ramen Gyoza\n10 6 Chahan Gyoza Soup Ramen Gyoza Rice\n20 1 Chahan\n25 1 Ramen\n0 0"
],
"output": [
"25\n42\n40\n35"
]
} | {
"input": [
"5 4\nRamen 3 10\nChahan 5 5\nGyoza 5 10\nRice 1 1\nSoup 1 1\n0 2 Ramen Gyoza\n10 6 Chahan Gyoza Soup Ramen Gyoza Rice\n20 1 Chahan\n25 1 Ramen\n0 0",
"5 4\nRamen 3 10\nChahan 5 5\nGyoza 5 10\nRice 1 2\nSoup 1 1\n0 2 Ramen Gyoza\n10 6 Chahan Gyoza Soup Ramen Gyoza Rice\n20 1 Chahan\n25 1 Ramen\n0... |
p01319 Canal: Water Going Up and Down | ACM countries have rivers that flow from east to west in the center. This river flows from the neighboring country in the west through the neighboring country in ACM to the neighboring country in the east, and the total length in ACM is K km. It is planned to install several locks on this river and use it as a canal.
... | {
"input": [],
"output": []
} | {
"input": [
"1 1 100\n50 200 20 40 0\n1\n2 4 100\n7 4 1 4 1\n19 5 1 4 0\n5\n3\n7\n9\n1 2 3\n1 1 1 1 0\n1\n3\n1 2 10\n5 10 1 1 1\n2\n3\n0 0 0"
],
"output": [
"110\n46.6666666667\n5\n41.6666666667"
]
} | {
"input": [
"1 1 100\n50 200 20 40 0\n1\n2 4 101\n7 4 1 4 1\n19 5 1 4 0\n5\n3\n7\n9\n1 2 3\n1 1 1 1 0\n1\n3\n1 2 10\n5 10 1 1 1\n2\n3\n0 0 0",
"1 1 100\n50 200 20 40 0\n1\n2 4 101\n7 4 1 4 1\n19 5 1 4 0\n5\n3\n7\n9\n1 2 3\n2 1 1 1 0\n1\n3\n1 2 10\n5 10 1 1 1\n2\n3\n0 0 0",
"1 1 100\n50 200 20 40 0\n1\n2 ... |
p01487 RabbitWalking | Example
Input
8 5
1 2
6 5
6 4
1 3
4 7
Output
11 | {
"input": [],
"output": []
} | {
"input": [
"8 5\n1 2\n6 5\n6 4\n1 3\n4 7"
],
"output": [
"11"
]
} | {
"input": [
"8 5\n1 2\n8 5\n6 4\n1 3\n4 7",
"8 5\n1 2\n8 5\n6 4\n2 2\n4 7",
"15 5\n1 2\n8 5\n8 4\n1 4\n2 7",
"8 3\n1 2\n8 5\n6 4\n2 3\n4 7",
"8 8\n2 3\n8 5\n6 4\n1 3\n6 8",
"10 2\n2 3\n4 1\n6 7\n1 1\n12 0",
"8 2\n4 3\n4 1\n12 7\n1 1\n12 0",
"8 0\n4 3\n4 1\n12 7\n1 1\n12 0",
"4 0\n... |
p01649 Billiard | Problem Statement
You have a billiard table. The playing area of the table is rectangular. This billiard table is special as it has no pockets, and the playing area is completely surrounded with a cushion.
You succeeded in producing a ultra-precision billiards playing robot. When you put some balls on the table, the ... | {
"input": [],
"output": []
} | {
"input": [
"3\n26 16 1 8 4\n10 6\n9 2\n9 10\n3\n71 363 4 8 0\n52 238\n25 33\n59 288\n0"
],
"output": [
"3\n-1"
]
} | {
"input": [
"3\n26 16 1 8 4\n10 6\n9 2\n9 10\n3\n71 363 4 8 0\n52 238\n25 60\n59 288\n0",
"3\n26 16 1 8 0\n10 6\n9 2\n10 10\n3\n69 366 4 8 0\n52 238\n47 60\n100 288\n0",
"3\n26 16 1 8 4\n5 5\n9 2\n9 10\n3\n71 363 4 8 0\n52 238\n25 33\n59 288\n0",
"3\n26 27 1 13 0\n10 6\n9 2\n11 5\n3\n69 323 8 8 -1\n5... |
p01800 Runner and Sniper | Example
Input
100 100 0 1
Output
1.16699564 | {
"input": [],
"output": []
} | {
"input": [
"100 100 0 1"
],
"output": [
"1.16699564"
]
} | {
"input": [
"110 100 0 1",
"100 100 1 1",
"101 100 1 1",
"101 000 1 1",
"101 000 0 1",
"101 100 0 1",
"101 000 0 0",
"000 110 0 1",
"000 100 0 1",
"010 100 0 1",
"010 101 0 1",
"010 100 -1 1",
"100 100 0 2",
"111 100 0 1",
"100 100 2 1",
"101 110 1 1",
... |
p01934 Dimension travel | problem
Dimension exists from $ 1 $ dimension to $ N $ dimension. AOR Ika can move between dimensions. Specifically, when AOR Ika is in the $ i $ dimension, she can move freely to the $ j $ dimension ($ i> j $), but in the $ k $ dimension ($ i <k $). You need to use magic to move to.
AOR Ika can use $ M $ types of ma... | {
"input": [],
"output": []
} | {
"input": [
"3 1 2 3\n1 2 3\n1 3"
],
"output": [
"3"
]
} | {
"input": [
"3 1 2 3\n1 2 2\n1 3",
"3 1 2 3\n1 0 1\n2 3",
"3 1 1 3\n1 2 3\n1 3",
"3 1 1 3\n1 2 0\n1 3",
"3 1 2 3\n1 2 5\n1 3",
"3 1 2 3\n1 0 4\n1 3",
"3 1 2 3\n1 1 6\n1 3",
"3 1 2 3\n1 2 8\n1 3",
"3 1 2 3\n1 2 7\n1 3",
"3 1 2 3\n0 -1 10\n1 3",
"3 1 2 3\n1 2 9\n1 3",
"3... |
p02072 All your base are belong to us | Problem Statement
In A.D. 2101, war was beginning. The enemy has taken over all of our bases. To recapture the bases, we decided to set up a headquarters. We need to define the location of the headquarters so that all bases are not so far away from the headquarters. Therefore, we decided to choose the location to mini... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
p02215 Xor Array | Problem statement
Given the integers $ N $ and $ X $. Find the remainder by dividing the number of sequences of length $ N $ that satisfy the following conditions by $ 998244353 $.
* The sequence is a monotonous increase in a broad sense.
* Each element of the sequence is greater than or equal to $ 0 $ and less than ... | {
"input": [],
"output": []
} | {
"input": [
"2 3"
],
"output": [
"2"
]
} | {
"input": [
"2 1",
"4 1",
"8 1",
"6 1",
"6 2",
"7 2",
"10 1",
"6 3",
"5 4",
"0 1",
"12 3",
"5 7",
"16 3",
"5 8",
"24 3",
"10 4",
"10 6",
"4 7",
"4 5",
"8 5",
"15 2",
"4 9",
"16 1",
"12 2",
"18 1",
"6 6",
"4 6"... |
p02368 Strongly Connected Components | A direced graph is strongly connected if every two nodes are reachable from each other. In a strongly connected component of a directed graph, every two nodes of the component are mutually reachable.
Constraints
* 1 ≤ |V| ≤ 10,000
* 0 ≤ |E| ≤ 30,000
* 1 ≤ Q ≤ 100,000
Input
A directed graph G(V, E) and a sequence of... | {
"input": [],
"output": []
} | {
"input": [
"5 6\n0 1\n1 0\n1 2\n2 4\n4 3\n3 2\n4\n0 1\n0 3\n2 3\n3 4"
],
"output": [
"1\n0\n1\n1"
]
} | {
"input": [
"5 6\n0 1\n1 0\n0 2\n2 4\n4 3\n3 2\n4\n0 1\n0 3\n2 3\n3 4",
"5 6\n0 1\n1 0\n1 2\n2 4\n4 3\n3 2\n4\n0 1\n0 3\n2 0\n3 4",
"5 6\n0 1\n1 0\n1 2\n2 4\n4 0\n3 2\n4\n0 1\n0 3\n2 0\n3 4",
"5 6\n0 1\n1 0\n1 2\n2 4\n1 1\n3 2\n4\n0 1\n0 3\n2 0\n3 4",
"7 6\n0 1\n1 0\n1 2\n2 4\n4 3\n3 2\n4\n1 2\n0... |
buycar | Walter white wants to buy a car, he does not care much about the type of car (sedan/hatchback/SUV) nor the power that the car has,
all he cares about is how much the car will cost him, since he has loads of money , he wants to buy the most expensive car available in the market, but there is a catch!
The tax percentages... | {
"input": [],
"output": []
} | {
"input": [
"2\n3\nFerrari $100000 20%\nPorsche $200000 10%\nLamborghini $300000 10%\n2\nBMW $20000 50%\nBenz $15000 100%"
],
"output": [
"Lamborghini\nBMW"
]
} | {
"input": [],
"output": []
} |
conflip | Little Elephant was fond of inventing new games. After a lot of research, Little Elephant came to know that most of the animals in the forest were showing less interest to play the multi-player games.Little Elephant had started to invent single player games, and succeeded in inventing the new single player game named C... | {
"input": [],
"output": []
} | {
"input": [
"1\n2\n1 5 1\n1 5 2"
],
"output": [
"2\n3\n"
]
} | {
"input": [
"1\n2\n1 1 1\n1 5 2",
"1\n2\n1 1 1\n1 5 1",
"1\n2\n1 1 1\n1 7 2",
"1\n2\n2 1 1\n1 7 2",
"1\n2\n1 1 1\n1 2 1",
"1\n2\n1 2 1\n1 5 2",
"1\n1\n1 1 1\n1 5 1",
"1\n1\n1 1 2\n1 1 2",
"1\n2\n1 5 1\n1 5 1",
"1\n2\n1 1 2\n1 1 2",
"1\n1\n1 4 2\n1 1 2",
"1\n1\n1 -1 1\n... |
gerald04 | Problem Statement
One day Chef is waiting his girlfriend on the bus station. The girlfriend said that she will be at time1. Chef went to the bus station at time2. When Chef has reached the bus station he realized that he forgot a gift for his better half in his home.
Chef knows that someone can reach his home in dist m... | {
"input": [],
"output": []
} | {
"input": [
"3\n10:00\n09:00\n10\n10:00\n09:00\n30\n10:00\n09:00\n60"
],
"output": [
"70.0 60.0\n90.0 60.0\n120.0 90.0\n"
]
} | {
"input": [
"3\n10:00\n09:00\n10\n10:00\n09:00\n30\n10:00\n09:00\n12",
"3\n10:00\n09:00\n10\n10:00\n09:00\n48\n10:00\n09:00\n60",
"3\n10:01\n09:00\n10\n10:00\n09:00\n48\n10:00\n09:00\n60",
"3\n10:00\n09:00\n10\n10:00\n08:00\n48\n10:00\n09:00\n60",
"3\n10:00\n09:00\n11\n10:00\n08:00\n48\n10:00\n09... |
makeart | Chef's new hobby is painting, but he learned the fact that it's not easy to paint 2D pictures in a hard way, after wasting a lot of canvas paper, paint and of course time. From now on, he decided to paint 1D pictures only.
Chef's canvas is N millimeters long and is initially all white. For simplicity, colors will be re... | {
"input": [],
"output": []
} | {
"input": [
"3\n4\n1 5 5 5\n4\n1 1 1 5\n3\n5 5 2"
],
"output": [
"Yes\nYes\nNo\n"
]
} | {
"input": [
"3\n4\n1 5 5 5\n3\n1 1 1 5\n3\n5 5 2",
"3\n4\n1 5 5 5\n3\n1 2 1 5\n3\n5 5 2",
"3\n4\n1 10 5 5\n3\n1 2 1 5\n3\n1 1 3",
"3\n4\n1 5 5 6\n4\n1 1 1 5\n3\n5 5 2",
"3\n4\n1 5 5 5\n3\n1 2 1 5\n3\n5 5 3",
"3\n4\n1 5 5 5\n3\n1 2 1 5\n3\n5 1 3",
"3\n4\n1 5 5 5\n3\n1 2 1 5\n3\n1 1 3",
... |
psudo4 | In the fest of Paradigm, every organiser is given a special kind of pager. The pager consists of a screen and a single big red button. To type a message in it, one has to push the red button that many time at which the alphabet occurs in the alphabetical order. For example for typing D, one needs to push button 4 times... | {
"input": [],
"output": []
} | {
"input": [
"2\nA\nAB"
],
"output": [
"1\n3"
]
} | {
"input": [],
"output": []
} |
timeasr | Chef is sitting in a very boring lecture, waiting for it to end. He has recently asked his friend about the time, and instead of the straightforward answer, his friend, being an absolute jerk, told him the absolute value of angle between hour and minute hands.
But that is obviously not what he wanted to know, so he a... | {
"input": [],
"output": []
} | {
"input": [
"2\n0\n30"
],
"output": [
"00:00\n01:00\n11:00\n"
]
} | {
"input": [
"2\n1\n30",
"2\n2\n30",
"2\n2\n41",
"2\n2\n54",
"2\n4\n54",
"2\n4\n13",
"2\n7\n13",
"2\n7\n26",
"2\n11\n26",
"2\n0\n26",
"2\n1\n37",
"2\n2\n21",
"2\n1\n41",
"2\n0\n54",
"2\n4\n56",
"2\n4\n11",
"2\n2\n13",
"2\n2\n26",
"2\n11\n1",
... |
1170_I. Good Subsets | You are given n segments on the Ox axis. The i-th segment is given as a pair l_i, r_i, where l_i is the position of the left end of the i-th segment and r_i is the position of the right end of the i-th segment. Segments may intersect, overlap, or even coincide. A segment is a set of numbers (including floating-point nu... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 1\n2 6\n1 6\n",
"2\n3 4\n2 5\n",
"4\n1 2\n5 5\n2 3\n1 3\n"
],
"output": [
"\n4\n",
"\n2\n",
"\n5\n"
]
} | {
"input": [],
"output": []
} |
1250_F. Data Center | You are developing a project to build a new data center. The data center will be a rectangle with an area of exactly n square meters. Each side of the data center must be an integer.
Your goal is to minimize the impact of the external environment on the data center. For this reason, you want to minimize the length of ... | {
"input": [],
"output": []
} | {
"input": [
"36\n",
"13\n",
"1\n"
],
"output": [
"\n24\n",
"\n28\n",
"\n4\n"
]
} | {
"input": [],
"output": []
} |
1375_B. Neighbor Grid | You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its neighboring cells have a number greater than 0 written on them. Note that if the... | {
"input": [],
"output": []
} | {
"input": [
"5\n3 4\n0 0 0 0\n0 1 0 0\n0 0 0 0\n2 2\n3 0\n0 0\n2 2\n0 0\n0 0\n2 3\n0 0 0\n0 4 0\n4 4\n0 0 0 0\n0 2 0 1\n0 0 0 0\n0 0 0 0\n"
],
"output": [
"YES\n2 3 3 2\n3 4 4 3\n2 3 3 2\nNO\nYES\n2 2\n2 2\nNO\nYES\n2 3 3 2\n3 4 4 3\n3 4 4 3\n2 3 3 2\n"
]
} | {
"input": [
"5\n3 4\n0 0 0 0\n0 1 0 0\n-1 0 0 0\n2 2\n3 0\n0 0\n2 2\n0 0\n0 0\n2 3\n0 0 0\n0 4 0\n4 4\n0 0 0 0\n0 2 0 1\n0 0 0 0\n0 0 0 0\n",
"5\n3 4\n0 0 0 0\n0 1 0 0\n-1 0 0 0\n2 2\n3 0\n0 0\n2 2\n0 0\n0 0\n2 3\n-1 0 0\n0 0 0\n4 4\n0 0 0 -1\n0 2 0 2\n0 1 0 0\n0 0 0 0\n",
"5\n3 4\n0 0 0 0\n0 1 0 0\n-1 0... |
1398_E. Two Types of Spells | 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 doubles the damage of the next spell Polycarp casts. Each spell can be ca... | {
"input": [],
"output": []
} | {
"input": [
"6\n1 5\n0 10\n1 -5\n0 5\n1 11\n0 -10\n"
],
"output": [
"5\n25\n10\n15\n36\n21\n"
]
} | {
"input": [
"6\n1 5\n0 10\n1 -5\n1 5\n1 11\n0 -10\n",
"6\n1 5\n0 10\n1 -5\n0 5\n1 11\n0 -5\n",
"6\n1 5\n0 10\n1 -5\n0 5\n1 3\n0 -10\n",
"6\n1 5\n0 10\n1 -5\n1 7\n1 11\n0 -10\n",
"6\n1 5\n0 10\n1 -5\n1 5\n1 18\n0 -10\n",
"6\n1 5\n0 10\n1 -5\n0 6\n1 3\n0 -10\n",
"6\n1 5\n0 10\n1 -5\n1 14\n1... |
1491_D. Zookeeper and The Infinite Zoo | 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 \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwis... | {
"input": [],
"output": []
} | {
"input": [
"5\n1 4\n3 6\n1 6\n6 2\n5 5\n"
],
"output": [
"\nYES\nYES\nNO\nNO\nYES\n"
]
} | {
"input": [
"5\n1 4\n3 7\n1 6\n6 2\n5 5\n",
"5\n1 5\n3 6\n1 6\n6 2\n5 5\n",
"5\n1 5\n3 6\n1 6\n6 2\n4 5\n",
"5\n1 2\n3 7\n2 6\n3 2\n6 5\n",
"5\n1 3\n3 7\n2 6\n3 2\n6 5\n",
"5\n1 3\n3 7\n2 3\n1 2\n6 5\n",
"5\n1 4\n3 6\n1 6\n6 3\n5 5\n",
"5\n2 1\n6 7\n2 6\n6 2\n3 5\n",
"5\n1 4\n3 6\... |
divide-to-three-33 | Stannis borathean is attacking kings landing from three gates.To defend the city Tyrion again comes up with a fair solution. Tyrion has N soldier troops with given strengths. Tyrion wants to divide army into 3 sets such that the sum of strengths in these three sets are as equal as possible. In other words he wants to m... | {
"input": [],
"output": []
} | {
"input": [
"4\n3\n4\n1\n3\n\nSAMPLE"
],
"output": [
"4\n"
]
} | {
"input": [
"4\n3\n4\n1\n3\n\nELPMAS",
"4\n3\n1\n1\n3\n\nELPMAS",
"4\n2\n4\n4\n3\n\nSAMPLE",
"4\n2\n4\n4\n6\n\nSBMPLE",
"4\n1\n0\n1\n2\n\nELPMAR",
"4\n1\n-1\n1\n1\n\nELPMAR",
"4\n4\n7\n2\n6\n\nELPM@S",
"4\n2\n4\n1\n3\n\nSAMPLE",
"4\n2\n4\n1\n3\n\nELPMAS",
"4\n3\n1\n1\n3\n\nELP... |
moody-numbers | Some people are just moody, you just cannot reason with them.
Same goes with Natural Numbers. Some of them ultimely want to become 1 or 4 and will evolve infinite times if they have to, to become what they want to. To evolve, they use a function F such that N = F(N). Function F(N) is defined as :
F(N) = sum_of_digits(... | {
"input": [],
"output": []
} | {
"input": [
"4\n1\n2\n3\n8\n\nSAMPLE"
],
"output": [
"YES\nYES\nNO\nYES"
]
} | {
"input": [],
"output": []
} |
sale-2 | 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 form a queue so that everyone can shop turn-wise.
Since queue is going... | {
"input": [],
"output": []
} | {
"input": [
"2\n5 3\n1 2\n3 4\n2 5\n4 3\n1 2\n1 3\n1 4\n\nSAMPLE"
],
"output": [
"YES\nNO\n"
]
} | {
"input": [
"2\n5 3\n1 2\n3 4\n2 5\n4 1\n1 2\n1 3\n1 4\n\nSAMPLE",
"2\n5 3\n1 2\n3 3\n2 5\n4 3\n1 2\n1 3\n1 4\n\nSAMPLE",
"2\n5 3\n1 2\n3 4\n2 5\n4 3\n1 2\n1 4\n1 4\n\nSAMPLE",
"2\n5 3\n1 2\n3 3\n2 5\n4 0\n1 2\n1 3\n1 4\n\nSAMPLE",
"2\n5 3\n1 2\n3 4\n2 5\n4 0\n1 2\n1 3\n1 4\n\nSAMPLE",
"2\n5 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.