task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Zero AND Subsets éè² æŽæ°ã®å€ééå a_1,a_2,..,a_N ãäžããããŸãã ãã®éåã®ç©ºã§ãªãéšåéåã§ãã£ãŠãå€ã®bitwiseANDã 0 ã«ãªããã®ã¯ããã€ãããŸããã çãã 10^9+7 ã§å²ã£ãäœããæ±ããŠãã ããã å
¥å N a_1 a_2...a_N åºå çãã 10^9+7 ã§å²ã£ãäœããåºåããã å¶çŽ 1 \leq N \leq 10^5 0 \leq a_i \leq 2^{20}-1 å
¥åäŸ 6 8 6 9 1 2 1 åºåäŸ 51 | 38,175 |
Is it a Right Triangle? Write a program which judges wheather given length of three side form a right triangle. Print " YES " if the given sides (integers) form a right triangle, " NO " if not so. Input Input consists of several data sets. In the first line, the number of data set, N is given. Then, N lines follow, eac... | 38,176 |
Problem I: Revenge of Voronoi A discrete Voronoi diagram is a derivation of a Voronoi diagram. It is represented as a set of pixels. Each of the generatrices lies on the center of some pixel. Each pixel belongs to the generatrix nearest from the center of the pixel in the sense of Manhattan distance. The Manhattan dist... | 38,177 |
Score : 100 points Problem Statement Given is an integer N . Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd. Constraints 1 \leq N \leq 100 Input Input is given from Standard Input in the following format: N Output Print the probabi... | 38,178 |
Score : 300 points Problem Statement Every day, N passengers arrive at Takahashi Airport. The i -th passenger arrives at time T_i . Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the... | 38,179 |
Score : 400 points Problem Statement We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell. However, she cannot enter the cells in the intersection of the bottom A rows and the ... | 38,180 |
Problem G: Captain Qâ²s Treasure You got an old map, which turned out to be drawn by the infamous pirate âCaptain Qâ. It shows the locations of a lot of treasure chests buried in an island. The map is divided into square sections, each of which has a digit on it or has no digit. The digit represents the number of chests... | 38,181 |
ç€Ÿå¡æ
è¡ Problem Statement ããªãã®äŒç€Ÿã«ã¯ n 人ã®ç€Ÿå¡ãååšããïŒ m åã®ç€Ÿå¡ (a_i,b_i) ã®çµã«ã€ããŠïŒ a_i 㯠b_i ã®äžåžã§ããïŒ ç€Ÿå¡ x ãç€Ÿå¡ y ã®å®è³ªçãªäžåžã§ãããšã¯ïŒæ¬¡ã®ãã¡å°ãªããšãäžæ¹ãæãç«ã€ããšãããïŒ x ã y ã®äžåžã§ããïŒ y ã®å®è³ªçãªäžåžã§ããç€Ÿå¡ z ãååšããŠïŒ x 㯠z ã®äžåžã§ããïŒ ããªãã®äŒç€Ÿã§ïŒèªåèªèº«ãèªåã®å®è³ªçãªäžåžã§ãããããªç€Ÿå¡ã¯ååšããªãïŒ ããªãã®äŒç€Ÿã§ã¯ç€Ÿå¡ãå
šå¡åå ããç€Ÿå¡æ
è¡ãèšç»ãããŠããïŒå
šç€Ÿå¡ã®èŠæ±ã«ããïŒæ
通ã§ã®éšå±å²ãã¯ãããéšå±å²ããã§ãªããã°ãªããªãïŒ ããéšå±å²ãããããéšå±å²ããã§ãããšã¯ä»¥äžã®äž¡æ¹ãæº... | 38,182 |
Problem E: è¶³ãç®ã²ãŒã ããã®ãã¡ãŒãã«ã¯è¶³ãç®ãçšããç°¡åãªã²ãŒã ãæãã€ããåããããã§åéã®ãªãŒããªãŒãšäžç·ã«ãã£ãŠã¿ãããšã«ããã ã²ãŒã ã®ã«ãŒã«ã¯æ¬¡ã®ãããªãã®ã§ããããŸãæåã«ãé©åœãªæ£ã®æŽæ°ãéžã³ãããããã¹ã¿ãŒããããåãã¬ãŒã€ãŒã¯ããã®æ°ã®ãã¡é£ãåã2ã€ã®æ¡ãéžæããŠåãèšç®ããããšã®2ã€ã®æ°åãšçœ®ãæãããããšãã°ãã1234ãã®åã®äœãšçŸã®äœãéžã¶ãšãæ¬¡ã®æ°ã¯ã154ããšãªããã5555ãã®åã®äœãšçŸã®äœãéžãã å Žåã¯ã5105ããšãªãããã®ãããªæäœãæ°ã1æ¡ã«ãªããŸã§äº€äºã«ç¹°ãè¿ããæäœãã§ããªããªã£ããã¬ãŒã€ãŒãè² ããšãªãã ã²ãŒã éå§æã®æŽæ°ã®å€ãäžãããããå
æ»ã§ãããã¡ãŒãã«ãšåŸæ»ã§ã... | 38,183 |
Score : 300 points Problem Statement A programming competition site AtCode provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + ⊠+ p_D problems are all of the ... | 38,184 |
Score : 2200 points Problem Statement We have two indistinguishable pieces placed on a number line. Both pieces are initially at coordinate 0 . (They can occupy the same position.) We can do the following two kinds of operations: Choose a piece and move it to the right (the positive direction) by 1 . Move the piece wit... | 38,185 |
Problem A: How I Wonder What You Are! One of the questions children often ask is "How many stars are there in the sky?" Under ideal conditions, even with the naked eye, nearly eight thousands are observable in the northern hemisphere. With a decent telescope, you may find many more, but, as the sight field will be limi... | 38,186 |
ä»å¹ŽãïŒå
šåœããã°ã©ãã³ã°éžææš©å€§äŒã®ææããã£ãŠããïŒå
šåœå€§äŒã®åå æš©ãè³ããå°åºå€§äŒã¯ïŒ 2 n ããŒã ã1 察1 ã®åã¡æ®ãåŒããŒãã¡ã³ãæ¹åŒã§å¯Ÿæ±ºããïŒ ããŒãã¡ã³ã衚ã«ã¯ããŒã çªå· 0, . . . 2 n â 1 ãå²ãæ¯ãããŠããïŒ1 åæŠãã n åæŠãŸã§ã®å¯Ÿæ±ºæé ã¯æ¬¡ã®éãã§ããïŒ 1 åæŠã§ã¯ïŒïŒããŒã çªå·ã l ã®ããŒã ïŒãšïŒããŒã çªå·ã l + 1 ã®ããŒã ïŒã察決ããïŒ( l â¡ 0 (mod 2)) i + 1 åæŠ( 1 †i < n ) ã§ã¯ïŒãããŒã çªå·ã l ä»¥äž l + 2 i æªæºã®ããŒã ã®ãã¡ïŒ i åæŠãŸã§ã®å¯Ÿæ±ºã§ 1 åãè² ããŠããªãããŒã ããšãããŒã çªå·ã l + 2 i ä»¥äž l ... | 38,187 |
åé¡ 2: æç¥š (Vote) åé¡ 20XXå¹Žã«æ±äº¬ã§äžççãªã¹ããŒã倧äŒãéãããããšã«ãªã£ãïŒããã°ã©ãã³ã°ã³ã³ãã¹ãã¯ã¹ããŒããšããŠäžçã§æ¥œããŸããŠããïŒç«¶æãšããŠæ¡çšãããå¯èœæ§ãããïŒæ¡çšãããç«¶æã決ãã審æ»å§å¡äŒã«ã€ããŠèª¿ã¹ããšããïŒæ¬¡ã®ãããªããšãåãã£ãïŒ å¯©æ»å§å¡äŒã®ããã«ïŒåè£ãšãªã N åã®ç«¶æãé¢çœãæ¹ããé çªã«äžŠã¹ããªã¹ããäœæãããïŒãªã¹ãã®äžãã i çªç®ã«ã¯ i çªç®ã«é¢çœãç«¶æãæžãããŠããïŒãããç«¶æ i ãšããïŒããã«ç«¶æ i ã®éå¬ã«å¿
èŠãªè²»çš A i ãæžãããŠããïŒ ãŸãïŒå¯©æ»å§å¡äŒã¯å§å¡ 1 ããå§å¡ M ãŸã§ã® M 人ã®å§å¡ã§æ§æãããŠããïŒå§å¡ j ã¯èªåã®å¯©æ»åºæº B j ãã... | 38,188 |
ã«ãã³åäž æªçãã«ãã³åäžãã¯äŒæŽ¥è©å£«ãæ«è£ãšããçŸå¥³ãå¯å£«å³°åããããäŒæŽ¥è¥æŸåžã«äŒæŽ¥è©ãæ®ããè»è³éãç ã£ãŠããããšãèãããããã«ãã³ã®é·å¹Žã®ä»²éã§ãããç³å·è¶ã§éãã®å ±åã«ããã°ãè»è³éã¯å䞡箱ã«åãããããã€ãã®èµã«ä¿ç®¡ãããŠãããèµã«èŠåŒµãã¯ããªããå³éã«æœé ãããŠãããããããè¶ã§éã¯åœŒãç¶ããäŒæãããç§äŒãéŒéæ¬ããã®æãç¹°ãåºãã°ç¬æã«èµãç Žãããšããã æ®ã£ãåé¡ã¯å䞡箱ã®éæ¬ã ãäœåã®ãªãã«ãã³ãšè¶ã§éã¯å䞡箱ãäžã€ãæãŠãªããããã§ãé Œãã«ãªãç·ãç¡é倧ä»ãã«éæ¬ãé Œãã ã ãã¹ãŠã®å䞡箱ãéã³åºãããã«ãã«ãã³ã¯ä»¥äžã®ãããªèšç»ãç«æ¡ããã ãŸããã«ãã³ã®éè»¢ã§æåã®èµãžè¡ããè¶ã§éãšå€§ä»ãéããã è¶... | 38,189 |
Problem D: International Party Isaac H. Ives is attending an international student party (maybe for girl-hunting). Students there enjoy talking in groups with excellent foods and drinks. However, since students come to the party from all over the world, groups may not have a language spoken by all students of the group... | 38,190 |
Score : 2000 points Problem Statement There is a bridge that connects the left and right banks of a river. There are 2 N doors placed at different positions on this bridge, painted in some colors. The colors of the doors are represented by integers from 1 through N . For each k ( 1 \leq k \leq N ), there are exactly tw... | 38,191 |
Score : 300 points Problem Statement There is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0 -th step. He can climb up one or two steps at a time. However, the treads of the a_1 -th, a_2 -th, a_3 -th, \ldots , a_M -th steps are broken, so it is dangerous to set foot on ... | 38,192 |
Problem H: Co-occurrence Search A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more abou... | 38,193 |
Pipe Fitter and the Fierce Dogs You, a proud pipe fitter of ICPC (International Community for Pipe Connection), undertake a new task. The area in which you will take charge of piping work is a rectangular shape with $W$ blocks from west to east and $H$ blocks from north to south. We refer to the block at the $i$-th fro... | 38,194 |
Fractional Knapsack Problem You have $N$ items that you want to put them into a knapsack of capacity $W$. Item $i$ ($1 \le i \le N$) has weight $w_i$ and value $v_i$ for the weight. When you put some items into the knapsack, the following conditions must be satisfied: The total value of the items is as large as possibl... | 38,195 |
Score: 300 points Problem Statement M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: For the first through (K-1) -th terms: not given. For each of the K -t... | 38,196 |
Score : 300 points Problem Statement The problem set at CODE FESTIVAL 20XX Finals consists of N problems. The score allocated to the i -th (1âŠiâŠN) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harde... | 38,197 |
Longest Increasing Subsequence For a given sequence A = {a 0 , a 1 , ... , a n-1 } , find the length of the longest increasing subsequnece (LIS) in A . An increasing subsequence of A is defined by a subsequence {a i 0 , a i 1 , ... , a i k } where 0 †i 0 < i 1 < ... < i k < n and a i 0 < a i 1 < ... < a i k . Input n ... | 38,198 |
Score : 100 points Problem Statement A Hitachi string is a concatenation of one or more copies of the string hi . For example, hi and hihi are Hitachi strings, while ha and hii are not. Given a string S , determine whether S is a Hitachi string. Constraints The length of S is between 1 and 10 (inclusive). S is a string... | 38,199 |
D: ã¹ãã£ã㌠/ Scanner å顿 ããã« $N$ æã®çŽããããããªã㯠$3$ å°ã®ã¹ãã£ããŒã䞊åã«çšããããšã§ã å
šãŠã®çŽãã¹ãã£ã³ããããšèããŠãããããããã®çŽã¯ã¹ãã£ã³ã«ãããæéãæ±ºãŸã£ãŠããã $i$ çªç®ã®çŽãã¹ãã£ã³ããã®ã«ãããæé㯠$T_i$ ã§ããã çŽãã¹ãã£ã³ããé çªã¯ä»»æã§ãããã$1$ å°ã®ã¹ãã£ããŒã§è€æ°ã®çŽãåæã«ã¹ãã£ã³ããããšã¯ã§ããªãã å
šãŠã®çŽã®ã¹ãã£ã³ãçµäºããã¹ãã£ã³ãè¡ã£ãŠããã¹ãã£ããŒããªããªããŸã§ã«ãããæéãæå°åããªããã å
¥å $N$ $T_1$ $T_2$ $T_3$ $\vdots$ $T_N$ å¶çŽ $1 \leq N \leq 50$ $1 \leq... | 38,201 |
ããã¹ ãžã§ãŠåãšã€ãšããã¯æŒäŒã¿ã«ããã¹ãããŸãããã ããæŒäŒã¿ã¯æéãéãããŠããã®ã§ãçãæéã§çµããããã«ãåŸç¹ã«ã€ããŠä»¥äžã®ïŒã€ã®ã«ãŒã«ã§è¡ããŸãã çžæãïŒç¹ä»¥äžã®ãšãã«å
ã«ïŒç¹ãšãã°åã¡ã ïŒå¯ŸïŒã®åç¹ã«ãªã£ããšãã¯ããã®çŽåŸã«é£ç¶ããŠïŒç¹ãšã£ãæ¹ãåã¡ã ïŒå¯ŸïŒã®åŸã«åæ¹ãïŒç¹ãã€ãšã£ããšãã¯åŒãåãã 以äžã®å³ã¯ããžã§ãŠåãšã€ãšããã®è©Šåã§èµ·ããåŸããã¹ãŠã®ç¶æ³ã衚ããŠããŸããäžžã®äžã®å·Šã®æ°ããžã§ãŠåã®åŸç¹ãå³ãã€ãšããã®åŸç¹ã§ããïŒ¡ãšæžããç¢å°ã¯ãžã§ãŠåãïŒç¹ãšã£ãããšããïŒ¢ãšæžããç¢å°ã¯ã€ãšãããïŒç¹ãšã£ãããšã衚ããŸãã ãžã§ãŠåãšã€ãšããã®åŸç¹ãäžãããããšãã詊åéå§ãããã®åŸç¹ç¶æ³ã«ãªããŸã§ã«ãäžã®å³ã§... | 38,202 |
Score : 100 points Problem Statement You are given an integer N . Consider an infinite N -ary tree as shown below: Figure: an infinite N -ary tree for the case N = 3 As shown in the figure, each vertex is indexed with a unique positive integer, and for every positive integer there is a vertex indexed with it. The root ... | 38,203 |
Score : 200 points Problem Statement You have written N problems to hold programming contests. The i -th problem will have a score of P_i points if used in a contest. With these problems, you would like to hold as many contests as possible under the following condition: A contest has three problems. The first problem h... | 38,204 |
Problem F: RabbitLunch ãããã¯æŒé£ã«ã«ããããšããŠã€ã1 åãã€é£ã¹ã. ãããã¯ãšãŠãåæ§çãªã®ã§, é£ã¹ãã«ãããã®çš®é¡ãããŠã€ã®çš®é¡ãåãã§ãããããª, ç°ãªã2 å¹ã®ããããååšããŠã¯ãªããªã. ã«ããã㯠$M$ çš®é¡ãã. $i$ çš®é¡ç®ã®ã«ããã㯠$m_i$ åãã. ããŠã€ã¯ $N$ çš®é¡ãã. $i$ çš®é¡ç®ã®ããŠã€ã¯ $n_i$ åãã. æå€§äœå¹ã®ããããæŒé£ããšãããæ±ãã. $m_i$ ãš $n_i$ ã¯æ¬¡ã®æŒžååŒãçšããŠçæãã. $m_0 = m0$ $m_{i+1} = (m_i * 58 + md )$ mod $(N + 1)$ $n_0 = n0$ $n_{i+1} =... | 38,205 |
Problem A Secret of Chocolate Poles Wendy, the master of a chocolate shop, is thinking of displaying poles of chocolate disks in the showcase. She can use three kinds of chocolate disks: white thin disks, dark thin disks, and dark thick disks. The thin disks are $1$ cm thick, and the thick disks are $k$ cm thick. Disks... | 38,207 |
Problem L: The Return of FizzBuzz ICPC World Finals 7æ¥ç® ããããææ¥ã¯ICPC World Finalsã®æ¬çªã§ããã ãã£ãŒæ°ã¯ãããªã³ã©ã€ã³ãžã£ããž(Aru Online Judge)ã§ç·Žç¿ãããããšã«ããã åé¡äžèЧãçºããŠãããšFizzBuzzãšããåé¡ãç®ã«ã€ããã ãã®åé¡ã¯ãFizzBuzzã²ãŒã ã§åŸãããçºèšã®næåç®ãã20æåãåºåãããšãããã®ã ã âŠãµã
ããã£ãšããéã«è§£ããŠããŸã£ãã ããã§ã¯ç°¡åãããã å
¥åãšåºåãéã«ããåé¡ãäœã£ãŠã¿ãããšã«ãããã åé¡ FizzBuzzãšã¯ã1以äžã®æŽæ°ãé ã«ã以äžã®ã«ãŒã«ã«åŸã£ãŠçºèšããŠããã²ãŒã ã§ããã ... | 38,208 |
Score : 1100 points Problem Statement We will call a string that can be obtained by concatenating two equal strings an even string. For example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not. For a non-empty string S , we will define f(S) as the shortest even string that can be obtained by appending one or... | 38,209 |
Score : 700 points Problem Statement N hotels are located on a straight line. The coordinate of the i -th hotel (1 \leq i \leq N) is x_i . Tak the traveler has the following two personal principles: He never travels a distance of more than L in a single day. He never sleeps in the open. That is, he must stay at a hotel... | 38,210 |
Problem I: Pythagoraslope Alice, your girlfriend, is a student at an art school. She is in the final year, and now working hard to build a facture for fulfilling the requirement to graduate. Her work is a large pinball with many straight slopes. Before starting to build, she has made several plans, but is unsure if the... | 38,211 |
Score : 200 points Problem Statement In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the coo... | 38,212 |
Score : 2200 points Problem Statement You are given positions (X_i, Y_i) of N enemy rooks on an infinite chessboard. No two rooks attack each other (at most one rook per row or column). You're going to replace one rook with a king and then move the king repeatedly to beat as many rooks as possible. You can't enter a ce... | 38,213 |
Problem Statement You are given a list of $N$ intervals. The $i$-th interval is $[l_i, r_i)$, which denotes a range of numbers greater than or equal to $l_i$ and strictly less than $r_i$. In this task, you consider the following two numbers: The minimum integer $x$ such that you can select $x$ intervals from the given ... | 38,214 |
å°æ°äœã®å a , b , n ã¯ãããããæ£ã®æŽæ°ã§ãããšããŸããåæ° a / b ã®å°æ°ç¬¬ i äœã®æ°ã f(i) ãšããŸã (0 †f(i) †9)ããã®ãšãã i = 1 ãã n ãŸã§ã® f(i) ã®åã s ãšããŸãã s = f(1) + f(2) + ... + f(n) a , b , n ãèªã¿èŸŒãã§ã s ãåºåããŠçµäºããããã°ã©ã ãäœæããŠãã ããã Input å
¥åã¯è€æ°ã®ããŒã¿ã»ãããããªããŸããåããŒã¿ã»ãããšããŠã3 ã€ã®æŽæ° a (1 †a †1000), b (1 †b †10000), n (1 †n †100) ã空çœåºåãã§ïŒè¡ã«äžããããŸãã ããŒã¿ã»ããã®æ°ã¯ 100 ... | 38,215 |
Min-Max For given three integers $a, b, c$, print the minimum value and the maximum value. Input The input is given in the following format. $a \; b \; c\;$ Three integers $a, b, c$ are given in a line. Output Print the minimum and maximum values separated by a space in a line. Constraints $-1,000,000,000 \leq a, b, c ... | 38,216 |
åº ãããšå士ã®å®¶ã®åºã«ã¯æ£æ¹åœ¢ã®ã¿ã€ã«ãæ·ãã€ããããŠããŸããèžè¡ã«é è©£ãæ·±ããããšå士ã¯ãèµ€ãé»ãéã®å¡æã䜿ã£ãŠã¿ã€ã«ã«è²ãå¡ãããšã«ããŸãããã¯ããã«éšå±ã®é©åœãªã¿ã€ã«ãã²ãšã€éžã³ã以äžã®æ¹æ³ã§è²ãå¡ã£ãŠãããŸãã ã¿ã€ã«ãå¡ãè²ããèµ€ïŒå³ã®çªå·ïŒïŒãé»ïŒå³ã®çªå·ïŒïŒãéïŒå³ã®çªå·ïŒïŒã®é ã«å€ããŠãããéã®æ¬¡ã¯ãŸãèµ€ããå§ããã ãã§ã«è²ãå¡ã£ãé åã®é£ã«æ£æ¹åœ¢ã远å ããããã«è²ãå¡ããããããåãããé åãé·æ¹åœ¢ã«ãªãããã«ãããæ£æ¹åœ¢ã远å ããæ¹åã¯ãæ±ãåã西ãåã®é ã«å€ããŠãããåã®æ¬¡ã¯ãŸãæ±ããå§ããïŒå³ã§ã¯ãäžæ¹åãåã峿¹åãæ±ã§ããïŒã æåã«èµ€ãå¡ã£ãã¿ã€ã«ããæ±è¥¿æ¹åã«$x$åãååæ¹åã«$y$åç§»åãã... | 38,217 |
åå£«ã®æå· å 士 : ?D-C'KOPUA ããŒã¿ãŒ : ã©ããããã§ãããããããå士? ããã®ããããªãããšãå«ã¶ã®ã«ã¯ããæ
£ããŸãããã 仿¥ã¯æç« ã«ãããªã£ãŠããŸãããã å 士 : ã»ãã ããŒã¿ãŒ : ãªãã§ãã? ãã®è¡šã¯......ãããäºéžã®åé¡ã«ãããªã®ããããŸããã衚ã䜿ã£ãŠæåã眮ãæã ããšæåæ°ãæžããã§ãããããŸããäºéžãšæ¬éžã§åãåé¡ãåºããŠæãæããã£ãŠæ°ãããªãã§ã ãããã å 士 : éãããã ããŒã¿ãŒ : é? ãªãã»ã©ãä»åºŠã¯çãããæååãå
ã«æ»ããã£ãŠåé¡ã§ããããšããããšã¯ã?D-C'KOPUAãã® æåãããã®è¡šã䜿ã£ãŠãæåãããã笊å·ãã«çœ®ãããããã§ãã......ã§ããŸ... | 38,218 |
åå£ (Rampart) æŽå²åŠè
ã§ãã JOI ææã¯ïŒãã€ãŠååšãã IOI çåœã«ã€ããŠç ç©¶ããŠããïŒ éå»ã®èª¿æ»ã«ãããšïŒIOI çåœã¯çžŠ H è¡ïŒæšª W åã®ãã¹ã«åºåãããé·æ¹åœ¢ã®åœ¢ãããŠããïŒIOI çåœã®éŠéœã¯ïŒé²è¡ã®ããã«åå£ã§å²ãããŠããïŒ IOI çåœã®éŠéœãå²ãåå£ã¯æ¬¡ã®ãããªåœ¢ãããŠããïŒåå£ã«ã¯å€§ãããšåŒã°ããå€ãå®ãŸã£ãŠããïŒå€§ãã s ( s ⥠3) ã®åå£ãšã¯ïŒ s à s ã®æ£æ¹åœ¢ã®é åããå€åšä»¥å€ã® ( s â 2) à ( s â 2) ã®æ£æ¹åœ¢ã®é åãé€ãããã®ã§ããïŒ èª¿æ»ã«ãããšïŒéŠéœãå²ãåå£ã®å€§ãã㯠L 以äžã§ãã£ãïŒãŸãïŒIOI çåœã®ããã€ãã®ãã¹ã«ã¯åå£ãååšããªãã£ãããš... | 38,219 |
I: Palindrome Compliment å顿 å°æ± ããã¯ããŒã ã¡ã€ããããè€ããŸãã 圌ã¯ããŒã ã¡ã€ãã§ããæŸåŽãããæåå $S$ ã§è€ããŸãããã®åœ¢åŒã¯ä»¥äžã®æ¡ä»¶ãæºãããŸãã $Hoge, Zaki, O$ ã¯å°æåã¢ã«ãã¡ãããã®ã¿ãããªãæåå $S = Hoge + Zaki + Hoge + O$ ($+$ ã¯æååã®çµåã衚ã) $S$ ã¯åæ å°æ± ããã¯$Hoge$ã®é·ãã$N$ãšãããšãã«ãæŸåŽããã®è€ãæ¹ãäœéãããã®ãæ°ã«ãªããŸããã 3人ç®ã®ããŒã ã¡ã³ããŒã«ããŠred coderã§ããããªãã¯å°æ± ããã®ä»£ããã«çããèšç®ããããšã«ãªããŸããã æåå $Zaki, O$ ãš æŽæ° $N$ ãäžã... | 38,220 |
Problem B: Equals are Equals Mr. Simpson got up with a slight feeling of tiredness. It was the start of another day of hard work. A bunch of papers were waiting for his inspection on his desk in his office. The papers contained his students' answers to questions in his Math class, but the answers looked as if they were... | 38,221 |
ãŽã«ã ã¯ãã»ã¯è¶
äžæµã®è
ãæã£ãããã«ããã°ã©ããŒã§ããïŒããã°ã©ãã³ã°ã³ã³ãã¹ãçéã§ãã®åãç¥ãã¬è
ã¯ããªãïŒ ã¢ã«ãŽãªãºã ïŒããŒã¿ãã€ãã³ã°ïŒãããã³ã°ïŒAIïŒâŠâŠãããšãããã倧äŒãç·ãªãã«ããŠããïŒ ãããªã¯ãã»ã次ã®ç®æšã«æ®ããç«¶æã¯ïŒãã³ãŒããŽã«ããã§ããïŒ ã³ãŒããŽã«ããšã¯ïŒäžããããåé¡ã«å¯Ÿãæ£çãè¿ãããã°ã©ã ã®ããœãŒã¹ã³ãŒãã®çãããç«¶ãç«¶æã§ããïŒ ã³ãŒããŽã«ãã«ãããŠã¯ïŒç°ãªãããã°ã©ãã³ã°èšèªéã§å
¬å¹³ãªæ¯èŒãé£ããããïŒäœ¿çšèšèªãéå®ãããããšãå€ãïŒ ã¯ãã»ã次ã«çã£ãŠãã倧äŒãICPC (International Competition of Program Compactness)ãã§ã¯ïŒ ãA... | 38,222 |
Problem B: Carrot Tour ããããããåœãæ
è¡ããŠãã. ãã®åœã«ã¯1 ãã n ã®çªå·ãã€ãã n åã®éœåžããã, ãããã¯ä»éœåž1ã«ãã. éœåž i ã¯åº§æšå¹³é¢äžã®1 ç¹( x i , y i ) ãšã¿ãªã. ãããã¯ä»¥äžã®æ¡ä»¶ãã¿ããããã«æ
ããã. ç§»åçµè·¯ã¯æãç·ã§ãã, ãã®åéšåã¯ç°ãªã2 éœåžãçµã¶ç·åã§ãªããã°ãªããªã. ç§»åçµè·¯ã®å
šé·ã¯ r 以äžã§ãªããã°ãªããªã. çµè·¯ã®ãã¡éãªã£ãéšåã, éã£ãåæ°åæ°ãã. ç§»åããæ¹åãå€ãããšã, æ²ããè§åºŠã¯ Ξ 以äžã§ãªããã°ãªããªã. æåã®ç§»åæ¹åã«å¶éã¯ãªã. ããããããéœåžããå¥ã®éœåžãžç§»åããããš, ç§»åå
ã®éœåžã§ãã³ãžã³ã1 æ¬... | 38,223 |
Score : 500 points Problem Statement You are given a tree with N vertices and N-1 edges. The vertices are numbered 1 to N , and the i -th edge connects Vertex a_i and b_i . You have coloring materials of K colors. For each vertex in the tree, you will choose one of the K colors to paint it, so that the following condit... | 38,224 |
Score : 100 points Problem Statement You are given two integers A and B as the input. Output the value of A + B . However, if A + B is 10 or greater, output error instead. Constraints A and B are integers. 1 †A, B †9 Input Input is given from Standard Input in the following format: A B Output If A + B is 10 or greate... | 38,225 |
Problem J: The Incubator ãµã©ãªãŒãã³ã®æã¯æ©ãããšãªãŒãã³ãŒã¹ãé²ã¿äžæµäŒæ¥ã«å
¥ç€ŸããŠæ°äººãšããè©æžãããã忥ããé ãåã«äžã£ãèŸä»€ã¯æªéã®ææã«ãããå¶æ¥æŽ»åã ã£ãã蟺éãªåå°ã§ã®äžäŸ¿ãªç掻ã匷ããããŠããããäžå¿ã¯å·Šé·ã§ãªãæ 転ã§ããããã®èšŒæ ã«çµŠæããããšäžãã£ãŠãã - ãããªå Žæã§ã¯éãªããŠäœ¿ãããããªãã®ã ãã©ãè¿å¹Žåãã¡ãçŽé¢ããŠããå®å®èŠæš¡ã®ãšãã«ã®ãŒäžè¶³ã«å¯Ÿå¿ãããããç¹å®ã®çç©çš®ã®åäœããè«å€§ãªãšãã«ã®ãŒãçæãããã¯ãããžãŒãéçºãããããã®ç¹å®ã®çç©çš®ãšããã®ãããã®èŸºéãªææã®åºæçš®ãªã®ã ããã®çç©ãçµ¶æ»
ããªãããã«ä¿è·ãã€ã€ãé©åºŠã«ãšãã«ã®ãŒãååããŠããã®ãåã®ä»äºã ã ãšã... | 38,226 |
Score : 1200 points Problem Statement We have N boxes numbered 1 to N , and M balls numbered 1 to M . Currently, Ball i is in Box A_i . You can do the following operation: Choose a box containing two or more balls, pick up one of the balls from that box, and put it into another box. Since the balls are very easy to bre... | 38,227 |
Common-Prime Sort You are now examining a unique method to sort a sequence of numbers in increasing order. The method only allows swapping of two numbers that have a common prime factor. For example, a sequence [6, 4, 2, 3, 7] can be sorted using the following steps. Step 0: 6 4 2 3 7 (given sequence) Step 1: 2 4 6 3 7... | 38,229 |
å匷ãéå§ããæå»ãšçµäºããæå»ã®æ
å ±ãåºã«ã1æ¥ã§å匷ããæéã®åèšã t 以äžã§ãããããã§ãã¯ããéããŠããªãå Žåã¯è¶³ããªãæéãæ±ããããã°ã©ã ãäœæããŸããæéã¯1æéã1åäœãšããåãç§ã¯èããªããã®ãšããŸããæå»ã¯24æé衚èšã§1æéåäœã§è¡šããŸãã 1æ¥ã®å匷ã®ç®æšæéãšãå®éã«å匷ããæéã®æ
å ±ïŒå匷ã®åæ° n ãããããã®å匷ã®éå§æå» s ãšçµäºæå» f ïŒãå
¥åãšããå匷æéã®åèšãç®æšã«éããŠãããã調ã¹ãéããŠããã° "OK" ããéããŠããªãå Žåã¯è¶³ããªãæéãåºåããããã°ã©ã ãäœæããŠãã ããããã ããããããè¡ã£ãå匷æéã¯éè€ããŸããã äŸïŒ ç®æšæé å匷ããæé å€å® 10æé 6æã11æ... | 38,230 |
ããããã²ããã (Calculation Training) square1001 å㯠E869120 åã«ãèªçæ¥ãã¬ãŒã³ããšããŠäºã€ã®æ°å $A$ ãš $B$ ããã¬ãŒã³ãããŸããã E869120 åã¯ãã®äºã€ã®æ°åã䜿ã£ãŠãèšç®ãã¬ãŒãã³ã°ãããããšã«ããŸããã å
·äœçã«ã¯ãE869120åã¯æ¬¡ã®æäœãã¡ããã© $N$ åãããã®æ°ã«è¡ããŸãã 奿°åç®ã®æäœã®ãšãã$A$ ã $A-B$ ã§çœ®ãæãã å¶æ°åç®ã®æäœã®ãšãã$B$ ã $A+B$ ã§çœ®ãæãã E869120åã $N$ åã®æäœãããåŸã$A$ ãš $B$ ã®å€ãããããããã€ã«ãªã£ãŠãããæ±ããŠãã ããã å
¥å å
¥åã¯ä»¥äžã®åœ¢åŒã§æšæºå
¥åããäžãã... | 38,231 |
Score : 400 points Problem Statement We have a tree with N vertices numbered 1 to N . The i -th edge in the tree connects Vertex u_i and Vertex v_i , and its length is w_i . Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following conditio... | 38,232 |
Problem H: Hogemon Get Problem ãã£ã¡ãåã¯äººæ°ã®ã²ãŒã Hogemon Getã«ç±äžããŠããããã£ã¡ãåãäœãã§ããäŒæŽ¥åœã¯ãããã1ãã N ã®çªå·ãã€ããŠãã N åã®çºãããªãããŸããäŒæŽ¥åœã«ã¯ M æ¬ã®éãããããã¹ãŠã®éã¯ç°ãªã2ã€ã®çºãçµãã§ããããã£ã¡ãåã¯éãåæ¹åã«ç§»åããããšãã§ããããé以å€ãéã£ãŠãããçºããå¥ã®çºã«è¡ãããšã¯ã§ããªãã Hogemon Getã§ã¯ãçº i ã§ããŒã«ã d i åå
¥æããããšãã§ããããã ããããçºã§åã³ããŒã«ãå
¥æããããã«ã¯ãæåŸã«ãã®çºã§ããŒã«ãå
¥æããŠãã15å以äžçµéããŠããå¿
èŠãããããªãããã£ã¡ãåã¯çº1ãçº N ãå«ããã¹ãŠã®çºãäœ... | 38,233 |
Problem C: Craftsman Takeshi, a famous craftsman, accepts many offers from all over Japan. However, the tools which he is using now has become already too old. So he is planning to buy new tools and to replace the old ones before next use of the tools. Some offers may incur him monetary cost, if the offer requires the ... | 38,234 |
Score : 1100 points Problem Statement You are given a directed graph with N vertices and M edges. The vertices are numbered 1, 2, ..., N , and the edges are numbered 1, 2, ..., M . Edge i points from Vertex a_i to Vertex b_i . For each edge, determine whether the reversion of that edge would change the number of the st... | 38,235 |
å顿 äžã®äžã®å°å¥³ãã¡ã¯ãã¥ã¥ã¹ããšå¥çŽãé¡ããå¶ããŠãããïŒãããšã²ãããã«éæ³å°å¥³ãšãªãïŒäœ¿ãéæ³ã®åœ¢ã»å¹æã¯é¡ãã«åŒ·ã圱é¿ãåããïŒéæ³å°å¥³ ããã ã¡ããã¯æè¿ãã¥ã¥ã¹ããšå¥çŽããæ°ç±³éæ³å°å¥³ã§ããïŒ ããã ã®é¡ãã¯ãäºæ
ã®ããæãåããªããªãïŒé³æ¥œãæŒå¥ããã®ã諊ããŠããç·ã®åãå©ããããšãã§ãã£ãã®ã§ïŒäœãéæ¹é£ã¯é³ç¬Šã茪ã®äžã«äžŠãã 圢ãããŠããïŒ ããã 㯠N åã®é³ç¬Šãæã£ãŠããïŒãããã茪ã®äžã«äžŠã¹ãããšã«ãã£ãŠéæ¹é£ãäœãïŒé³ç¬Šãã©ã®ãããªé çªã§äžŠã¹ããã¯åœŒå¥³ã®èªç±ã§ããïŒéæ¹é£ãäœãããã«ç²Ÿç¥åãæ¶è²»ããïŒãã®éã¯é³ç¬Šã®é
眮ã«ãã£ãŠä»¥äžã®ããã«æ±ºãŸãïŒ ãŸãïŒ M åã®æ£ã®æŽæ°ãããªã 鳿¥œççŸãã S_... | 38,236 |
Score : 100 points Problem Statement There are H rows and W columns of white square cells. You will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns. How many white cells will remain? It can be proved that this count does not depend on what rows and columns are ch... | 38,237 |
Daruma Otoshi You are playing a variant of a game called "Daruma Otoshi (Dharma Block Striking)". At the start of a game, several wooden blocks of the same size but with varying weights are stacked on top of each other, forming a tower. Another block symbolizing Dharma is placed atop. You have a wooden hammer with its ... | 38,238 |
Score : 600 points Problem Statement We have a tree with N vertices numbered 1 to N . The i -th edge in this tree connects Vertex a_i and b_i . Additionally, each vertex is painted in a color, and the color of Vertex i is c_i . Here, the color of each vertex is represented by an integer between 1 and N (inclusive). The... | 38,240 |
Score : 1200 points Problem Statement Snuke loves flags. Snuke is placing N flags on a line. The i -th flag can be placed at either coordinate x_i or coordinate y_i . Snuke thinks that the flags look nicer when the smallest distance between two of them, d , is larger. Find the maximum possible value of d . Constraints ... | 38,241 |
Unable Count I would, if I could, If I couldn't how could I? I couldn't, without I could, could I? Could you, without you could, could ye? Could ye? could ye? Could you, without you could, could ye? It is true, as this old rhyme says, that we can only DO what we can DO and we cannot DO what we cannot DO. Changing some ... | 38,242 |
G: åæéšåå (Palindromic Subsequences) åé¡ è±å°æåã®ã¿ãããªãæåå S ãäžããããã®ã§ããã®æåå S ã® é£ç¶ãšã¯éããªã éšååã§ãã£ãŠãåæã§ãããã®ã¯äœçš®é¡ããããæ±ããŠãã ããã ããã§ã S ã®é£ç¶ãšã¯éããªãéšååãšã¯ãå
ã®æåå S ãã 1 æåä»¥äž |S| æå以äžãä»»æã«éžæã (éžæããããããã®æåã®äœçœ®ã¯éé£ç¶ã§ãè¯ã)ãããããå
ã®é çªéãã«é£çµãããŠã§ããæååã®ããšãæããŸãããã®åé¡ã«ãããŠã空æååã¯éšååãšããŠèªããããªãããšã«æ³šæããŠãã ããã ãŸããæåå X ãåæã§ãããšã¯ãå
ã®æåå X ãšã X ãå転ããæåå Xâ ãçããããšãæããŸã... | 38,243 |
Balls and Boxes 10 Balls Boxes Any way At most one ball At least one ball Distinguishable Distinguishable 1 2 3 Indistinguishable Distinguishable 4 5 6 Distinguishable Indistinguishable 7 8 9 Indistinguishable Indistinguishable 10 11 12 Problem You have $n$ balls and $k$ boxes. You want to put these balls into the boxe... | 38,244 |
Score : 500 points Problem Statement Jumbo Takahashi will play golf on an infinite two-dimensional grid. The ball is initially at the origin (0, 0) , and the goal is a grid point (a point with integer coordinates) (X, Y) . In one stroke, Jumbo Takahashi can perform the following operation: Choose a grid point whose Man... | 38,247 |
Deque For a dynamic array $A = \{a_0, a_1, ...\}$ of integers, perform a sequence of the following operations: push($d$, $x$): Add element $x$ at the begining of $A$, if $d = 0$. Add element $x$ at the end of $A$, if $d = 1$. randomAccess($p$): Print element $a_p$. pop($d$): Delete the first element of $A$, if $d = 0$.... | 38,249 |
Score : 500 points Problem Statement We have N logs of lengths A_1,A_2,\cdots A_N . We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L) , it becomes two logs of lengths t and L-t . Find the shortest possible length of the longest lo... | 38,250 |
C: ç絡è©äŸ¡ åé¡ çŽå€§ãããšå倧ããã¯ã²ãŒã ãããŠããŸãã å倧ããã¯ããŸã以äžã® BNF ã§è¡šãããè«çåŒãçæããŸãã <formula> ::= <or-expr> <or-expr> ::= <and-expr> | <or-expr> "|" <and-expr> <and-expr> ::= <term> | <and-expr> "&" <term> <term> ::= "(" <or-expr> ")" | "?" & ã¯è«çç©ãã | ã¯è«çåã衚ãã & ã®æ¹ã | ããå
ã«è©äŸ¡ãããŸãã çŽå€§ããã¯ããã®è«çåŒãïŒæååãšããŠèŠãŠïŒå·Šããèªãã§ããã ? ãèŠã€ãããšã以äžã®è¡åãããŸãã ãã® ? ã ... | 38,251 |
Score : 200 points Problem Statement 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:... | 38,252 |
Problem D: AABABCAC Problem æåå$s$,$t$ãäžããããã æåãæååéå$A=${$s$},$B=\phi$ãšããã ãã®ãšããæ¬¡ã®æäœãã§ããã ãããããè¡ãããã æäœ step1 å
šãŠã® $u â A$ ã«ã€ããŠã以äžã®åŠçãè¡ãã $u$ã®å
šãŠã®éšåå(é£ç¶ã§ãªããŠããã)ããã$t$ãšçãããã®ãä»»æã«1ã€éžã¶ãéžãã éšååã®$u$ã«å¯Ÿå¿ããã€ã³ããã¯ã¹ããããã$z_1$, $z_2$, âŠ, $z_{|t|}$ãšãã(ãã ã1 $\le$ $z_1$ $\lt$ $z_2$ $\lt$ ⊠$\lt$ $z_{|t|}$ $\le$ $|u|$)ããã®ãããªéšååããªããã°æäœãçµäº... | 38,253 |
Score : 1200 points Problem Statement There are N apartments along a number line, numbered 1 through N . Apartment i is located at coordinate X_i . Also, the office of AtCoder Inc. is located at coordinate S . Every employee of AtCoder lives in one of the N apartments. There are P_i employees who are living in Apartmen... | 38,254 |
Problem A: Unreliable Messengers The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, âYou shall make use of a message relaying game when you inform me of something.â In response to the Kingâs statement, six servants were selected as messengers whose names... | 38,255 |
Score : 700 points Problem Statement N problems are proposed for an upcoming contest. Problem i has an initial integer score of A_i points. M judges are about to vote for problems they like. Each judge will choose exactly V problems, independently from the other judges, and increase the score of each chosen problem by ... | 38,256 |
Score : 900 points Problem Statement There are N squares in a row. The squares are numbered 1, 2, ..., N from left to right. You have two pieces, initially placed on square A and B , respectively. You will be asked to process Q queries of the following kind, in the order received: Given an integer x_i , move one of the... | 38,257 |
峿žæŽç æ°ã®è¡šããæ¹ã«ã¯è²ã
ãªçš®é¡ããããç§ãã¡ãæ®æ®µäœ¿ã£ãŠãã 10 鲿°ã¯äžã€ã®ä»£è¡šçãªãã®ã§ãããããŸãããã³ã³ãã¥ãŒã¿é¢é£ã®ç¥èããã人ã«ã¯ã2 鲿°ã16 鲿°ãããã¯ãšãŠã身è¿ãªãã®ã§ãã N ããã¯åžæžè³æ Œã掻ãããŠåžæžã®ä»äºã«å°±ããŸãããæåã®ä»äºã¯å³æžæŽçã§ãããã®å³æžé€šã§ã¯ãäžåããšã«äžè²«ããŠçªå·ãäžããããŠãããããã«åŸã£ãŠæ¬ãæŽçããŠããŸãã ãã®å³æžé€šã§ã¯æ¬ã®çªå·ããã€ãã¹å鲿°ã§è¡šãããšã«ãªã£ãŠããŸãã ãã€ãã¹å鲿°ã¯ã a n a nâ1 a nâ2 ... a 2 a 1 a 0 (å a i 㯠0~9 ã®æ°å) ãšè¡šèšããæ¹æ³ã§ããããã®æ°ã¯æ¬¡ã®æ°ã衚ããŸãã a n Ã(â10) n + a... | 38,258 |
Problem E: SAT-EN-3 åœŒå¥³ã¯æ©ãã§ãããæçžŸãè¯ããªãã®ã ã䞡芪ã«ç¡çãèšã£ãŠå
šå¯®å¶ã®åŠæ ¡ã«å
¥åŠãããã®ã®ãåœŒå¥³ã®æèœã¯äžåã«éè±ããããšã¯ãªãã£ãããããã¯æèœãªã©å
ã
ãªãã£ãã®ãããããªãããããã¯ã§ããã ãèããããªãå¯èœæ§ã ã£ãã ããã§åœŒå¥³ãé Œã£ãã®ã¯ãã€ã³ã¿ãŒãããäžã§èŠã€ããæªãããªè³åãã¬ãŒãã³ã°ã®ææã ã£ããSAT-EN-3 (SATisifiability problem for Enhancement of Neuron: version 3) ãšéæã€ãã®åŠç¿ã¡ãœããã«ãããšãå
è¶³å¯èœæ§åé¡ã®ãããªãã®ã®ã€ã³ã¹ã¿ã³ã¹ãã²ãããæã§è§£ãããšã«ãã£ãŠãèšç®åãåäžããåŒããŠã¯è«ççæèåã»çŽæå... | 38,259 |
E: Broccoli or Cauliflower Problem The input is a rooted tree T = (V, E) with n vertices. Note that n is odd and the vertex with index 1 is the root of T . In addition, we give a label G or W for each vertex. Let T_v = (U, F) be a subtree of T such that U is defined as following. U = $\{$ u \in V \ \ | \ \ u $\text{ is... | 38,260 |
æŽç¬ã®æ° ã€ã
ã¢å
¬åã«ã¯ã倿¹ã«ãªããšæŽç¬ã𿣿©ãã人ãã¡ãããããæ¥ãŸããæŽç¬ã«ã¯æ¯ã®è²ã«ãã£ãŠèµ€æŽã黿ŽãçœæŽãè¡éº»æŽãšããçš®é¡ããããŸããæŽç¬ããããããããšãããããã¢ãšã¡ããã¯ãããããã®æ¯è²ã®æŽç¬ãäœé ãããããã°ã£ãŠæ°ããŸãããããŸã è¶³ãç®ãã§ããªãã®ã§æŽç¬ãå
šéšã§äœé ãããããããŸããã ããããã®æ¯è²ã®æŽç¬ã®æ°ãäžãããããšãã«ãæŽç¬ã®ç·æ°ãèšç®ããããã°ã©ã ãäœæããã å
¥å å
¥åã¯ä»¥äžã®åœ¢åŒã§äžããããã $R$ $B$ $W$ $G$ ïŒè¡ã«èµ€æŽã®æ°$R$ ($1 \leq R \leq 100$)ã黿Žã®æ°$B$ ($1 \leq B \leq 100$)ãçœæŽã®æ°$W$ ($1 \leq W \leq 1... | 38,261 |
Beautiful Currency KM country has N kinds of coins and each coin has its value a_i . The king of the country, Kita_masa, thought that the current currency system is poor, and he decided to make it beautiful by changing the values of some (possibly no) coins. A currency system is called beautiful if each coin has an int... | 38,262 |
Problem A: Plants Problem ãã£ã¡ãåã¯æšª W åÃ瞊 H åã®ãã¹ã§åºåãããçãææããŠããã x åç® y è¡ç®ã®ãã¹ããã¹ (x, y) ãšåŒã¶ããšã«ãããããã€ãã®ãã¹ã®åå°ã«ã¯é«ã0cmã®æ€ç©ã1æ¬ã ãæ€ããŠããããã®ä»ã®ãã¹ã®åå°ã«ã¯äœãæ€ããããŠããªãã ãã£ã¡ãåã¯ããæå»ã«çã«è¥æããŸããè¥æããŸããããã¹ã«æ€ç©ãæ€ããããŠãããšãããã®æ€ç©ã®é«ãã1cm䌞ã³ããæ€ç©ãæ€ããããŠããªããšãã¯ãäœãããããªããæ€ç©ã䌞ã³ãã®ã«ãããæéã¯ãšãŠãçãã®ã§ç¡èŠã§ããããã£ã¡ãåã¯åãæå»ã«è€æ°ã®ãã¹ã«è¥æããŸãããšãã§ããããã ããåãæå»ã«åããã¹ã«2床以äžè¥æããŸãããšã¯ãªãã ãã£ã¡ãåã... | 38,263 |
Problem H: Round Table You are the owner of a restaurant, and you are serving for N customers seating in a round table. You will distribute M menus to them. Each customer receiving a menu will make the order of plates, and then pass the menu to the customer on the right unless he or she has not make the order. The cust... | 38,264 |
Presentation You are a researcher investigating algorithms on binary trees. Binary tree is a data structure composed of branch nodes and leaf nodes. Every branch nodes have left child and right child, and each child is either a branch node or a leaf node. The root of a binary tree is the branch node which has no parent... | 38,265 |
Space Coconut Crab å®å®ã€ã·ã¬ã English text is not available in this practice contest. ã±ã³ã»ããªã³ãã«ãŒã¯ïŒå®å®ã€ã·ã¬ããæ±ããŠå
šéæ²³ãæ
ããã¹ããŒã¹ãã³ã¿ãŒã§ããïŒå®å®ã€ã·ã¬ãã¯ïŒå®å®æå€§ãšãããç²æ®»é¡ã§ããïŒæé·åŸã®äœé·ã¯ 400 ã¡ãŒãã«ä»¥äžïŒè¶³ãåºããã° 1,000 ã¡ãŒãã«ä»¥äžã«ããªããšèšãããŠããïŒæ¢ã«å€æ°ã®äººã
ãå®å®ã€ã·ã¬ããç®æããŠãããïŒèª°äžäººãšããŠæãããããšã«æåããŠããªãïŒ ã±ã³ã¯ïŒé·æéã®èª¿æ»ã«ãã£ãŠïŒå®å®ã€ã·ã¬ãã®çæ
ã«é¢ããéèŠãªäºå®ãè§£æããïŒå®å®ã€ã·ã¬ãã¯ïŒé©ãã¹ãããšã«ïŒçžè»¢ç§»èªæ³ãšåŒã°ããææ°ã®ã¯ãŒãæè¡ãšåçã®ããšã... | 38,266 |
Red Dragonfly Itâs still hot every day, but September has already come. Itâs autumn according to the calendar. Looking around, I see two red dragonflies at rest on the wall in front of me. Itâs autumn indeed. When two red dragonfliesâ positional information as measured from the end of the wall is given, make a program ... | 38,267 |
Problem E: The Genome Database of All Space Life In 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all space life. Thanks to scientific research over many ye... | 38,268 |
Cube Dividing Pablo Cubarson is a well-known cubism artist. He is producing a new piece of work using a cuboid which consists of $A \times B \times C$ unit cubes. He plans to make a beautiful shape by removing $N$ units cubes from the cuboid. When he is about to begin the work, he has noticed that by the removal the cu... | 38,269 |
Score : 700 points Problem Statement There is a tree with N vertices, numbered 1 through N . The i -th of the N-1 edges connects vertices a_i and b_i . Currently, there are A_i stones placed on vertex i . Determine whether it is possible to remove all the stones from the vertices by repeatedly performing the following ... | 38,270 |
Sum of 4 Integers Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 †a, b, c, d †9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of ( a, b, c, d ): ( 8, 9, 9, 9 ), ( 9, 8, 9, 9 ), ( 9, 9, 8, 9 ), and... | 38,271 |
F: èµ€é»ããŒãããã / Red-Black Soul Gem åé¡ ã»ãã¡ããã¯ãããŒãããããèµ€è²ãé»è²ã«å€åããããã ç°ãªã 2 ã€ã®ããŒããããéãéæ³ã®ç³žã§æ¥ç¶ãããããäžæè°ãªåãæã£ãŠããŸãã ãã®åã䜿ãããšã§ãã»ãã¡ããã¯ãããŒããããã«ããéæ¹é£ãäœãããšãã§ããŸãã ã»ãã¡ããã¯ã 1 ãã N ã§çªå·ä»ãããã N åã®ããŒããããããããšãã以äžã®æ¡ä»¶ãæãç«ã€ç°ãªãéæ¹é£ãããã€ããã®ãæ°ã«ãªããŸããã ã©ã® 2 ã€ã®ããŒããããéããé«ã
1 åããæ¥ç¶ãããªãã ãã¹ãŠã®ããŒããããã®è²ããèµ€è²ãé»è²ã®ããããã«ãªã£ãŠããã ä»»æã®ããŒããããã«å¯ŸããŠãèªèº«ã®è²ãšç°ãªãè²ã®ããŒããããã®ãã¡ãå°ãª... | 38,272 |
èæ°·æž¡ã åé¡ å¬ã®å¯ãããæ¥ïŒJOI倪éåã¯åºå Žã«ã¯ã£ãèæ°·ãå²ã£ãŠéã¶ããšã«ããïŒåºå Žã¯é·æ¹åœ¢ã§ïŒæ±è¥¿æ¹åã« m åïŒååæ¹åã« n åïŒã€ãŸãïŒ m à n ã®åºç»ã«åºåãããŠããïŒãŸãïŒèæ°·ãæãåºç»ãšç¡ãåºç»ãããïŒ JOI倪éåã¯ïŒæ¬¡ã®ã«ãŒã«ã«ãããã£ãŠïŒèæ°·ãå²ããªããåºç»ãç§»åããããšã«ããïŒ èæ°·ãããã©ã®åºç»ãããèæ°·ãå²ãå§ããããšãã§ããïŒ æ±è¥¿ååã®ããããã®æ¹åã«é£æ¥ãïŒ ãŸã å²ãããŠããªãèæ°·ã®ããåºç»ã«ç§»åã§ããïŒ ç§»åããå
ã®åºç»ã®èæ°·ãããªããå²ãïŒ JOI倪éåãèæ°·ãå²ããªããç§»åã§ããåºç»æ°ã®æå€§å€ãæ±ããããã°ã©ã ãäœæããïŒãã ãïŒ 1 †m †90ïŒ1 †n †90 ã§ããïŒäž... | 38,273 |
Set Difference Find the difference of two sets $A = \{a_0, a_1, ..., a_{n-1}\}$ and $B = \{b_0, b_1, ..., b_{m-1}\}$, $A - B$. Input The input is given in the following format. $n$ $a_0 \; a_1 \; ... \; a_{n-1}$ $m$ $b_0 \; b_1 \; ... \; b_{m-1}$ Elements in $A$ and $B$ are given in ascending order. There are no duplic... | 38,274 |
Score : 400 points Problem Statement Given is a rooted tree with N vertices numbered 1 to N . The root is Vertex 1 , and the i -th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i . Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0 . Now, the following Q op... | 38,275 |
Score : 200 points Problem Statement You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S . If every lowercase English letter occurs in S , print None instead. Constraints 1 \leq |S| \leq 10^5 ( |S| is th... | 38,276 |
G: Computer Onesan / ã³ã³ãã¥ãŒã¿ããããã ããæ¥ïŒãããããã¯ïŒåäŸãã¡ã«çµåãã®æ°ãæ¹ã«ã€ããŠæããŠãããããšã«ãªããŸããïŒ ããã§ïŒãããããã¯ïŒæ¬¡ã®ãããªåé¡ãè§£ããŠã¿ãããšã«ããŸããïŒ çžŠå¹
1 ïŒæšªå¹
1 ã®æ£æ¹åœ¢ã瞊å¹
N ïŒæšªå¹
M ã®é·æ¹åœ¢ã«æ·ãè©°ãããšãã«ïŒé·æ¹åœ¢ã®å·Šäžã®é ç¹ããå³äžã®é ç¹ãžã®éãæ¹ãäœéãããããæ°ãã æ·ãè©°ããæ£æ¹åœ¢ã®èŸºã®äžããéããªã ããããã®éãæ¹ã¯ïŒåãå Žæã1床ããéããªã å³1ã«ïŒ N = 2, M = 2 ã®å Žåã®å
šãŠã®éãæ¹ã瀺ããŸãïŒ å³1ã§ã¯ïŒå
šéšã§12éãã®éãæ¹ã瀺ããŠããïŒãã®çµè·¯ã¯èµ€ã倪ç·ã§è¡šããŠããŸãïŒ å³1: N = 2, M = 2 ã®... | 38,277 |
Problem J: Billion Million Thousand A linguist, Nodvic Natharus Damenhof (commonly called Dr. Usoperant ), invented an artificial language Usoperant in 2007. The word usoperant means âone which tiresâ. Damenhofâs goal was to create a complex and pedantic language that would remind many difficulties in universal communi... | 38,279 |
Score : 300 points Problem Statement Given is a string S of length N-1 . Each character in S is < or > . A sequence of N non-negative integers, a_1,a_2,\cdots,a_N , is said to be good when the following condition is satisfied for all i ( 1 \leq i \leq N-1 ): If S_i= < : a_i<a_{i+1} If S_i= > : a_i>a_{i+1} Find the mini... | 38,280 |
Score : 200 points Problem Statement Takahashi has two positive integers A and B . It is known that A plus B equals N . Find the minimum possible value of "the sum of the digits of A " plus "the sum of the digits of B " (in base 10 ). Constraints 2 †N †10^5 N is an integer. Input Input is given from Standard Input in... | 38,282 |
Problem I: Coin and Die Problem 衚ãšè£ã®ããã³ã€ã³ãš $1$ ãã $N$ ãŸã§ã®ç®ããããµã€ã³ãããããGachoããã¯ããããçšããŠä»¥äžã®ã²ãŒã ãããŠéã¶ããšã«ããã ã²ãŒã ã¯æåã«åŸç¹ã $0$ ã®ç¶æ
ããå§ãŸãã以äžã®æé ã§é²ããããã ãµã€ã³ãã $1$ 忝ãããã®ãšãåºãç®ã®æ°ãåŸç¹ã«å ç®ãã çŸåšã®åŸç¹ã $K$ 以äžãªãã²ãŒã ã¯ãªã¢ãšãªãã²ãŒã ãçµäºãã çŸåšã®åŸç¹ã $K$ æªæºãªãã³ã€ã³ãæã衚ãåºãã°1.ã«æ»ããè£ãåºãã°ã²ãŒã ãªãŒããŒãšãªãã²ãŒã ãçµäºãã ã³ã€ã³ã¯æãããš $A\%$ã®ç¢ºçã§è¡šã«ãªãã $(100-A)\%$ã®ç¢ºçã§è£ã«ãªãããŸãããµã€ã³ãã¯æ¯ããšããããã... | 38,283 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.