task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Score : 800 points Problem Statement Snuke found a record of a tree with N vertices in ancient ruins. The findings are as follows: The vertices of the tree were numbered 1,2,...,N , and the edges were numbered 1,2,...,N-1 . Edge i connected Vertex a_i and b_i . The length of each edge was an integer between 1 and 10^{1... | 39,026 |
Score : 100 points Problem Statement There is a set A = \{ a_1, a_2, \ldots, a_N \} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: Choose ... | 39,027 |
Balls and Boxes 1 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 boxes... | 39,028 |
Score : 300 points Problem Statement If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1 . The integer has exactly N digits in base ten. (We assume 0 to be a 1 -digit integer. For other integers, leading zeros are not allowed.) The s_i -th dig... | 39,029 |
ã¢ãªã®å·£ç®±ã®åœ¢ç¶ æ±æåã¯å€äŒã¿ã®èªç±ç ç©¶ãšããŠã¢ãªã®å·£ã®èгå¯ãè¡ãããšã«ããŸããã圌ã®ãããã¡ãããå«ã®ããã«çšæããŠããã芳å¯çšã®éæã±ãŒã¹ã¯ãšãŠããŠããŒã¯ã§ãå³1ã®ãããªåœ¢ãããŠããŸãã å³ïŒ ãã®ã±ãŒã¹ã¯ã2æã®ååãªåžå€è§åœ¢ s1ãs2 ãšäœæãã®é·æ¹åœ¢ã§æ§æãããŠããŸããs1ãs2 以å€ã®ããããã®é·æ¹åœ¢ã®é¢ãåºã«æ¥ããããã«çœ®ããŸãã芳å¯ãå§ããæ±æåã¯ãå
¥ã£ãŠããåã®éãåãã«ãããããããåºé¢ã®éžã³æ¹ã«ãã£ãŠåã®é«ããå€ããããšã«æ°ä»ããŸããïŒå³2ïŒã å³ïŒ æ±æåã¯ãã±ãŒã¹ã®çœ®ãæ¹ã«ãã£ãŠãã©ã®ãããé«ããªããç¥ããããªããŸãããåžå€è§åœ¢ s1 ã®åœ¢ãs1 ãš s2 éã®è·é¢ d ãåã®äœç© V ãå
¥åãšããåã®... | 39,031 |
The Number of Inversions For a given sequence $A = \{a_0, a_1, ... a_{n-1}\}$, the number of pairs $(i, j)$ where $a_i > a_j$ and $i < j$, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubble Sort defined in the following program: bubbleSort(A) cnt = 0 // the number of ... | 39,032 |
Problem E: Kuru-Kuru Robot ããããå·¥åŠã®ç ç©¶è
ã§ããã¢ã·ã¢ãå士ã¯ãæ°ããããããã®éçºã«æåããããã®ããããã¯ãåºã«åŒµãå·¡ãããç¹æ®ãªã¯ã€ã€ãŒã«æ²¿ã£ãŠèªç±ã«åãããšãã§ãããããããã¯åžžã«çŸåšããã¯ã€ã€ãŒã«å¹³è¡ãªæ¹åãåããŠåé²ããã ãã°ãããããšã«ããã®ããããã¯ã¯ã€ã€ãŒäžãç§»åããããã«ãã®è·é¢ã«ããããããšãã«ã®ãŒãæ¶è²»ããªããããããã¯ã€ã€ãŒã®ç«¯ç¹ãã¯ã€ã€ãŒã®äº€ç¹ã§åããå€ããããã«ã¯ãã®ç¹ãäžå¿ã«å転ããå¿
èŠãããããã®å転è§åºŠã ããšãã«ã®ãŒãæ¶è²»ããã ãã®ãããããã¹ã¿ãŒãå°ç¹ãããŽãŒã«å°ç¹ãŸã§åãããããäŸãã°ãäžå³ã«ãããŠããããã start ã«æ±åãïŒäžå³ x è»žã®æ£ã®åãïŒã§... | 39,033 |
Score : 400 points Problem Statement For a positive integer X , let f(X) be the number of positive divisors of X . Given a positive integer N , find \sum_{K=1}^N K\times f(K) . Constraints 1 \leq N \leq 10^7 Input Input is given from Standard Input in the following format: N Output Print the value \sum_{K=1}^N K\times ... | 39,034 |
Max Score: $1500$ Points Problem Statement There is a $50 \times 50$ field. The cell at $i$-th row and $j$-th column is denoted $(i, j)$ (0-indexed). One day, square1001 puts $250$ bombs in this field. In each cell, there is 1 or 0 bomb. You want to know where the bombs are by asking some questions. You can ask this qu... | 39,035 |
Score : 700 points Problem Statement You are given N integers A_1 , A_2 , ..., A_N . Consider the sums of all non-empty subsequences of A . There are 2^N - 1 such sums, an odd number. Let the list of these sums in non-decreasing order be S_1 , S_2 , ..., S_{2^N - 1} . Find the median of this list, S_{2^{N-1}} . Constra... | 39,036 |
Kth Sentence A student, Kita_masa, is taking an English examination. In this examination, he has to write a sentence of length m . Since he completely forgot the English grammar, he decided to consider all sentences of length m constructed by concatenating the words he knows and write the K -th sentence among the candi... | 39,037 |
Score : 100 points Problem Statement Takahashi, who is A years old, is riding a Ferris wheel. It costs B yen ( B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger ar... | 39,038 |
Problem C: Last One Problem ããªãã¯ãéå奜ããªå人Aãšäžé¢šå€ãã£ãã²ãŒã ãããŠã¿ãäºã«ããã nåã®èŠçŽ ãããªãéè€ãèš±ãããéè² ã®æŽæ°ã®éåSãäžãããããéåSã«å«ãŸããåèŠçŽ ã¯éè² ã® p i 鲿°ã§ãããéåSã«å¯Ÿã㊠以äžã®Step1~3ã1ã€ã®ã¿ãŒã³ãšããŠãããªããšçžæã®äºäººã亀äºã«ã¿ãŒã³ãç¹°ãè¿ããåã¿ãŒã³ã§ã¯ãã®çªå·ã®é ã«æäœãè¡ãã Step 1: éåSã«å«ãŸããå
šãŠã®èŠçŽ ãäžåºŠåãé€ãããã®åãé€ããåèŠçŽ ã2鲿°ã«å€æããŠã0ãæ¶ããŠ1ã1ã€ä»¥äžé£ç¶ããéšåã«åå²ãããã®åå²ãããéšåãå
šãŠéåSã«å ããã Step 2: ãã®ãšãéåSã空ã«ãªã£ãŠãããªãã°ãçŸåšãã®ã¿ãŒã³ããã¬... | 39,039 |
ããã«ãœãŒã(Bubble Sort) ããã«ãœãŒããšã¯ïŒåããœãŒãããã¢ã«ãŽãªãºã ã® 1 ã€ã§ããïŒé·ã N ã®æ°å A ãæé ã«ãœãŒãããããšãããïŒããã«ãœãŒãã¯ïŒé£ãåã 2 ã€ã®æ°ã§å€§å°é¢ä¿ã厩ããŠãããã®ãããã°ïŒãããã®äœçœ®ã亀æããïŒãããïŒæ°åãåããé ã«èµ°æ»ããªããè¡ãïŒããªãã¡ïŒ A i > A i+1 ãšãªã£ãŠããå Žæãããã°ïŒãã® 2 æ°ã亀æãããšããããšãïŒ i = 1, 2, ... , N â 1 ã«å¯ŸããŠãã®é ã§è¡ãã®ã 1 åã®èµ°æ»ã§ããïŒãã®èµ°æ»ã N â 1 åç¹°ãè¿ãããšã§ïŒæ°åãæé ã«ãœãŒãã§ããããšãç¥ãããŠããïŒ æ°å A ã®ããã«ãœãŒãã«ãã亀æåæ°ãšã¯ïŒæ°å A ã«äžèšã®ã¢ã«ãŽãª... | 39,040 |
å®
é
æé ããå®
é
æ¥è
ã®å®
é
æéã¯å€§ãããšééã§äžè¡šã®ããã«æéãèšå®ãããŠããŸãã A ãµã€ãº B ãµã€ãº C ãµã€ãº D ãµã€ãº E ãµã€ãº F ãµã€ãº 倧ãã 60cm以å
80cm以å
100cm以å
120cm以å
140cm以å
160cm以å
éã 2kg以å
5kg以å
10kg以å
15kg以å
20kg以å
25kg以å
æé 600å 800å 1000å 1200å 1400å 1600å 倧ããã¯äžèŸºïŒçžŠã暪ãé«ãïŒã®åã§ããäŸãã°å€§ããã120cmã§ãéãã15kg以å
ã®è·ç©ã¯ïŒ€ãµã€ãºïŒ1,200åïŒãšãªããŸãã倧ããã120cm以å
ã§ããéãã15kgãè¶
ãã20kg以å
ãªãã°ïŒ¥ãµã€ãºãšãªããŸãã 1æ¥... | 39,041 |
Problem A: ææ«è©Šéš! ç§ç«æ¡ãäžå¥³åé«çåŠæ ¡ã«éã平沢å¯ããã¯æåŸæ¥ãŸã§ã«é²è·¯åžæãåºããªããã°ãªããªãã®ã ããå°ã£ãããšã«é²è·¯ã«ã€ããŠãŸã äœã決ããŠããªãã£ãã å人ã®åã«çžè«ãããšãããåã®ç¬¬äžå¿æã¯K倧ãšç¥ããèªåãK倧ã«å
¥ãããã©ããé²è·¯æå°ã®å
çã«çžè«ã«ãã£ãã çžè«ãããé²è·¯æå°ã®å
çã§ããããªãã¯å¯ãããK倧ã«å
¥ãããã©ãããäºæ³ããããå¯ããã®ææ«è©Šéšã®æçžŸãåèã«ããããšã«ããã ããããå¯ããã¯è©Šéšã®å±±ãåœãããã©ããã«ãã£ãŠå€§ããæçžŸãå·Šå³ããããããéå»ã®ææ«è©Šéšã®äžã§äžçªè¯ãã£ãæã®ç¹æ°ãšäžçªæªãã£ãæã®ç¹æ°ã調ã¹ãããšã«ããã éå»ã®ææ«è©Šéšã®ããŒã¿ã¯5æç§ã®åç¹æ°ã®ã¿ããæ®ã£ãŠãããã詊éšã®... | 39,042 |
Problem J: The Teacherâs Side of Math One of the tasks students routinely carry out in their mathematics classes is to solve a polynomial equation. It is, given a polynomial, say X 2 - 4 X + 1, to find its roots (2 ± â3). If the studentsâ task is to find the roots of a given polynomial, the teacherâs task is then to fi... | 39,043 |
F : Tree / æš å顿 倧ãã N ã®æ ¹ä»ãæšãããã åé ç¹ã«ã¯ 0 ãã Nâ1 ãŸã§ã®çªå·ãä»ããããæ ¹ã 0 ã§ããã ä»»æã®èŸºã®äž¡ç«¯ã®é ç¹ã«ã€ããŠãå²ãåœãŠãããæŽæ°ã¯æ ¹ã«è¿ãã»ããå°ãããåãã¯å
šãŠã®èŸºã®éã¿ã¯ 0 ã§ããã ãã®æšã«å¯Ÿãã Q åã®ã¯ãšãªãé ã«åŠçãããã¯ãšãªã«ã¯ä»¥äžã® 2 çš®é¡ãããã é ç¹ u , v ã®è·é¢(ãã¹ã«å«ãŸãã蟺ã®éã¿ã®å)ãæ±ããã é ç¹ v ã®åå«(èªèº«ãå«ãŸãªã)ã«æ¥ç¶ãã蟺ã®éã¿ãå
šãŠ x å¢å ãããã å
¥å å
¥åã¯ä»¥äžã®åœ¢åŒãããªãã N Q a_0 b_0 ⊠a_{Nâ2} b_{Nâ2} q_0 ⊠q_{Qâ1} a_i,b_i 㯠i çªç®ã®èŸºãçµã¶é ç¹ã§... | 39,044 |
Problem E: Magical Island This is a story in the epoch of magic. A clan of magicians lived in an artificial island built by magic power. One day, a crisis erupted on the island. An Empire ACM (Atlas Country of Magic) required unconditional surrender to them, otherwise an imperial force attacked by magical missiles to t... | 39,045 |
Score : 1900 points Problem Statement Snuke has found two trees A and B , each with N vertices numbered 1 to N . The i -th edge of A connects Vertex a_i and b_i , and the j -th edge of B connects Vertex c_j and d_j . Also, all vertices of A are initially painted white. Snuke would like to perform the following operatio... | 39,046 |
Problem C: Shopping Your friend will enjoy shopping. She will walk through a mall along a straight street, where $N$ individual shops (numbered from 1 to $N$) are aligned at regular intervals. Each shop has one door and is located at the one side of the street. The distances between the doors of the adjacent shops are ... | 39,047 |
Problem A: Register Phase ã€ã³ã¿ãŒããããããå®å
šã«æŽ»çšããããã«ãå
ç¢ãªãã¹ã¯ãŒãã䜿ãããšã¯éèŠã§ããããããšåæã«ãåããã¹ã¯ãŒãã䜿ãåããªãããšãéåžžã«éèŠã§ãããã©ããªã«åŒ·ããã¹ã¯ãŒãã䜿ã£ãŠããŠããäžç®æã§å¹³æãæµåºããŠããŸãã°ãç Žãã®ã¯éåžžã«å®¹æã«ãªã£ãŠããŸãããã¡ãããå
šãŠã®ã¢ããªã±ãŒã·ã§ã³ããã¹ã¯ãŒããããã·ã¥åããSALTãé©åã«äœ¿çšããŠããã°æµåºããŠããã®ãããªè¢«å®³ã¯çºçããªãããããŸã ã«ãã¹ã¯ãŒããå¹³æã§ä¿åããŠããã¢ããªã±ãŒã·ã§ã³ã¯ããã®ã§ããã ããŠãããããã³ã³ãã¹ããå§ãŸããããŒã ã®ã¢ã«ãŠã³ããç»é²ããªããŠã¯âŠã åé¡ ãã¹ã¯ãŒãã衚ãæååãäžããããããã®æååã以äžã®... | 39,048 |
Score : 100 points Problem Statement We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? Constraints 1â€Xâ€10^9 1â€tâ€10^9 X and t are ... | 39,049 |
Sorting Tuples Write a program which reads $n$ items and sorts them. Each item has attributes $\{value, weight, type, date, name\}$ and they are represented by $\{$ integer, integer, upper-case letter, integer, string $\}$ respectively. Sort the items based on the following priorities. first by value (ascending) in cas... | 39,050 |
åèŠ§äŒ åé¡ JOI åžã§ã¯,ãšããå€§èŠæš¡ãªå芧äŒãéå¬ããããšã«ãªã£ã. ä»åã®å芧äŒã«ã¯ 2 ã€ã®ããŒãããã,JOI åžã«ãã N åã®å±ç€ºæœèšã§ãããã, 2 ã€ã®ããŒãã®ãã¡ã©ã¡ããäžæ¹ã«æ²¿ã£ãå±ç€ºãè¡ãäºå®ã§ãã. æœèšã®äœçœ®ã¯å¹³é¢åº§æš (x, y) ã§è¡šããã.äœçœ® (x, y) ã«ããæœèšãã (xâ² , yâ²) ã«ããæœèšãŸã§ç§»åããããã«ã¯, |x â xâ²| + |y â yâ²| ã ãã®æéãããã (æŽæ° a ã«å¯ŸããŠ, |a| ã§ a ã®çµ¶å¯Ÿå€ã衚ã).åäžããŒãå
ã§ã®çµ±äžæãåºããã,ããã³äžæ¹ã®ããŒãã®ã¿ã«é¢å¿ãæã€äººã«äžäŸ¿ãæããããªãããã«,åäžã®ããŒãã§å±ç€ºãè¡ã£ãŠãã 2 ã€ã®æœèšã®éã®ç§»åæé... | 39,051 |
D: å¿åºŠ (Surmise) ãšããååã¯ãå¶æ°ã奜ãã§ããã $N$ åã®æŽæ° $A_1, A_2, A_3, \dots, A_N$ ã®äžã«å¶æ°ãããã€ãããæ°ããã å
¥å 1 è¡ç®ã«ã¯æŽæ° $N$ ãäžããããã 2 è¡ç®ã«ã¯ $N$ åã®æŽæ° $A_1, A_2, A_3, \dots, A_N$ ã空çœåºåãã§äžããããã åºå å¶æ°ã®åæ°ãåºåããããã ããæåŸã«æ¹è¡ãå
¥ããããšã å¶çŽ $N$ 㯠$1$ ä»¥äž $100$ 以äžã®æŽæ° $A_1, A_2, A_3, \dots, A_N$ 㯠$1$ ä»¥äž $100$ 以äžã®æŽæ° å
¥åäŸ1 5 4 3 5 2 6 åºåäŸ1 3 $A_1 = 4$ã$A_4 = 2$... | 39,052 |
Hit and Blow Let's play Hit and Blow game. A imagines four numbers and B guesses the numbers. After B picks out four numbers, A answers: The number of numbers which have the same place with numbers A imagined (Hit) The number of numbers included (but different place) in the numbers A imagined (Blow) For example, if A i... | 39,053 |
Score : 700 points Problem Statement Given is a sequence of N digits a_1a_2\ldots a_N , where each element is 1 , 2 , or 3 . Let x_{i,j} defined as follows: x_{1,j} := a_j \quad ( 1 \leq j \leq N ) x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad ( 2 \leq i \leq N and 1 \leq j \leq N+1-i ) Find x_{N,1} . Constraints 2 \leq... | 39,054 |
Score : 1400 points Problem Statement We will recursively define uninity of a tree, as follows: ( Uni is a Japanese word for sea urchins.) A tree consisting of one vertex is a tree of uninity 0 . Suppose there are zero or more trees of uninity k , and a vertex v . If a vertex is selected from each tree of uninity k and... | 39,055 |
Problem A: Where is the Boundary An island country JAGAN in a certain planet is very long and narrow, and extends east and west. This long country is said to consist of two major cultural areas | the eastern and the western. Regions in the east tend to have the eastern cultural features and regions in the west tend to ... | 39,056 |
Articulation Points Find articulation points of a given undirected graph G(V, E) . A vertex in an undirected graph is an articulation point (or cut vertex) iff removing it disconnects the graph. Input |V| |E| s 0 t 0 s 1 t 1 : s |E|-1 t |E|-1 , where |V| is the number of vertices and |E| is the number of edges in the g... | 39,057 |
Score : 300 points Problem Statement There are N monsters, numbered 1, 2, ..., N . Initially, the health of Monster i is A_i . Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: A random alive monster attacks another random alive monster. As a resu... | 39,058 |
Score : 100 points Problem Statement Rng is going to a festival. The name of the festival is given to you as a string S , which ends with FESTIVAL , from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s " is a string obtained by appendin... | 39,059 |
Score : 200 points Problem Statement There are N balls in the xy -plane. The coordinates of the i -th of them is (x_i, i) . Thus, we have one ball on each of the N lines y = 1 , y = 2 , ... , y = N . In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i -th type-A... | 39,060 |
Score : 400 points Problem Statement There are N integers, A_1, A_2, ..., A_N , arranged in a row in this order. You can perform the following operation on this integer sequence any number of times: Operation : Choose an integer i satisfying 1 \leq i \leq N-1 . Multiply both A_i and A_{i+1} by -1 . Let B_1, B_2, ..., B... | 39,061 |
Score : 1800 points Problem Statement We have an N \times M grid. The square at the i -th row and j -th column will be denoted as (i,j) . Particularly, the top-left square will be denoted as (1,1) , and the bottom-right square will be denoted as (N,M) . Takahashi painted some of the squares (possibly zero) black, and p... | 39,062 |
Rectangle Write a program which calculates the area and perimeter of a given rectangle. Input The length a and breadth b of the rectangle are given in a line separated by a single space. Output Print the area and perimeter of the rectangle in a line. The two integers should be separated by a single space. Constraints 1... | 39,063 |
Score : 1300 points Problem Statement You are playing a game and your goal is to maximize your expected gain. At the beginning of the game, a pawn is put, uniformly at random, at a position p\in\{1,2,\dots, N\} . The N positions are arranged on a circle (so that 1 is between N and 2 ). The game consists of turns. At ea... | 39,064 |
Score : 1200 points Problem Statement One day Mr. Takahashi picked up a dictionary containing all of the N ! permutations of integers 1 through N . The dictionary has N ! pages, and page i ( 1 †i †N! ) contains the i -th permutation in the lexicographical order. Mr. Takahashi wanted to look up a certain permutation o... | 39,065 |
M: æååéå å顿 以äžã®æ¡ä»¶ãæºããæååéå $S$ ã®ãã¡ãèŠçŽ æ°ãæå€§ãšãªããã®ã $1$ ã€æ§æããŠãã ããã $S$ ã«å«ãŸããæååã®é·ã㯠$1$ ä»¥äž $N$ 以äžã§ããã $S$ ã«å«ãŸããæååã®é·ãã¯ããããç°ãªãã $S$ ã«å«ãŸããæååã¯ãæå 0 , 1 ã®ã¿ãããªãã $S$ ã«å«ãŸããã©ã® $2$ ã€ã®æååã«ã€ããŠããäžæ¹ãããäžæ¹ã®éšåæååãšãªããªãã ãã ããæåå $x$ ã®éšåæååãšã¯ã $x$ ã®å
é ãšæ«å°Ÿãã $0$ æå以äžã®æåãåãé€ãããšã§åŸãããæååã®ããšãèšããŸãã å¶çŽ $1 \leq N \leq 300$ $N$ ã¯æŽæ°ã§ãã å
¥å å
¥åã¯ä»¥äžã®åœ¢åŒã§æš... | 39,066 |
Score : 800 points Problem Statement Niwango has N cards, numbered 1,2,\ldots,N . He will now arrange these cards in a row. Niwango wants to know if there is a way to arrange the cards while satisfying all the N conditions below. To help him, determine whether such a way exists. If the answer is yes, also find the lexi... | 39,067 |
Problem H: Inherit the Spheres In the year 2xxx, an expedition team landing on a planet found strange objects made by an ancient species living on that planet. They are transparent boxes containing opaque solid spheres (Figure 1). There are also many lithographs which seem to contain positions and radiuses of spheres. ... | 39,068 |
äžéãªã€ã¯ã¿åã¯æã£ãŠãã倧äºãªæåå T ããŠã£ã«ã¹ã«ãã£ãŠç°ãªãæåå T' ã«æžãæããããŠããŸã£ãããã®ãŠã£ã«ã¹ã T ã®ïŒæåãç°ãªãæåã«æžãæããŠããŸã£ãããšãããã£ãŠãããããªãã¡ T ãš T' ã¯ã¡ããã©ïŒæåã®ã¿ç°ãªã£ãŠãããã€ã¯ã¿å㯠T ã埩å
ããããã«ã T ãåºçŸããŠãããšæãããææž S ãçšæããã T ã埩å
ããããã®äžæºåãšã㊠S ã®éšåæååã§ T ãšäžèŽããŠããå¯èœæ§ããããã®ã®åæ°ã調ã¹ããã æåå T' ãšææž S ãäžããããã S = a 1 a 2 a 3 . . . a |S| ã®é·ã |T'| ã®éšåæåå a k a k+1 . . . a k+|T'|â1 (1 †k ... | 39,069 |
åé¡ A : ããã°ã©ãã³ã°ã³ã³ãã¹ã æã¯ 20XX 幎ïŒäžç㯠Gââgle ç€Ÿã®æ¯é
ã«ãããã£ã¹ããã¢ã§ããïŒ çŸåšïŒäººã
ã®å𝿥œã¯ããã°ã©ãã³ã°ã³ã³ãã¹ãã«éãããŠããïŒ äŸãã°ïŒé±æ«ã«å®¶æã§ TâpCâder ã¢ãªãŒãã蚪ãããšããã®ã¯ãšãŠãããèŠãããå
æ¯ã§ããïŒ ãããïŒããã¯å
ã®äžçã®ããã°ã©ãã³ã°ã³ã³ãã¹ãã®å§¿ã«éããªãïŒ äžæ¹ã§ïŒGââgle ãšåæå¢åãã¶ã€ããåãéã®äžçã§ã¯ïŒ åœããããããã°ã©ãã³ã°ã³ã³ãã¹ããè¡ãããŠããïŒ èªåãä¹
ãã¶ãã«ããã°ã©ãã³ã°ã³ã³ãã¹ãã«åå ããŠã¿ããïŒ è¶³æ
£ããã«ïŒãŸãã¯ïŒããã°ã©ãã³ã°ã³ã³ãã¹ãã®çµæãåŠçããããã°ã©ã ã§ãæžããŠã¿ãããšã«ãããïŒ åé¡ M 人ã®åå è
ãå±
... | 39,070 |
å¹³æ¹æ¡äžæ³ å€å
žçãªä¹±æ°çææ¹æ³ã®äžã€ã§ããå¹³æ¹æ¡äžæ³ã®ããã°ã©ã ãäœæããŸããå¹³æ¹æ¡äžæ³ã¯ããã©ã³ãã€ãã³ã«ãã£ãŠ 1940 幎代åã°ã«ææ¡ãããæ¹æ³ã§ãã å¹³æ¹æ¡äžæ³ã¯ãçæããä¹±æ°ã®æ¡æ°ã n ãšãããšããåæå€ s ã®2ä¹ãèšç®ãããã®æ°å€ã 2n æ¡ã®æ°å€ãšã¿ãŠãïŒäžã®äŸã®ããã« 2 ä¹ããæ¡æ°ãè¶³ããªããšãã¯ã0 ãè£ããŸããïŒãã®äžå€®ã«ãã n åã®æ°åãæåã®ä¹±æ°ãšããŸããæ¬¡ã«ãã®ä¹±æ°ã 2 ä¹ããŠãåãæ§ã«ãäžå€®ã«ãã n åã®æ°åããšã£ãŠã次ã®ä¹±æ°ãšããŸããäŸãã°ã123 ãåæå€ãšãããš 123 2 = 00015129 â 0151 151 2 = 00022801 â 0228 228 2 = 000519... | 39,071 |
æ°Žãããã (Mizuyokan) å顿 æ°Žãããããšã¯ïŒããã«å°è±ãããªã逡ãåã«æµã蟌ãã§å¯å€©ã§åºããããšã«ããäœãããåèåã§ããïŒããŸïŒJOI åã®æå
ã«ã¯ïŒæšªé·ã®çŽæ¹äœã®åœ¢ãããæ°Žãããããã²ãšã€ããïŒJOI åã¯ïŒä»æ¥ã®ããã€ãšããŠãã®æ°Žãããããé£ã¹ãäºå®ã§ããïŒ ãã®æ°Žããããã«ã¯ïŒçžŠæ¹åã®åãç®ãå
šéšã§ N-1 ç®æã«å
¥ã£ãŠããïŒæ°Žããããã®é·ã㯠L_1 + L_2 + ... + L_N ã§ããïŒ i çªç® (1 ⊠i ⊠N-1) ã®åãç®ã¯ïŒå·Šãã L_1 + L_2 + ... + L_i ã®äœçœ®ã«ããïŒ ãã®æ°Žããããã¯äžžããšé£ã¹ãã«ã¯å€§ããããã®ã§ïŒJOI åã¯ïŒæ°Žããããã«å
¥ã£ãŠããåãç®ãã ... | 39,072 |
ç¯ç¯ äŒæŽ¥è¥æŸåžã¯ãæŽå²ã®çºããšããŠç¥ãããŠããŸããä»ããçŽ 400 幎åãè²çæ°é·ã«ããåäžçºã®éªšæ ŒãäœãããŸãããããã®åŸã埳å·äžä»£å°è»å®¶å
å
¬ã®ç°æ¯åŒãä¿ç§æ£ä¹ãå
¬ãè©ç¥ãšããäŒæŽ¥è© 23 äžç³ã®äžå¿éœåžãšããŠçºå±ããŸãããä»ã§ãåžå
ã®ããããšããã«å²è·¡ãææ¥ã®é¢åœ±ãæ®ã£ãŠãããããæ¯å¹Žãå
šåœããå€ãã®èгå
客ã蚪ããŠããŸãã ä»å¹Žã¯ã倧河ãã©ãã§ãæ°éžçµïŒããæŸéãããŠãããããæ°éžçµãããã®å°(*1)ãšããŠã倧å¹
ã«èгå
客ãå¢å ããŠããŸããããã§åžã§ã¯ãåžå
ã«ç¹åšããå²è·¡ãçµã¶éãæ²¿ãã« 100 m ééã§ç¯ç¯ãèšçœ®ããŠé£ŸãããŠãããšã«ããŸãããç¯ç¯ã食ã£ãŠããéãã蟿ãã°åžå
ã®å
šãŠã®å²è·¡ã«å°éã§ããããã«èšçœ®ããããšãæ¡... | 39,073 |
Extraordinary Girl (I) She is an extraordinary girl. She works for a library. Since she is young and cute, she is forced to do a lot of laborious jobs. The most annoying job for her is to put returned books into shelves, carrying them by a cart. The cart is large enough to carry many books, but too heavy for her. Since... | 39,074 |
ææã€ãã€ã
ã®è³æº 人é¡ã¯ã€ãã«ç¥ççåœäœã®ååšããææã€ãã€ã
ãçºèŠãããææã€ãã€ã
ã§ã¯ç§åŠã鲿©ããŠããã®ã§ãæ¬¡ç¬¬ã«æã
ãšã®å
±åç ç©¶ãçãã«ãããªãããããã«ãªã£ãã ææã€ãã€ã
ã§ã¯ãã³ãšããè«ãéèŠãªè³æºãšã¿ãªãããŠããããã³ã¯å¹Œè«ãããåããŠæè«ã«ãªãããã³ã®çæ¯åã§ã¯ãã³ã®å¹Œè«ã矀ããŠçæ¯ããŠãã矀çãããã€ãããããã®ãããªçŸ€çãäžåã«äžŠãã§ãããææã€ãã€ã
ã®ãã€ãªãã¯ãããžãŒã䜿ããšã矀çã«å¯ŸããŠä»¥äžã®ãããªæäœãã§ããã æå®ããç¯å²ã®ãã¹ãŠã®çŸ€çã«ãåãæ°ã®å¹Œè«ã远å ããã æå®ããç¯å²ã®ãã¹ãŠã®çŸ€çã§ãæå®ããæ°ã®å¹Œè«ãæè«ã«ãåããããåãã幌è«ã®æ°ã®åèšãæ±ããããã®ãšãããåããã幌è«ã®æ°ãäžã€ã ãæ... | 39,075 |
Shortest Common Non-Subsequence A subsequence of a sequence $P$ is a sequence that can be derived from the original sequence $P$ by picking up some or no elements of $P$ preserving the order. For example, " ICPC " is a subsequence of " MICROPROCESSOR ". A common subsequence of two sequences is a subsequence of both seq... | 39,076 |
H - N and K 1ä»¥äž N 以äžã®æŽæ°ãããªãç矩å調å¢å æ°åã§ïŒæ°åã®èŠçŽ ããã©ã®2ã€ã®ç°ãªãæ°ãåã£ãŠããŠã 仿¹ãäžæ¹ãå²ãåãããšããªããããªãã®ãèããïŒ ãã®ãããªæ°åã®ãã¡ïŒãšãããæå€§ã®é·ãã L ãšããŠïŒãã®ãããªæ°å (a_1,a_2,...,a_L) ãèããïŒ ãã®æ°åã® K çªç®ã®èŠçŽ a_K ãæ±ããïŒãã ãïŒãã®ãããªæ°å (a_1...a_L) ãè€æ°åååšããå Žåã¯ïŒ a_K ã®å€ãšããŠãšãããæå°ã®å€ãåºåããïŒ ãŸãïŒ K > L ã®ãšãã¯-1ãåºåããïŒ å
¥ååœ¢åŒ å
¥åã¯è€æ°ã®å
¥åãããªãïŒå
¥åã®æ°ã¯ C ã»ããããïŒ i çªç®ã®å
¥å㯠N_i, K_i ã§ããïŒ ãã¹ãã±ãŒã¹ã¯ä»¥äžã®... | 39,077 |
Problem B: Båé¡ R倧åŠã®2D奜ãã®äººãã¡ (2DRespecters)ã¯ãA接倧åŠã§éå¬ãããããã°ã©ãã³ã°ã®ç·Žç¿å宿ã«åå ããã ãã®ç·Žç¿å宿ã§ã¯ãåå è
ãã¡ãèªäœã®ããã°ã©ãã³ã°åé¡ãæã¡å¯ããç·Žç¿ã«çšããã 2DRespectersããããã€ãã®åé¡ãäœæããããšã«ãªã£ãã ããããå宿ã®3æ¥åã«ãªã£ãŠãããŸã ãBåé¡ã宿ããŠããªãã£ãã æåã®Båé¡ã®æ
åœè
ãäœæããåé¡ã¯ãæ
åœè
ãåé¡ã®å¶çŽãé£ãããéããŠããŸã£ããããCåé¡ä»¥éã«ãŸããããŠããŸã£ãã®ã ã ãããŠãç°¡åãããŠããé£ããããŠããããªãã埮åŠãªé£æåºŠã®èª¿æŽãå¿
èŠãšãããBåé¡ã¯ã誰ããæãä»ãããããªãã£ãã ãã以æ¥ãBå顿
åœè
ã®æ€
åã¯ç©ºåž... | 39,078 |
Problem K: 黿³¢åºå° 20XX幎ïŒé·å¹Žã®ç ç©¶ãå®ãçµã³ïŒ ç¡ç·ã«ãããšãã«ã®ãŒéåä¿¡ã®æè¡ãå®çšåãããïŒ ãã®æè¡ãå©çšããããšã§ïŒ ã³ã¹ããèŠåããä»ãŸã§é»åç·ãåŒãããšãã§ããªãã£ãéçå°ã«ã é»åãäŸçµŠããããšãå¯èœãšãªã£ãïŒ ãã®æè¡ã«ã¯å°ãããããã£ãŠïŒ ã©ããŸã§ãé ãã«ãšãã«ã®ãŒãéãããšãã§ããã®ã ãïŒ ç¹å®ã®äœçœ®ã§ãã黿³¢ã®åä¿¡ãã§ããªããšããå¶çŽãååšããïŒ ã€ãŸãïŒäžçã2次å
å¹³é¢ã§è¡šãïŒ y 軞æ£ã®æ¹åãåïŒ x 軞æ£ã®æ¹åãæ±ãšãããšïŒ x 座æšã» y 座æšããšãã«æŽæ°ã®å°ç¹ã§ãã 黿³¢ãåä¿¡ããããšãã§ããªãïŒäœçžã®åé¡ã§ããïŒïŒ ãŸãïŒåºå°ïŒé»æ³¢ã®éåä¿¡ãå¯èœãªèšåïŒ ããèŠãŠ8æ¹äœïŒæ±ã»è¥¿ã»... | 39,079 |
Score : 800 points Problem Statement In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 and K (inclusive) are listed. Let the total number of sequences listed in FEIS be X . Among those sequences, find the (X/2) -th (rounded ... | 39,081 |
Score : 400 points Problem Statement Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: Hit his pocket, which magically increases the number of biscuits by one. Exchange A biscuits to 1 yen. Exchange 1 yen t... | 39,082 |
Score : 200 points Problem Statement Alice, Bob and Charlie are playing Card Game for Three , as below: At first, each of the three players has a deck consisting of some number of cards. Each card has a letter a , b or c written on it. The orders of the cards in the decks cannot be rearranged. The players take turns. A... | 39,083 |
Topological Sort A directed acyclic graph (DAG) can be used to represent the ordering of tasks. Tasks are represented by vertices and constraints where one task can begin before another, are represented by edges. For example, in the above example, you can undertake task B after both task A and task B are finished. You ... | 39,084 |
Score : 600 points Problem Statement There are N people, conveniently numbered 1 through N . We want to divide them into some number of groups, under the following two conditions: Every group contains between A and B people, inclusive. Let F_i be the number of the groups containing exactly i people. Then, for all i , e... | 39,085 |
Score : 400 points Problem Statement A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1 . For example, 1234 , 1 , ... | 39,086 |
Longest Common Subsequence For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \{a,b,c,b,d,a,b\}$ and $Y = \{b,d,c,a,b,a\}$, the sequence $\{b,c,a\}$ is a common subsequence of both $X$ and $Y$. On the other hand, t... | 39,087 |
ç
é¢ã®éšå±çªå· ãŠã©ãŒã¿ãŒããã³ã«äœã建ç¯å®¶ã®ããã³ããŒããã®ããšã«ãå€ã倧ç
é¢ãæ¹è£
ããä»äºã®äŸé Œãèã蟌ãã§ããŸããã åœã«ãã£ãŠã¯å¿ã¿æ°(ãã¿ãã)ãšããŠå«ãããæ°åãéšå±çªå·ã«çšããããªã人ãããŸã(æ¥æ¬ã§ã¯ 4 ãš 9 ãæåã§ã)ããããããã®ç
é¢ã®éšå±çªå·ã¯å¿ã¿æ°ã«é¢ä¿ãªãã1 ããé çªã«ä»ããããŠããŸããã ãããæ°ã«ãªã£ãããã³ããŒããã¯ãæ©æããããã®å
¥ãæ¿ããå
šãŠçµããåã«ãŠã©ãŒã¿ãŒããã³ã®å¿ã¿æ°ã§ããã4ããšã6ããé€ããæ°åã§éšå±çªå·ãä»ããªãããŠããŸããŸãããããããå
¥ãæ¿ãäœæ¥ã¯æ§éšå±çªå·ã§èšç»ããŠããã®ã§ãæ®ãã®äœæ¥ã確å®ã«è¡ãã«ã¯æ§éšå±çªå·ãæ°éšå±çªå·ã«å€æããå¿
èŠããããŸããèšç®ãèŠæãªããã³ããŒ... | 39,088 |
Score : 100 points Problem Statement A professor invented Cookie Breeding Machine for his students who like cookies very much. When one cookie with the taste of x is put into the machine and a non-negative integer y less than or equal to 127 is input on the machine, it consumes the cookie and generates two cookies with... | 39,089 |
Score : 600 points Problem Statement Given is an integer sequence of length N+1 : A_0, A_1, A_2, \ldots, A_N . Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N , there are exactly A_d leaves at depth d ? If such a tree exists, print the maximum possible number of vertices in such a tree; otherw... | 39,090 |
Problem L: The Tower Your task is to write a program that reads some lines of command for the following game and simulates operations until the player reaches the game over. We call following 2-dimensional grid of m by n characters Tower. The objective of this game is to move blocks in the tower to climb to a goal bloc... | 39,091 |
On or Off Saving electricity is very important! You are in the office represented as R \times C grid that consists of walls and rooms. It is guaranteed that, for any pair of rooms in the office, there exists exactly one route between the two rooms. It takes 1 unit of time for you to move to the next room (that is, the ... | 39,092 |
Score : 200 points Problem Statement In Japan, people make offerings called hina arare , colorful crackers, on March 3 . We have a bag that contains N hina arare. (From here, we call them arare.) It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pin... | 39,093 |
Array Update Problem é
æ° N ãåé
a ãå
¬å·® d ã®çå·®æ°å A ãããã以äžã®åœ¢åŒã§æ°åãæŽæ°ããåœä»€æã M åäžããããã®ã§ãäžããããé åºã§æ°å A ã M åæŽæ°ãããšãã® K é
ç®ã®å€ãæ±ããã i çªç®ã®åœä»€æã¯3ã€ã®æŽæ° x i , y i , z i ã§è¡šããã(1 †i †M )ã x i ã0ã ã£ãå Žåã y i é
ç®ã®å€ãš z i é
ç®ã®å€ãå
¥ãæ¿ããã x i ã1ã ã£ãå Žåã y i é
ç®ã®å€ã z i é
ç®ã®å€ã«æžãæããã Input N a d M x 1 y 1 z 1 x 2 y 2 z 2 ... x M y M z M K 1è¡ç®ã«ã1ã€ã®æŽæ° N ãäžãããã... | 39,094 |
Score : 400 points Problem Statement N people are arranged in a row from left to right. You are given a string S of length N consisting of 0 and 1 , and a positive integer K . The i -th person from the left is standing on feet if the i -th character of S is 0 , and standing on hands if that character is 1 . You will gi... | 39,095 |
çŸè¡å±(Art Exhibition) JOI åœã§çŸè¡å±ãè¡ãããããšã«ãªã£ãïŒçŸè¡å±ã§ã¯ïŒåœäžããéãŸã£ãæ§ã
ãªçŸè¡åãå±ç€ºãããäºå®ã§ããïŒ å±ç€ºãããçŸè¡åã®åè£ãšããŠïŒ N ç¹ã®çŸè¡åãéãŸã£ãïŒãããã®çŸè¡åã«ã¯ 1, 2, ..., N ã®çªå·ãä»ããããŠããïŒããããã®çŸè¡åã«ã¯å€§ãããšäŸ¡å€ãšåŒã°ããå€ãå®ãŸã£ãŠããïŒçŸè¡å i (1 \leq i \leq N) ã®å€§ãã㯠A_i ïŒäŸ¡å€ã¯ B_i ã§ããïŒ çŸè¡å±ã§ã¯ïŒãããã®çŸè¡åã®ãã¡ãã1 ç¹ä»¥äžãéžãã§å±ç€ºããïŒçŸè¡å±ã®äŒå Žã¯ååã«åºãïŒ N ç¹ã®çŸè¡åãã¹ãŠãå±ç€ºããããšãå¯èœã§ããïŒãããïŒJOI åœã®äººã
ã®çŸçæèŠã®ããïŒçŸè¡åã®éã§å€§ããã®å·®ãã... | 39,096 |
7 ããºã« 7 ããºã«ã¯ 8 ã€ã®æ£æ¹åœ¢ã®ã«ãŒããšãããã®ã«ãŒãããŽãããšåãŸãæ ã§æ§æãããŠããŸããããããã®ã«ãŒãã«ã¯ãäºãã«åºå¥ã§ããããã« 0, 1, 2, ..., 7 ãšçªå·ãã€ããããŠããŸããæ ã«ã¯ã瞊㫠2 åãæšªã« 4 åã®ã«ãŒãã䞊ã¹ãããšãã§ããŸãã 7 ããºã«ãå§ãããšãã«ã¯ããŸãæ ã«ãã¹ãŠã®ã«ãŒããå
¥ããŸããæ ã®ãªãã§ 0 ã®ã«ãŒãã ãã¯ãäžäžå·Šå³ã«é£æ¥ããã«ãŒããšäœçœ®ã亀æããããšãã§ããŸããããšãã°ãæ ã®ç¶æ
ãå³(a) ã®ãšãã«ã0 ã®ã«ãŒãã®å³ã«é£æ¥ããã7 ã®ã«ãŒããšäœçœ®ã亀æããã°ãå³(b) ã®ç¶æ
ã«ãªããŸãããããã¯ãå³(a) ã®ç¶æ
ãã 0 ã®ã«ãŒãã®äžã«é£æ¥ãã 2 ã®ã«ãŒããšäœçœ®ã亀æãã... | 39,097 |
Problem B: Step Step Evolution Japanese video game company has developed the music video game called Step Step Evolution. The gameplay of Step Step Evolution is very simple. Players stand on the dance platform, and step on panels on it according to a sequence of arrows shown in the front screen. There are eight types o... | 39,098 |
Fun Region Dr. Ciel lives in a planar island with a polygonal coastline. She loves strolling on the island along spiral paths. Here, a path is called spiral if both of the following are satisfied. The path is a simple planar polyline with no self-intersections. At all of its vertices, the line segment directions turn c... | 39,099 |
ãã§ãŠããšããè¡ã¯å€ã寺瀟ä»é£ã§æåãªèгå
å°ã§ããã ã€ã¯ã¿åã¯æ°äººã®å人ãšãã§ãŠã芳å
ã«æ¥ãŠããããå
šå¡ã奜ãåæã«è¡åããçµæãã¿ããªè¿·åã«ãªã£ãŠããŸã£ãã ããã§ã€ã¯ã¿åã¯ããªãã¹ãæ©ãå
šå¡ãšåæµããããã«ã¯éåå Žæãã©ãã«ããã®ããããèããããšã«ããã ãã§ãŠãã®éè·¯ã¯æ±è¥¿ãšååã«è·é¢10ã®ééã§ç¡æ°ã«èµ°ã£ãŠãããç¡éã«åºããæ£æ¹æ Œåãšã¿ãªãããšãã§ããã éè·¯ã¯çŽç·ã§ãããšã¿ãªããå¹
ã¯ç¡ããã®ãšããã ãŸããè¡ã®äžå¿ãåºæºãšããŠæ±ã«è·é¢ x ãåã«è·é¢ y ç§»åããäœçœ®ã (x,y) ãšãã座æšã§è¡šãã è¡ã®äžå¿ã§ãã (0,0) ã§ã¯æ±è¥¿ã®éè·¯ãšååã®éè·¯ã亀差ããŠããã äžå³ã¯ãã§ãŠãã®éè·¯ãšãããã€ãã®ç¹ã®åº§æšãå³... | 39,100 |
Problem D: Weather Forecast You are the God of Wind. By moving a big cloud around, you can decide the weather: it invariably rains under the cloud, and the sun shines everywhere else. But you are a benign God: your goal is to give enough rain to every field in the countryside, and sun to markets and festivals. Small hu... | 39,101 |
Score : 800 points Problem Statement 12:17 (UTC): The sample input 1 and 2 were swapped. The error is now fixed. We are very sorry for your inconvenience. There are N children in AtCoder Kindergarten, conveniently numbered 1 through N . Mr. Evi will distribute C indistinguishable candies to the children. If child i is ... | 39,102 |
Score : 1000 points Problem Statement Niwango-kun has \(N\) chickens as his pets. The chickens are identified by numbers \(1\) to \(N\), and the size of the \(i\)-th chicken is a positive integer \(a_i\). \(N\) chickens decided to take each other's hand (wing) and form some cycles. The way to make cycles is represented... | 39,103 |
Problem C: ã©ã㌠ããªãã®åéã¯æè¿ UT-Rummy ãšããã«ãŒãã²ãŒã ãæãã€ããïŒ ãã®ã²ãŒã ã§äœ¿ãã«ãŒãã«ã¯èµ€ã»ç·ã»éã®ããããã®è²ãš1ãã9ãŸã§ã®ããããã®çªå·ã ã€ããããŠããïŒ ãã®ã²ãŒã ã®ãã¬ã€ã€ãŒã¯ãããã9æã®ææãæã¡ïŒ èªåã®ã¿ãŒã³ã«ææãã1æéžãã§æšãŠãŠïŒ 代ããã«å±±æãã1æåŒããŠãããšããããšãç¹°ãè¿ãïŒ ãã®ããã«é çªã«ã¿ãŒã³ãé²ããŠããïŒ æåã«ææã¡ã®ã«ãŒãã«3æãã€3ã€ã®ãã»ããããäœã£ããã¬ã€ã€ãŒãåã¡ãšãªãïŒ ã»ãããšã¯ïŒåãè²ã®3æã®ã«ãŒããããªãçµã§ïŒãã¹ãŠåãæ°ãæã£ãŠããã é£çªããªããŠãããã®ã®ããšãèšãïŒ é£çªã«é¢ããŠã¯ïŒçªå·ã®å·¡åã¯èªããããªãïŒ äŸãã°ïŒ7, 8... | 39,104 |
I - The J-th Number Problem Statement You are given N empty arrays, t_1, ..., t_n . At first, you execute M queries as follows. add a value v to array t_i ( a \leq i \leq b ) Next, you process Q following output queries. output the j -th number of the sequence sorted all values in t_i ( x \leq i \leq y ) Input The data... | 39,106 |
Problem K Counting Cycles Given an undirected graph, count the number of simple cycles in the graph. Here, a simple cycle is a connected subgraph all of whose vertices have degree exactly two. Input The input consists of a single test case of the following format. $n$ $m$ $u_1$ $v_1$ ... $u_m$ $v_m$ A test case represe... | 39,107 |
æªæåºè
ã¯èª°ã åé¡ JOI倧åŠã®Mææã¯ããã°ã©ãã³ã°ã®ææ¥ãæ
åœããŠããïŒã¯ã©ã¹ã«ã¯30人ã®åè¬çãããŠååè¬çã«ã¯1çªãã30çªãŸã§ã®åºåžçªå·ããµãããŠããïŒãã®ææ¥ã®èª²é¡ã28人ã®åŠçãæåºããïŒæåºãã28人ã®åºåžçªå·ããæåºããŠããªã2人ã®åºåžçªå·ãæ±ããããã°ã©ã ãäœæããïŒ å
¥å å
¥åã¯28è¡ããïŒåè¡ã«ã¯æåºè
ã®åºåžçªå·ïŒ1以äž30以äžïŒã1ã€ãã€æžãããŠããïŒå
¥åãããåºåžçªå·ã«éè€ã¯ãªããïŒã©ã®ãããªé ã«å
¥åããããã¯ããããªãïŒ åºå åºåã¯2è¡ãããªãïŒ 1è¡ç®ã«2äººã®æªæåºè
ã®åºåžçªå·ã®ãã¡å°ããã»ããïŒ 2è¡ç®ã«å€§ããã»ããåºåããïŒ å
¥åºåäŸ å
¥åäŸ 1 3 1 4 5 7 9 6 10 11 12 ... | 39,108 |
Official House You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b , f , r and v which represent that v persons entered to ... | 39,109 |
æèšŒçªå· æ°ããæèšŒçªå·ã¯èŠãã«ãããã®ã§ããã¡ã¢ããã®ã¯ãã¡ãšããããŸããããèŠãããããã«ãããŸãããããã§æç« ã®äžã«æ°å€ãåã蟌ãã§æèšŒçªå·ãã¡ã¢ããããšã«ããŸãããããã§ã¯å
šãŠã®æ°å€ã®åãæèšŒçªå·ã«ãªããŸãã ã¡ã¢ãããæç« ãèªã¿èŸŒãã§ãæèšŒçªå·ãåºåããããã°ã©ã ãäœæããŠãã ããã Input æ£ã®æŽæ°ãåã蟌ãŸããæç« ãè€æ°è¡ã«ãããäžããããŸããåè¡ã¯åè§è±æ°åãèšå·ã空çœãå«ãæååãŸãã¯ç©ºè¡ã§ãã ãã ããå
¥å㯠1 è¡ããã 80 æå以å
ã§ãæèšŒçªå·ã¯ 10,000 以äžã§ããããšãä¿éãããŠããŸãã Output æèšŒçªå·ïŒæç« äžã®æ£ã®æŽæ°ã®åèšïŒãïŒè¡ã«åºåããŸãã Sample Input Therea... | 39,110 |
H: Revenge of UMG åé¡ 'U', 'M', 'G' ã®äžçš®é¡ã®æåãããªãæåå T ã«å¯Ÿãã 1, 2, ..., |T| æåç®ããããã T_1, T_2, ..., T_{|T|} ãšè¡šãããšã«ãããšãã以äžã®æ¡ä»¶ãæºãã (i, j, k) ã®çµã®åæ°ããæåå T ã® âUMG æ°âãšåŒã¶ããšã«ããŸã: 1 \leq i < j < k \leq |T| j - i = k - j T_i = 'U', T_j = 'M', T_k = 'G' ããŠã'U', 'M', 'G', '?' ã®åçš®é¡ã®æåãããªãæåå S ãäžããããŸãã S ã® '?' ããããã 'U', 'M', 'G' ã®ããã... | 39,111 |
A: 磯éãããããããïŒ - Sendame - ç©èª äžå³¶ã磯éãïŒããããããïŒã 磯éãããã£ãŠäœã ãïŒäžå³¶ã äžå³¶ãã»ãïŒããã ãïŒããïŒãªããæåã§è¡šããªãããªããªãããïŒèª¬æãã¥ãããªãã 磯éãããïŒå³ãåçãå
¥ããããã¿ããã ãïŒã äžå³¶ãæ¬åœã ïŒã 磯éãã§ïŒäœããããã ïŒã äžå³¶ãã»ãïŒãªãºã ã«ä¹ã£ãŠïŒæã2åå©ããåŸã«ïŒé²åŸ¡ïŒæºãïŒæ»æã®ããŒãºãåããã€ã 磯éããããïŒã€ãã€ãããããªããªâŠã äžå³¶ã2åæãå©ããåŸã«ïŒäŸãã°é²åŸ¡ã ã£ããã äžå³¶ãã§ïŒæºãã ã£ããã äžå³¶ãæ»æã ã£ããã äžå³¶ãã£ãŠãããã€ïŒç¥ã£ãŠãã ãïŒã 磯éãããïŒåçãå
¥ããšåçã«åããããããªããªïŒã äžå³¶ããããææã®é²æ©ã ãªïŒ... | 39,112 |
Score : 100 points Problem Statement We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one with the string U written on it and throws it away. Find the number of balls with the string S and balls with the string T that we... | 39,114 |
Largest Rectangle Given a matrix ( H Ã W ) which contains only 1 and 0, find the area of the largest rectangle which only contains 0s. Input H W c 1,1 c 1,2 ... c 1,W c 2,1 c 2,2 ... c 2,W : c H,1 c H,2 ... c H,W In the first line, two integers H and W separated by a space character are given. In the following H lines,... | 39,115 |
Score : 100 points Problem Statement There is a directed graph G with N vertices and M edges. The vertices are numbered 1, 2, \ldots, N , and for each i ( 1 \leq i \leq M ), the i -th directed edge goes from Vertex x_i to y_i . G does not contain directed cycles . Find the length of the longest directed path in G . Her... | 39,116 |
Score : 100 points Problem Statement Given an integer N not less than 3 , find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. Constraints 3 \leq N \leq 100 Input Input is given from Standard Input in the following format: N Output Print an integer ... | 39,118 |
Score : 1000 points Problem Statement You are given an integer sequence of length N : A_1,A_2,...,A_N . Let us perform Q operations in order. The i -th operation is described by two integers X_i and Y_i . In this operation, we will choose one of the following two actions and perform it: Swap the values of A_{X_i} and A... | 39,119 |
Score : 100 points Problem Statement How many hours do we have until New Year at M o'clock (24-hour notation) on 30 th, 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 30 th, December, print x . Sa... | 39,120 |
Score: 600 points Problem Statement How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"? The answer can be enormous, so print it modulo (10^9+7) . Constraints K is an integer between 1 and 10^6 (inclusive). S i... | 39,122 |
Score : 700 points Problem Statement We have N cards numbered 1, 2, ..., N . Card i ( 1 \leq i \leq N ) has an integer A_i written in red ink on one side and an integer B_i written in blue ink on the other side. Initially, these cards are arranged from left to right in the order from Card 1 to Card N , with the red num... | 39,123 |
Shell Sort Shell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+g] = A[j] 7 j = j - g 8 cnt++ 9 A[j+g] = v 10 11 shellSort(A, n) 12 cnt = 0 13 m = ? 14 G[] = {?, ?,..., ?} 15 for i = 0 ... | 39,124 |
B : RUPC å顿 ãã·ã¢é£éŠã§ããã°ã©ãã³ã°ã³ã³ãã¹ããéå¬ããããã³ã³ãã¹ãã«ã¯ N åã®åé¡ãåºé¡ããã M 人ã®åå è
ããããåé¡ i ã«ã¯åŸç¹ a_i ãèšå®ãããŠãããåå è
j ã®å®å㯠b_j ã§ããããšãããã£ãŠãããåé¡ i ãšåå è
j ã«ã€ããŠã a_i †b_j ã®ãšããã€ãã®ãšãéããåå è
j ã¯åé¡ i ãå¿
ãè§£ãããšãã§ããã ã³ã³ãã¹ããéããåå è
ã®åŸç¹ã¯ããã®äººãè§£ãããšãã§ããåé¡ã®åŸç¹ã®ç·åã§ããããŸããåå è
j ã¯ããã®ã³ã³ãã¹ãã§ã®ç®æšç¹æ° c_j ãå®ããŠããã ååå è
ããç®æšç¹æ°ä»¥äžã®åŸç¹ãç²åŸã§ãããå€å®ããã å
¥å å
¥åã¯ä»¥äžã®åœ¢åŒã§äžããããã N a_{0} a... | 39,125 |
Problem B: Repeated Substitution with Sed Do you know "sed," a tool provided with Unix? Its most popular use is to substitute every occurrence of a string contained in the input string (actually each input line) with another string β . More precisely, it proceeds as follows. Within the input string, every non-overlappi... | 39,126 |
Score : 200 points Problem Statement We have a string S consisting of uppercase English letters. Additionally, an integer N will be given. Shift each character of S by N in alphabetical order (see below), and print the resulting string. We assume that A follows Z . For example, shifting A by 2 results in C ( A \to B \t... | 39,127 |
Problem E: The Number of the Real Roots of a Cubic Equation Description 3次æ¹çšåŒïŒ ãäžããããã®ã§ïŒãã®æ£ã®å®æ°æ ¹ã®åæ°ïŒè² ã®å®æ°æ ¹ã®åæ°ããããã調ã¹ãŠæ¬²ããïŒ æ ¹ã®åæ°ã¯ïŒéæ ¹ãå«ããŠæ°ãããã®ãšããïŒ Input å
¥åã¯è€æ°ã®ãã¹ãã±ãŒã¹ãããªãïŒ1è¡ç®ã«ã¯ãã®åæ°ãèšãããïŒ 2è¡ç®ä»¥é㯠a b c d ã®åœ¢åŒã§3次æ¹çšåŒã®ä¿æ°ãèšãããïŒ a ã¯0ã§ã¯ãªãïŒãŸãããããã®æ°ã¯-100ãã100ãŸã§ã®æŽæ°å€ã§ããïŒ Output äžãããã3次æ¹çšåŒã«å¯ŸãïŒæ£ã®å®æ°æ ¹ã®åæ°ïŒè² ã®å®æ°æ ¹ã®åæ°ãã¹ããŒã¹ã§åºåã£ãŠåºåããïŒ Sample Input ... | 39,128 |
äœè²ïŒ ãŠã§ããã¶ã€ããŒãç®æã倪éåã¯ãã ããŸä¿®è¡äžãäºåæã®å
茩ããããã®ããŒãžã®èæ¯è²ã¯#ffe085ã§ããšããŠã§ããã¶ã€ã³ç¹æã®è²çªå·ã§æç€ºãããã®ã§ããããããã©ããªè²ããããšæãæµ®ãã¹ãããšãã§ããŸããã ãã®è²çªå·ã¯å
ã®äžåè²ã§ããèµ€ãç·ãéããããã®åŒ·ãã衚ãããŠããŸããå
·äœçã«ã¯2 æ¡ã® 16 鲿°ã3 ã€çµã¿åããããã®ã§ãè²çªå·ãâ#RGBâãšãããšããR ã¯èµ€ã®åŒ·ããG ã¯ç·ã®åŒ·ããã¯éã®åŒ·ãã衚ããŸãããããã 00 ãã ff ãŸã§ã®å€ã«ãªããŸãã è²çªå·ã«ãŸã äžæ
£ããªå€ªéåã®ããã«ãè²çªå·ãå
¥åãšããè²ã®è¡šã®äžãããã£ãšãè¿ãè²ã®åå ãåºåããããã°ã©ã ãäœæããŠãã ããã䜿çšããè²ã®è¡šã¯ä»¥äžã®éãã§... | 39,129 |
é»é£Ÿ(Illumination) JOI 髿 ¡ã®æåç¥ã§ã¯æ¯å¹Žå»äžã«é»é£Ÿã食ãããïŒé»é£Ÿã¯ N åã®é»çã§æ§æãããŠããïŒé»çã¯å»äžã®è¥¿åŽããæ±åŽã«äžåã«äžŠãã§ããïŒåé»çã¯æãããã€ããŠãããïŒã€ããŠããªããã®ããããã®ç¶æ
ã§ããïŒ JOI 髿 ¡ã®å庫ã«ã¯é»çãæäœããæ©æ¢°ãç ã£ãŠããïŒãã®æ©æ¢°ã¯é»é£Ÿå
ã§é£ç¶ããé»çãæå®ãããšïŒæå®ãããé»çã®ãã¡ïŒæãããã€ããŠããé»çå
šãŠãæãããã€ããŠããªãç¶æ
ã«ãïŒæãããã€ããŠããªãé»çå
šãŠãæãããã€ããŠããç¶æ
ã«ããïŒãã ãïŒæ©æ¢°ã¯èæœåã®ããïŒ1 åãã䜿çšã§ããªãïŒ JOI 髿 ¡ã®çåŸéã¯æãããã€ããŠããé»çãšã€ããŠããªãé»çã亀äºã«äžŠãã åïŒãã®ãããªé»çã®åã亀äºåãšåŒã¶... | 39,130 |
ç å³ã®ããã«äºè¡ã«åãããŠãã容åšããããŸãã1 ãã 10 ãŸã§ã®çªå·ãä»ãããã10 åã®çã容åšã®éå£éš A ããèœãšããå·Šã®ç B ãå³ã®ç C ã«çãå
¥ããŸããæ¿ D ã¯æ¯ç¹ E ãäžå¿ã«å·Šå³ã«å転ã§ããã®ã§ãæ¿ D ãåããããšã§ç B ãšç C ã®ã©ã¡ãã«å
¥ãããæ±ºããããšãã§ããŸãã éå£éš A ããèœãšãçã®äžŠã³ãäžããŸããããããé çªã«ç B åã¯ç Cã«å
¥ããŠãããŸãããã®ãšããç B ãšç C ã®ãã®ãã®ãäž¡æ¹ãšãçªå·ã®å°ããçã®äžã«å€§ããçã䞊ã¹ãããå Žå㯠YESã䞊ã¹ãããªãå Žå㯠NO ãšåºåããããã°ã©ã ãäœæããŠãã ããããã ãã容åšã®äžã§çã®é åºãå
¥ãæ¿ããããšã¯ã§ããªããã®ãšããŸãããŸããç¶... | 39,131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.