task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Problem J String Puzzle Amazing Coding Magazine is popular among young programmers for its puzzle solving contests offering catchy digital gadgets as the prizes. The magazine for programmers naturally encourages the readers to solve the puzzles by writing programs. Let's give it a try! The puzzle in the latest issue is... | 38,391 |
Finding Missing Cards Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. Input In the first line, the number of cards n ( n †52) is given. In the following... | 38,392 |
ã·ãŒã¶ãŒæå· åé¡ ã¬ã€ãŠã¹ã»ãŠãªãŠã¹ã»ã«ãšãµã«ïŒGaius Julius Caesar)ïŒè±èªèªã¿ã§ãžã¥ãªã¢ã¹ã»ã·ãŒã¶ãŒïŒJulius CaesarïŒã¯ïŒå€ä»£ããŒãã®è»äººã§ããæ¿æ²»å®¶ã§ããïŒã«ãšãµã«ã¯ïŒç§å¯ã®æçŽãæžããšãã«ïŒ 'A' ã 'D' ã«ïŒ 'B' ã 'E' ã«ïŒ 'C' ã 'F' ã«ïŒãšããããã«3ã€ããããŠè¡šèšãããšããèšé²ãæ®ã£ãŠããïŒ å€§æåã®ã¢ã«ãã¡ããã26æåã ããããªãæååãïŒã«ãšãµã«ãããããã«3æåãã€ãããå€æãæœãåŸãããæååãããïŒãã®ãããªæååãå
ã®æååã«æ»ãããã°ã©ã ãäœæããïŒ åæåã®å€æåãšå€æåŸã®å¯Ÿå¿ã¯æ¬¡ã®ããã«ãªãïŒ å€æå A B C D E F G H I J K... | 38,393 |
G: Tree åé¡ N é ç¹ãããªãæšãäžããããŸããæšã®åé ç¹ã«ã¯ 1 ãã N ã®çªå·ãå²ãæ¯ãããŠããŸãããŸãã Nâ1 æ¬ã®èŸºã®ãã¡ã i\ (= 1, 2, ..., N-1) æ¬ç®ã®èŸºã¯é ç¹ u_i ãšé ç¹ v_i ãšãçµãã§ããŸãã ãã®æšã® K åã®ç©ºã§ãªãéšåã°ã©ãã®çµã§ãã£ãŠãåéšåã°ã©ããããããé£çµã§ãã©ã®äºã€ã®çžç°ãªãéšåã°ã©ããé ç¹ãå
±æããªããã®ã®åæ°ãæ±ããããã°ã©ã ãäœæããŠãã ããããã ãçãããšãŠã倧ãããªãããšãããããã 998244353 ã§å²ã£ãããŸããçããŠãã ããã ãªãã K åã®éšåã°ã©ããããªãéåãåäžã®ãã®ã¯ã K åã®éšåã°ã©ãã®é åºãç°ãªããã®ãåäžèŠãããã®ãšããŸã... | 38,394 |
ååŒ ååŒå
ã®é¡§å®¢çªå·ãšååŒæ¥ãæããšã«èšé²ããããŒã¿ããããŸãã仿ã®ããŒã¿ãšå
æã®ããŒã¿ãèªã¿èŸŒãã§ãå
æããïŒã¶æé£ç¶ã§ååŒã®ããäŒç€Ÿã®é¡§å®¢çªå·ãšååŒã®ãã£ãåæ°ãåºåããããã°ã©ã ãäœæããŠãã ããããã ããæã
ã®ååŒå
æ°ã¯ 1,000 瀟以å
ã§ãã Input 仿ã®ããŒã¿ãšãå
æã®ããŒã¿ãïŒè¡ã®ç©ºè¡ã§åºåãããŠäžããããŸããããããã®ããŒã¿ã¯ä»¥äžã®ãããªåœ¢åŒã§äžããããŸãã c 1 , d 1 c 2 , d 2 ... ... c i (1 †c i †1,000) ã¯é¡§å®¢çªå·ãè¡šãæŽæ°ã d i (1 †d i †31) ã¯ååŒæ¥ãè¡šãæŽæ°ã§ãã Output ïŒã¶æé£ç¶ã§ååŒã®ããäŒç€Ÿã«ã€ããŠã顧客çªå·ãå°... | 38,395 |
Score : 200 points Problem Statement There are four towns, numbered 1,2,3 and 4 . Also, there are three roads. The i -th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reac... | 38,397 |
Diameter of a Tree Given a tree T with non-negative weight, find the diameter of the tree. The diameter of a tree is the maximum distance between two nodes in a tree. Input n s 1 t 1 w 1 s 2 t 2 w 2 : s n-1 t n-1 w n-1 The first line consists of an integer n which represents the number of nodes in the tree. Every node ... | 38,399 |
Score : 1000 points Problem Statement There are N barbecue restaurants along a street. The restaurants are numbered 1 through N from west to east, and the distance between restaurant i and restaurant i+1 is A_i . Joisino has M tickets, numbered 1 through M . Every barbecue restaurant offers barbecue meals in exchange f... | 38,400 |
Score : 500 points Problem Statement Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S . Takahashi will choose his workdays as follows: After working for a day, he will refrain from working on the subsequent C days. If the i -th chara... | 38,401 |
åçã«åã£ãŠããæ¯è²ã¯? A åã¯äŒæŽ¥ã«èгå
ã«ãã£ãŠããŸããã宿æ³ããããã«ã®çªããã¯äŒæŽ¥çå°ãäžæã§ããŸããæ¯è²ãçºããŠãããšãåºã«åçã®åã端ãèœã¡ãŠããã®ã«æ°ãã€ããŸãããã©ãããçªããå€ã®æ¯è²ãæ®ã£ãããã§ãããã©ã®èŸºããæ®ã£ãã®ããªããšãA åã¯çªã®å€ã®æ¯è²ãšåçãåã倧ããã«ãªãããã«åçãããããŠãåçãšçªã®å€ã®æ¯è²ãäžèŽããå Žæãæ¢ãå§ããŸããã ããã§ã¯ãA åããã£ãŠããããšãã³ã³ãã¥ãŒã¿ã§ãã£ãŠã¿ãŸããããçªã®å€ã®æ¯è²ã n à n ãã¹ã®æ£æ¹åœ¢ã«åå²ããŸã ( n ãæ¯è²ã®å€§ãããšåŒã³ãŸã)ãåãã¹ã«ã¯ããã®ãã¹ã®ç»åã®æ
å ±ã衚ã 0 以äžã®æŽæ°ãæžãããŠããŸãããã¹ã®äœçœ®ã¯åº§æš ( x, y ) ã§è¡šããŸã... | 38,402 |
Matrix-chain Multiplication The goal of the matrix-chain multiplication problem is to find the most efficient way to multiply given $n$ matrices $M_1, M_2, M_3,...,M_n$. Write a program which reads dimensions of $M_i$, and finds the minimum number of scalar multiplications to compute the maxrix-chain multiplication $M_... | 38,403 |
Score : 100 points Problem Statement Kyoto University Programming Contest is a programming contest voluntarily held by some Kyoto University students. This contest is abbreviated as K yoto U niversity P rogramming C ontest and called KUPC. source: Kyoto University Programming Contest Information The problem-preparing c... | 38,404 |
Problem A: Popularity Estimation ããªãã¯ãšããã¢ãã¡ãŒã·ã§ã³å¶äœäŒç€Ÿã®äŒç»éšé·ã§ãããæšä»ã®ã¢ãã¡ãŒã·ã§ã³å¶äœäŒç€Ÿãå¶äœãããã®ã¯ãã¢ãã¡ãŒã·ã§ã³ãã®ãã®ã«ãšã©ãŸããªããé¢é£ååãäŸãã°ç»å Žãã£ã©ã¯ã¿ãŒã®ãã£ã®ã¥ã¢ããã£ã©ã¯ã¿ãŒãœã³ã°CDãªã©ããéèŠãªåçæºãªã®ã§ããããã®åçãã©ãã ã䌞ã°ãããã¯ãã²ãšãã«äŒç»éšé·ã®ããªãã«ããã£ãŠããã®ã§ãã£ãã åœããåã®ããšã ãããããã£ãé¢é£ååã¯éé²ã«çºå£²ããã°ãããšãããã®ã§ã¯ãªããååã®éçºã«ã¯å€ãã®æéãšäºç®ãå¿
èŠãªããã ãã¢ãã¡ã®ç»å Žãã£ã©ã¯ã¿ãŒã®ãã£ã®ã¥ã¢ãçºå£²ããã«ããŠããå€ãã®å£²äžãèŠèŸŒãŸããã人æ°ããããã£ã©ã¯ã¿ãŒã®ãã®ã«éããªããã°ãªã... | 38,405 |
Score : 200 points Problem Statement For a string S consisting of the uppercase English letters P and D , let the doctoral and postdoctoral quotient of S be the total number of occurrences of D and PD in S as contiguous substrings. For example, if S = PPDDP , it contains two occurrences of D and one occurrence of PD as... | 38,406 |
Score : 300 points Problem Statement There are N people. The name of the i -th person is S_i . We would like to choose three people so that the following conditions are met: The name of every chosen person begins with M , A , R , C or H . There are no multiple people whose names begin with the same letter. How many suc... | 38,407 |
Sleeping Time Miki is a high school student. She has a part time job, so she cannot take enough sleep on weekdays. She wants to take good sleep on holidays, but she doesn't know the best length of sleeping time for her. She is now trying to figure that out with the following algorithm: Begin with the numbers K , R and ... | 38,408 |
Score: 100 points Problem Statement In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e , respectively. Two antennas can communicate directly if the distance between them is k or less, and they cann... | 38,409 |
Divisor Problem 12以äžã®èªç¶æ° N ãäžããããã®ã§ãçŽæ°ã®åæ°ãã¡ããã© N åã§ãããããªæå°ã®èªç¶æ°ãæ±ããã Input 1ã€ã®èªç¶æ° N ã 1 è¡ã§äžããããã Constraints 1 †N †12 Output çŽæ°ã®åæ°ãã¡ããã© N åã§ãããããªæå°ã®èªç¶æ°ã1è¡ã«åºåããã Sample Input 1 1 Sample Output 1 1 Sample Input 2 2 Sample Output 2 2 Sample Input 3 3 Sample Output 3 4 | 38,410 |
Problem I: Crossing Prisms Prof. Bocchan is a mathematician and a sculptor. He likes to create sculptures with mathematics. His style to make sculptures is very unique. He uses two identical prisms. Crossing them at right angles, he makes a polyhedron that is their intersection as a new work. Since he finishes it up wi... | 38,411 |
Score : 800 points Problem Statement There are N children, numbered 1,2,\ldots,N . In the next K days, we will give them some cookies. In the i -th day, we will choose a_i children among the N with equal probability, and give one cookie to each child chosen. (We make these K choices independently.) Let us define the ha... | 38,412 |
ããã°ã©ãã³ã°ã³ã³ãã¹ãã®å宿ã§åºãåé¡ã®ã¢ã€ãã£ã¢ãåºãã«å°ã£ãŠããã€ã¯ã¿åã¯ãããæ¥å人ã«çžè«ããã ã€ã¯ã¿åãããããã¢ã«ãŽãªãºã ã䜿ããªããšè§£ããªããããªåé¡ãåºããããã§ããã©ããªã«ããããŸããããïŒã å人ãããã§ã¯ãããããã®ãèãããããããããªãã§ããã ãã®ããã«ããŠãã®å人ã¯ä»¥äžã®ãããªåé¡ã®åæ¡ãšãªãã¢ã€ãã¢ãèããŠãããã 2鲿° A,B ãäžããããæã以äžã®æ§ãªã¯ãšãªãåŠçããã åºåã¯ãšãª: max{ x ã2鲿°ã§è¡šãããšãã®ã1ã®æ° | A †x < A+B }ãåºå A倿Žã¯ãšãª: A ã®æäžäœããããã i ãããç®(0-origin)ãå転 B倿Žã¯ãšãª: B ã®æäžäœããããã i ãã... | 38,413 |
åé¡ B : (iwi) 20XX 幎ã®ä»ïŒGââgle 瀟ã®äžççãªæ¯é
ã«ããïŒäººã
ã®ã³ãã¥ãã±ãŒã·ã§ã³ã¯éãããŠããïŒ äŸãã°ïŒèªç±ã«äººãšæ
å ±ããããšãããããšã¯åºæ¬çã«èš±ãããŠããªãïŒ ç¹ã«ïŒéå»ã«ããã°ã©ãã³ã°ã³ã³ãã¹ãã§åã銳ãã匷豪ãã¡ã¯ïŒå±éºãšå€æããïŒ ãäºããã©ãã©ã«ããïŒå¯ãã«æ³šææ·±ãç£èŠãããŠãããšããïŒ èªåãïŒãããªäžäººã§ãã£ãïŒãããªæ°ãããïŒ ãããå®ã¯ïŒèªåã¯èšæ¶ã倱ã£ãŠããŸã£ãŠããã®ã ïŒ èªåãäœãšåä¹ã£ãŠãããïŒãããããæãåºããªãïŒ 'i' ãšã 'w' ãšãæ¬åŒ§ãšãã䜿ã£ãŠããæ°ããããïŒ ããã£ãœããã®ãæžãã ããŠã¿ãŠãïŒãã£ããããªãïŒ ããããã°ïŒä»æãåºããããšã«ã¯ïŒå·Šå³ã«ç·å¯Ÿç§°ã ã£... | 38,414 |
床æ°ååž å¥åº·èšºæã§çåŸã®èº«é·ãèšæž¬ããŸããã身é·ã®ããŒã¿ãå
¥åãšãã床æ°ååžãäœæããŠåºåããããã°ã©ã ãäœæããŠãã ããã床æ°ååžã®éçŽã¯ 5 cm å»ã¿ã® 6 ã€ã®éçŽãšãã床æ°ã¯äººæ°ã *ïŒåè§ã¢ã¹ã¿ãªã¹ã¯ïŒã§è¡šç€ºããŸãããã ãããã®éçŽã®åºŠæ°ïŒäººæ°ïŒã 0 ã®å ŽåãéçŽã®èŠåºãã®ã¿ãåºåããŠãã ããã Input å
¥åã¯ä»¥äžã®åœ¢åŒã§äžããããŸãã n h 1 h 2 : h n 1 è¡ç®ã«çåŸã®æ° n (1 †n †40)ã2 è¡ç®ä»¥éã« i 人ç®ã®èº«é·ã衚ã宿° h i (150.0 †h i †190.0ãå°æ°ç¬¬ 1 äœãŸã§) ããããã 1 è¡ã«äžããããŸãã Output 以äžã®åœ¢åŒã§åºŠæ°ååžã衚瀺ããŠãã ... | 38,415 |
å¹¹ç·éè·¯ (Trunk Road) å顿 JOI åžã¯ïŒæ±è¥¿æ¹åã«ãŸã£ããã«äŒžã³ã H æ¬ã®éè·¯ãšïŒååæ¹åã«ãŸã£ããã«äŒžã³ã W æ¬ã®éè·¯ã«ãã£ãŠïŒç¢ç€ã®ç®ã®åœ¢ã«åºåããããŠããïŒéè·¯ãšéè·¯ã®éé㯠1 ã§ããïŒJOI åžã§ã¯ïŒããã H+W æ¬ã®éè·¯ããïŒæ±è¥¿æ¹åã« 1 æ¬ïŒååæ¹åã« 1 æ¬ïŒåèš 2 æ¬ã®éè·¯ãå¹¹ç·éè·¯ãšããŠéžã¶ããšã«ãªã£ãïŒ åãã i æ¬ç® ( 1âŠiâŠH ) ã®éè·¯ãšïŒè¥¿ãã j æ¬ç® ( 1âŠjâŠW ) ã®éè·¯ã®äº€å·®ç¹ãïŒäº€å·®ç¹ (i,j) ãšããïŒäº€å·®ç¹ (i,j) ãšåãã m æ¬ç® ( 1âŠmâŠH ) ã®éè·¯ã®è·é¢ã¯ |i-m| ã§ããïŒäº€å·®ç¹ (i,j) ãšè¥¿ãã n æ¬ç® ( 1âŠnâŠW ... | 38,416 |
åè§ããã®è¡šé¢ç© 1 蟺ã x ã®æ£æ¹åœ¢ãåºé¢ãšãããé«ã h ã®åè§ããã®è¡šé¢ç© S ãåºåããããã°ã©ã ãäœæããŠäžããããã ããé ç¹ãšåºé¢ã®äžå¿ãçµã¶ç·åã¯åºé¢ãšçŽäº€ããŠãããšããŸãããŸãã x ã h 㯠100 以äžã®æ£ã®æŽæ°ãšããŸãã Input è€æ°ã®ããŒã¿ã»ãããäžããããŸããåããŒã¿ã»ããã¯ä»¥äžã®åœ¢åŒã§äžããããŸãã x h x, h ãå
±ã« 0 ã®ãšãå
¥åã®çµäºã瀺ããŸãã Output åããŒã¿ã»ããããšã«ã S ïŒå®æ°ïŒãïŒè¡ã«åºåããŠäžãããåºåã¯0.00001以äžã®èª€å·®ãå«ãã§ãããã Sample Input 6 4 7 9 0 0 Output for the Sample Input 96.0000... | 38,417 |
Extraordinary Girl (II) She loves e-mail so much! She sends e-mails by her cellular phone to her friends when she has breakfast, she talks with other friends, and even when she works in the library! Her cellular phone has somewhat simple layout (Figure 1). Pushing button 1 once displays a character (â), pushing it twic... | 38,418 |
A ãš B ã® 2 人ã®ãã¬ãŒã€ãŒãïŒ 0 ãã 9 ãŸã§ã®æ°åãæžãããã«ãŒãã䜿ã£ãŠã²ãŒã ãè¡ãïŒæåã«ïŒ 2 人ã¯äžãããã n æãã€ã®ã«ãŒããïŒè£åãã«ããŠæšªäžåã«äžŠã¹ãïŒãã®åŸïŒ 2 人ã¯åèªã®å·Šãã 1 æãã€ã«ãŒãã衚åãã«ããŠããïŒæžãããæ°åã倧ããæ¹ã®ã«ãŒãã®æã¡äž»ãïŒãã® 2 æã®ã«ãŒããåãïŒãã®ãšãïŒãã® 2 æã®ã«ãŒãã«æžãããæ°åã®åèšãïŒã«ãŒããåã£ããã¬ãŒã€ãŒã®åŸç¹ãšãªããã®ãšããïŒãã ãïŒéãã 2 æã®ã«ãŒãã«åãæ°åãæžãããŠãããšãã«ã¯ïŒåŒãåããšãïŒåãã¬ãŒã€ãŒãèªåã®ã«ãŒãã 1 æãã€åããã®ãšããïŒ äŸãã°ïŒ AïŒB ã®æã¡æãïŒä»¥äžã®å
¥åäŸ 1 ãã 3 ã®ããã«äžŠã¹ãããŠããå Ž... | 38,419 |
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 tra... | 38,420 |
G - èªç±ç ç©¶ ãã€ãã®æ¬¡éã¯å€äŒã¿ã®èªç±ç ç©¶ã§ æå€§ç¬ç«éååé¡ ã®ã¢ã«ãŽãªãºã ãèããŠããïŒ æå€§ç¬ç«éååé¡ã§ã¯ïŒå
¥åãšããŠç¡åã°ã©ã G=(V,E) ãäžããããïŒ G ã®åé ç¹ãçœãŸãã¯é»ã§å¡ãããŠããïŒã©ã®èŸºã®ç«¯ç¹ãå°ãªããšãäžæ¹ãçœãå¡ãããŠãããšãïŒé»ãé ç¹éåã®ããšã ç¬ç«éå ãšåŒã¶ïŒ äŸãã°äžå³ã«ãããŠïŒå³ã®å·Šéšã®ãããªã°ã©ããäžããããæïŒå³ã®äžå€®éšã®ããã«è²ãå¡ããšé»ãé ç¹éåã¯ç¬ç«éåã«ãªã£ãŠãããïŒäžæ¹ã§å³ã®å³éšã®ããã«è²ãå¡ã£ãå Žåã¯é»ãé ç¹éåã¯ç¬ç«éåã«ãªã£ãŠããªãïŒ åé¡ã®ç®çã¯ïŒèŠçŽ æ°ãæå€§ã§ãããããªç¬ç«éåãæ±ããããšã§ããïŒ äŸ¿å®äžïŒã°ã©ã G ã®æå€§ã®ç¬ç«éåã®å€§ããã A(G) ãš... | 38,421 |
Problem A: ã¹ã¯ããæå· R倧åŠã®ãšãã2D奜ããªåœŒã¯ã人ã«èŠããããšèµ€é¢ãããããªæ¥ããããæç« ãæ¥é ããããæžããŠããã ãã®ããã第äžè
ã«èªåã®æžããŠããæç« ãèŠãããªãããã«ã圌ãç¬èªã«èãåºããã¹ã¯ããæå·ãšããææ³ã«ããæç« ãæå·åããŠããã ã¹ã¯ããæå·ã§ã¯ã次ã®ãããªã¹ãããã N åç¹°ãè¿ããæå·åãè¡ãã æååã® a i çªç®ãš b i çªç®ãå
¥ãæ¿ãã ãã®2ã€ã®æåãã a i ãš b i ã®å·®åã ãã¢ã«ãã¡ãããé ã«æ»ã ãã ããã¢ã«ãã¡ãããé ã§ã'a'ã®åã¯'z'ãšããã äŸãã°ã"aojwo"ãšããæååã«å¯Ÿãã a 1 =1ã b 1 =4ããšããæå·åæäœãè¡ã£ããšãããšã次ã®ããã«ãª... | 38,422 |
Problem J: ãã«ããã®æ°åŒ ããªãã®å人ã®èå€åŠè
ãéºè·¡ãçºæããŠããïŒ ããæ¥ïŒåœŒã¯æªãããªèšå·ã®çŸ
åãå»ãŸããŠããç³ç€ã倧éã«çºèŠããïŒ åœŒã¯ãã®å€§çºèŠã«å€§åã³ãïŒããããŸç³ç€ã«å»ãŸããŠããèšå·ã®è§£èªãå§ããïŒ äœé±éã«ãããã圌ã®è§£èªã®åªåã®çµæïŒ ã©ããããããã®ç³ç€ã«ã¯å€æ°ã»æŒç®åã»ã«ãã³ã®çµã¿åããã§æãç«ã£ãŠãã æ°åŒã®ãããªãã®ãå»ãŸããŠããããšãããã£ãïŒ çºæããç³ç€ãšéºè·¡ã«é¢ããæç®ã調ã¹ãŠãããã¡ã«åœŒã¯ããã«ïŒ ããããã®ç³ç€ã§æŒç®åã®çµåèŠåãç°ãªã£ãŠããïŒ ããããã®ç³ç€ã®å
é ã«æŒç®åã®çµåèŠåãèšãããŠãããããããšãçªããšããïŒ ãããïŒåœŒã¯æ°åŠãèŠæã§ããããïŒæŒç®åã®çµåèŠåãèŠãŠã ã... | 38,423 |
Score : 200 points Problem Statement Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after t... | 38,424 |
Score : 900 points Problem Statement Given are simple undirected graphs X , Y , Z , with N vertices each and M_1 , M_2 , M_3 edges, respectively. The vertices in X , Y , Z are respectively called x_1, x_2, \dots, x_N , y_1, y_2, \dots, y_N , z_1, z_2, \dots, z_N . The edges in X , Y , Z are respectively (x_{a_i}, x_{b_... | 38,425 |
Leapfrog Problem Statement N åã®ãã¹ãåç¶ã«äžŠãã§ããããã¹ã¯æèšåãã« 1,\ 2,\ ... ,\ N ãšçªå·ãæ¯ãããŠãããå i ( 1 †i †Nâ1 ) ã«ã€ããŠã i çªç®ã®ãã¹ãš i+1 çªç®ã®ãã¹ã¯é£ãåãããŸãã N çªç®ã®ãã¹ãš 1 çªç®ã®ãã¹ã¯é£ãåãã ãããã®ãã¡ M åã®ãã¹ã«ã¯ãäºãã«åºå¥ã§ããªãé§ã 1 åãã€çœ®ãããŠãããã¯ããã x_1,\ x_2,\ ... ,\ x_M çªç®ã®ãã¹ã«é§ã眮ãããŠãããæ¬¡ã®æäœãäœåãè¡ãã y_1,\ y_2,\ ... ,\ y_M çªç®ã®ãã¹ã«é§ã眮ãããŠããããã«ãããã æèšåããŸãã¯åæèšåãã«é£ç¶ãã 3 åã®ã... | 38,426 |
Score : 1600 points Problem Statement There are N zeros and M ones written on a blackboard. Starting from this state, we will repeat the following operation: select K of the rational numbers written on the blackboard and erase them, then write a new number on the blackboard that is equal to the arithmetic mean of those... | 38,427 |
Bridges Find bridges of an undirected graph G(V, E) . A bridge (also known as a cut-edge) is an edge whose deletion increase the number of connected components. Input |V| |E| s 0 t 0 s 1 t 1 : s |E|-1 t |E|-1 , where |V| is the number of nodes and |E| is the number of edges in the graph. The graph nodes are named with ... | 38,428 |
Score : 200 points Problem Statement Katsusando loves omelette rice. Besides, he loves crÚme brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone. To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not. The i -th... | 38,429 |
Score : 400 points Problem Statement We have N points in a two-dimensional plane. The coordinates of the i -th point (1 \leq i \leq N) are (x_i,y_i) . Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior. Here, points on the sides of the rec... | 38,430 |
Score: 100 points Problem Statement E869120 has A 1 -yen coins and infinitely many 500 -yen coins. Determine if he can pay exactly N yen using only these coins. Constraints N is an integer between 1 and 10000 (inclusive). A is an integer between 0 and 1000 (inclusive). Input Input is given from Standard Input in the fo... | 38,433 |
X Cubic Write a program which calculates the cube of a given integer x . Input An integer x is given in a line. Output Print the cube of x in a line. Constraints 1 †x †100 Sample Input 1 2 Sample Output 1 8 Sample Input 2 3 Sample Output 2 27 | 38,434 |
Score : 1100 points Problem Statement This is an interactive task. You have to guess a secret password S . A password is a nonempty string whose length is at most L . The characters of a password can be lowercase and uppercase english letters (a, b, ... , z, A, B, ... , Z) and digits (0, 1, ... , 9). In order to guess ... | 38,435 |
Score : 800 points Problem Statement Mr. Takahashi has in his room an art object with H rows and W columns, made up of H \times W blocks. Each block has a color represented by a lowercase English letter ( a - z ). The color of the block at the i -th row and j -th column is c_{i,j} . Mr. Takahashi would like to dismantl... | 38,436 |
L: æšã®åœ©è² å顿 ã¢ãã¥ãŒãããã¯æšã®çµµãæãã®ããšãŠãããŸãã§ãã ã¢ãã¥ãŒãããã¯é·ã幎æããããŠé ç¹ã $N$ åã§ããæšã®çµµãæžããŸããã ãã®æšã®é ç¹ã«ã¯ $1$ ãã $N$ ãŸã§ã®çªå·ãã€ããŠãããé ç¹ $a_i$ ãš $b_i$ $(1 \leq i \leq N-1)$ ã¯çŽæ¥èŸºã§ã€ãªãããŠããŸãã ãã¹ãŠã®é ç¹ã«ã¯è²ããŸã å¡ãããŠããŸããã ã¢ãã¥ãŒããããæžãããã®æšã®çµµã¯ããããã®äººãæåãããæåãªçŸè¡é€šã«é£Ÿãããããšã決ãŸããŸããã ãã®çŸè¡é€šã«ã¯é ã« $N$ 人ã®äººãæ¥å ŽããŸããã¢ãã¥ãŒãããã¯æ¥å Žè
ç¹å
žãšããŠãããããã®äººã« $1$ æãã€æšã®çµµã®ã³ããŒãé
åžããããšã«ããŸããã ããã«ãæ¥å Žè
... | 38,437 |
æ°Žéæé (Water Rate) åé¡ JOI åãäœãã§ããå°åã«ã¯æ°ŽéäŒç€Ÿã X 瀟㚠Y 瀟㮠2 ã€ããïŒ2 ã€ã®äŒç€Ÿã® 1 ã¶æã®æ°Žéæéã¯ïŒ1 ã¶æã®æ°Žéã®äœ¿çšéã«å¿ããŠæ¬¡ã®ããã«æ±ºãŸãïŒ X ç€ŸïŒ 1 ãªããã« ããã A åãããïŒ Y ç€ŸïŒ åºæ¬æé㯠B åã§ããïŒäœ¿çšéã C ãªããã«ä»¥äžãªãã°ïŒæéã¯åºæ¬æé B åã®ã¿ããããïŒäœ¿çšéã C ãªããã«ãè¶
ãããšåºæ¬æé B åã«å ããŠè¿œå æéããããïŒè¿œå æéã¯äœ¿çšéã C ãªããã«ã 1 ãªããã«è¶
ããããšã« D åã§ããïŒ JOI åã®å®¶ã§ã¯ 1 ã¶æã®æ°Žéã®äœ¿çšéã P ãªããã«ã§ããïŒ æ°Žéæéãã§ããã ãå®ããªãããã«æ°ŽéäŒç€Ÿãéžã¶ãšãïŒJOI ... | 38,438 |
äœè²ç¥Sport Meet ç§ã®äœè²ç¥ãè¡ãããŸããçš®ç®ã¯åŸç«¶èµ°ãããŒã«éã³ãé害ç©ç«¶èµ°ããªã¬ãŒã®4çš®ç®ã§ããåå ããŒã 㯠n ããŒã ã§ããã®4çš®ç®ã®åèšã¿ã€ã ãæãå°ããããŒã ããåªåããæ¬¡ã«å°ããããŒã ããæºåªåãããããŠãæäžäœãã2çªç®ã®ããŒã ããããŒããŒè³ããšããŠè¡šåœ°ããããšæããŸãã åããŒã ã®æçžŸãå
¥åãšããŠããåªåãããæºåªåãããããŒããŒè³ãã®ããŒã ãåºåããããã°ã©ã ãäœæããŠãã ããã ãã ããããŒã ã«ã¯ãããã 1 ãã n ã®ããŒã çªå·ãå²ãåœãŠãããŠããŸãã Input è€æ°ã®ããŒã¿ã»ããã®äžŠã³ãå
¥åãšããŠäžããããŸããå
¥åã®çµããã¯ãŒãã²ãšã€ã®è¡ã§ç€ºãããŸãã åããŒã¿ã»ããã¯ä»¥äžã®åœ¢åŒã§äžããããŸãã... | 38,439 |
Problem G: Magical Island 2 ãŸã éæ³ãããããŸãã®ããã«ååšããæä»£ã§ããïŒããéå°å£«ã®äžæã¯ïŒéåã«ãã£ãŠäœãããæ£æ¹åœ¢ã®åœ¢ã®å³¶ã«äœãã§ããïŒ ããæïŒãã®å³¶ã«å±æ©ã蚪ããïŒåžåœã倧éžé匟ééå°ããµã€ã«ãéçºãïŒãã®å³¶ãç
§æºã«åãããŠããã®ã§ããïŒãã®äžçã®éæ³ã¯å°å±æ§ïŒæ°Žå±æ§ïŒç«å±æ§ïŒé¢šå±æ§ãªã©ã«åé¡ã§ãïŒéå°ããµã€ã«ããã®åã€ã®å±æ§ã®ããããã«å±ããŠããïŒå³¶ã®åé
ã«ã¯ããããå°ã®æ°Žæ¶ïŒæ°Žã®æ°Žæ¶ïŒç«ã®æ°Žæ¶ïŒé¢šã®æ°Žæ¶ãé
眮ãããŠããŠïŒæ°Žæ¶ã«éåãéã蟌ãããšã§å¯Ÿå¿ãã屿§ã®éæ³æ»æãé²ãããšããã§ãïŒ éå°å£«éã¯åžåœãéçºãã倧éžé匟ééå°ããµã€ã«ã«ããæ»æããããããŠéããããšãã§ããïŒãããïŒåžåœã¯... | 38,440 |
Problem I: Most Distant Point from the Sea The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: "Where is the most distant point from the sea?" The answer to this question for Honshu was found in 1996. The most distant point is located in former Us... | 38,441 |
E : Arojam's Mask / ä»®é¢ å顿 ããªãã¯åè
ã§ãããåè
ãæ
ãããŠããäžç㯠N åã®è¡ãšãç°ãªãè¡å士ãçµã¶ M æ¬ã®éãããªããé i ã¯è¡ a_i ãšè¡ b_i ãçµã³ãåæ¹åã«ç§»åå¯èœã§ããã è¡ S ããåºçºããè¡ T ã«ç§»åããããšãåè
ã®ç®çã§ããã S,T ã¯ç°ãªãè¡ã§ãããåè
㯠0 æ¥ç®ã«è¡ãåºçºããã¡ããã© 1 æ¥ãã㊠1 æ¬ã®éãéã£ãŠç§»åããããšãã§ãããéã䜿ã£ãç§»åã«ã¯æ¥æ°ã®å¶é R ãããã R æ¥ç®ãè¶
ããããšã¯ã§ããªãã ãŸããåè
ã¯ä»»æã®è¡ã§ããªã«ãªããå¹ããããšãã§ããããªã«ãªããå¹ããšãæã¯ 0 æ¥ç®ã«ãäœçœ®ã¯è¡ S ã«æ»ããããã€ãŸãã R åãè¶
ããç§»åãè¡ãå Žå... | 38,442 |
Score : 1300 points Problem Statement There is a string s consisting of a and b . Snuke can perform the following two kinds of operation any number of times in any order: Choose an occurrence of aa as a substring, and replace it with b . Choose an occurrence of bb as a substring, and replace it with a . How many string... | 38,443 |
Problem F: Ninja Legend Ninjas are professional spies in the Middle Age of Japan. They have been popular in movies and games as they have been described with extraordinary physical abilities and unrealistic abilities. You are absorbed in one of ninja games, Ninja Legend . In this game, you control in an exceptionally t... | 38,444 |
Problem D: Space Golf You surely have never heard of this new planet surface exploration scheme, as it is being carried out in a project with utmost secrecy. The scheme is expected to cut costs of conventional rovertype mobile explorers considerably, using projected-type equipment nicknamed "observation bullets". Bulle... | 38,445 |
Score : 400 points Problem Statement There are N towns in the State of Atcoder, connected by M bidirectional roads. The i -th road connects Town A_i and B_i and has a length of C_i . Joisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order). She will fly to the first town she visits, and ... | 38,446 |
Problem B: Time Complexity ICPC World Finals 1æ¥ç® ããã°ã©ãã³ã°ã³ã³ãã¹ãã§ã¯ããã°ã©ã ã®å®è¡æéãææ¡ããäºãéèŠã ã å®è¡æéã®èŠç©ããã誀ãã æéå¶éããªãŒããŒããŠããŸãã³ãŒããæžããŠããŸããšã ãã®ã¶ãæéããã¹ããŠããŸãã ICPCã®ããã«ã³ã³ãã¥ãŒã¿ã1å°ãã䜿ããªãããŒã æŠã§ã¯ãªãããã§ããã ããã§ãICPC World Finalsãåã«æ§ãããã£ãŒæ°ã¯ããã°ã©ã ã®å®è¡æéãæç®ã§æ±ããèšç·Žãå§ããããšã«ããã ãlogã¯å®æ°ã®ãããªãã®ããªã®ã§ããŸãã¯å€é
åŒã«åãçµããšãããã åé¡ ããåé¡ã®çããèšç®ããããã°ã©ã ãšããããå®è¡ããã³ã³ãã¥ãŒã¿ãããã åé¡ã®... | 38,447 |
ã€ãã åé¡ ã«ããã«äœã JOI åã®å®¶ã®è»äžã«ã¯,ç«æŽŸãªã€ãããåºæ¥ãŠãã.ãã£ãããªã®ã§,JOI åã¯ã€ããã«ã€ããŠèª¿ã¹ãŠã¿ãããšã«ãã. JOI åã®å®¶ã®è»äžã«ã¯ N æ¬(2 †N †100000 = 10 5 )ã®ã€ãããåºæ¥ãŠãã.ãããã®ã€ããã¯äžçŽç·äžã«äžŠãã§ãã,è»äžã®å·Šç«¯ãã i cm(1 †i †N )ã®äœçœ®ã« i æ¬ç®ã®ã€ãããåºæ¥ãŠãã.i æ¬ç®ã®ã€ããã®é·ãã¯æå ai cm(ai 㯠1 以äžã®æŽæ°)ã§ãã.ãããã®ã€ããã¯,次ã®ãããªèŠåã«ãã£ãŠäŒžã³ãŠãã: i æ¬ç®ã®ã€ããã¯,i â 1 æ¬ç®ã®ã€ãããš i + 1 æ¬ç®ã®ã€ããã®äž¡æ¹ãããé·ãå Žåã«ã®ã¿,1 æéã«ã€ã 1 cm ãã€äŒžã³ã... | 38,448 |
Permutation For given a sequence $A = \{a_0, a_1, ..., a_{n-1}\}$, print the previous permutation and the next permutation in lexicographic order. Input A sequence is given in the following format. $n$ $a_0 \; a_1 \; ... \; a_{n-1}$ Output Print the previous permutation, the given sequence and the next permutation in t... | 38,449 |
Physical Experiments Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas: $ v = 9.8 t $ $ y = 4.9 t^2 $ A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a progr... | 38,450 |
E-ä¿®è¡ ããããã¯ããã°ã©ãã³ã°ã®ä¿®è¡ã®ããã$N$ åã®æŽæ° $V_1, V_2, V_3, \cdots, V_N$ ã«ã€ããŠèª¿ã¹ãããã°ã©ã ãäœã£ãŠããã æå°åœ¹ã®ãã¿ãããã«èšãããŠããããã㯠2, 3, 6 ã®åæ°ã®åæ°ã調ã¹ãããã°ã©ã ãæžããã 2 ã®åæ°ã¯ $A$ åã3 ã®åæ°ã¯ $B$ åã6 ã®åæ°ã¯ $C$ åã ã£ãã ãã¿ãããã¯ã次ã¯ã2 ã®åæ°ã§ã 3 ã®åæ°ã§ããªãæ°ãã®åæ°ã調ã¹ãããã«ãšèšã£ãã ããããããããã¯ç²ããã®ã§ãçãã ããæ±ããŠããŸããããšã«ããã $N, A, B, C$ ã®å€ã ããããšã«ãã2 ã®åæ°ã§ã 3 ã®åæ°ã§ããªãæ°ãã®åæ°ãåãããŸãããããæ±ããããã°ã©ã ãäœã£... | 38,451 |
Score : 1000 points Problem Statement ButCoder Inc. is a startup company whose main business is the development and operation of the programming competition site " ButCoder ". There are N members of the company including the president, and each member except the president has exactly one direct boss. Each member has a ... | 38,452 |
Score : 100 points Problem Statement 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... | 38,453 |
Coin Combination Problem II You have N coins each of which has a value a i . Find the number of combinations that result when you choose K different coins in such a way that the total value of the coins is greater than or equal to L and less than or equal to R . Constraints 1 †K †N †40 1 †a i †10 16 1 †L †R †10... | 38,454 |
Score : 200 points Problem Statement 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 she... | 38,455 |
Counting Sort Counting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements less than x as C[x]. This information can be used to place element x directly into it... | 38,457 |
éæ³é£ äººéé¢ããæ£®ã®å¥¥æ·±ãã«ãããªãŒãšããåã®é女ãäœãã§ããŸããã圌女ã¯é女ãªã®ã§ãé£æã»æ°Žã»çæãªã©ãçæŽ»ã«å¿
èŠãªãã®ãéæ³ã«ãã£ãŠãŸããªã£ãŠããŸãã 圌女ã®éæ³ã¯ãéåã蟌ããããã€ãã®ç³ãšçŽã䜿ã£ãŠãéæ³é£ãæãããšã«ãã£ãŠçºåããŸãããã®éæ³é£ã¯ãç³ãèšçœ®ããããã€ãã®ç³ã®ãã¢ãçŽã§ç¹ãããšã§æãããŸãããã ããçŽã¯åŒãã§ããŠã¯ãããŸãããããã«ãã©ã®çŽãã(䞡端ãé€ããŠ) ä»ã®çŽãç³ã«è§ŠããŠã¯ãããŸããããã¡ãããåãå Žæã«è€æ°ã®ç³ã眮ãããšãã§ããŸããããã®å¶çŽãå®ãããéããç³ãšç³ã®äœçœ®é¢ä¿ãçŽã®é·ãã«å¶éã¯ãããŸããããŸããç³ã¯ååå°ããã®ã§ç¹ãšããŠæ±ãããšãã§ããçŽã¯åå现ãã®ã§ç·åãšããŠæ±ãããšãã§ããŸããã... | 38,458 |
Score : 500 points Problem Statement Count the pairs of length- N sequences consisting of integers between 1 and M (inclusive), A_1, A_2, \cdots, A_{N} and B_1, B_2, \cdots, B_{N} , that satisfy all of the following conditions: A_i \neq B_i , for every i such that 1\leq i\leq N . A_i \neq A_j and B_i \neq B_j , for eve... | 38,459 |
Problem D: Course Planning for Lazy Students äŒæŽ¥å€§åŠã§ã¯2009幎床ãããææ¥å±¥ä¿®ã«é¢ããæ°ããå¶åºŠãéå§ãããæ°å¶åºŠã§ã¯å¿
ä¿®ç§ç®ãæ€å»ããããããã®é²è·¯ãèæ
®ããŠç§ç®ãèªç±ã«éžæã§ããããã«ãªã£ãã ããããã©ã®ç§ç®ãç¡æ¡ä»¶ã§å±¥ä¿®ã§ããããã§ã¯ãªããç¹å®ã®ç§ç®ã履修ããããã«ã¯ãå
ä¿®æ¡ä»¶ãæºãããŠããå¿
èŠããããäžå³ã«å±¥ä¿®èšç»è¡šã®äžéšã®äŸã瀺ãïŒ å³ã®é·æ¹åœ¢ãïŒã€ã®ç§ç®ã衚ãç§ç®åãšåäœæ°ãå«ãã§ãããå³ã®ç¢å°ãå
ä¿®æ¡ä»¶ã衚ããç¢å°ã®æå³ã¯ãç¢å°ã®çµç¹ã§æãããŠããç§ç®ã履修ããããã«ã¯ããã®ç¢å°ã®å§ç¹ã瀺ãç§ç®ãä¿®åŸããŠããå¿
èŠããããäŸãã°ãLinear Algebra II (ç·... | 38,460 |
Score : 200 points Problem Statement We have a grid of H rows and W columns. Initially, there is a stone in the top left cell. Shik is trying to move the stone to the bottom right cell. In each step, he can move the stone one cell to its left, up, right, or down (if such cell exists). It is possible that the stone visi... | 38,461 |
A Light Road There is an evil creature in a square on N-by-M grid ( 2 \leq N, M \leq 100 ), and you want to kill it using a laser generator located in a different square. Since the location and direction of the laser generator are fixed, you may need to use several mirrors to reflect laser beams. There are some obstacl... | 38,462 |
Score : 500 points Problem Statement An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i -th round, the game master announces: Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possib... | 38,463 |
Problem D: Room of Time and Spirit Problem 20XX幎ããšããç§åŠè
ããã€ãªãã¯ãããžãŒã«ãã£ãŠåŒ·åãªäººé 人éãéçºããŠããŸã£ãããã®äººé 人éã¯ã³ã³ãã¥ãŒã¿ã«ãããæŠéã®é人ãã¡ã®çްèãçµã¿åãããŠäœãããŠããããéåžžã«åŒ·åã§ããã ãã®ãŸãŸã§ã¯å°çã¯äººé 人éã«æ¯é
ãããŠããŸãã®ã§ã N äººã®æŠå£«ãã¡ã¯äººé 人éãšæŠãããšã«ããããããä»ã®æŠå£«ãã¡ã§ã¯å°åºäººé 人éã«æµããªããããä¿®è¡ãããªããã°ãªããªãããŸãã N äººã®æŠå£«ãã¡ã¯ãããã 1 ~ N ã®çªå·ãä»ããŠããã ãã®æä»£ã倩空éœåžAIZUã«ã¯ SRLU宀ãšåŒã°ããä¿®è¡ã®ããã®ç¹æ®ãªéšå±ãååšããããã®éšå±ã§ã®1幎ã¯å€çã®æéã®1æ¥ãš... | 38,464 |
Score : 600 points Problem Statement There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0 , 1 , 2 , ..., N-2 and N-1 . On the lotus at coordinate i , an integer s_i is written. You are standing on the lotus at coordinate 0 . You will play a g... | 38,465 |
Problem D: Divide the Water A scientist Arthur C. McDonell is conducting a very complex chemical experiment. This experiment requires a large number of very simple operations to pour water into every column of the vessel at the predetermined ratio. Tired of boring manual work, he was trying to automate the operation. O... | 38,466 |
Score : 300 points Problem Statement Snuke has a fair N -sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: Throw the die. The current score is the result of the die. As long as the score is between 1 and K-1 (inclusive), keep flipping the co... | 38,467 |
Score : 700 points Problem Statement 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... | 38,468 |
Maze & Items Maze & Items is a puzzle game in which the player tries to reach the goal while collecting items. The maze consists of $W \times H$ grids, and some of them are inaccessible to the player depending on the items he/she has now. The score the player earns is defined according to the order of collecting items.... | 38,469 |
Score : 800 points Problem Statement Given is a string S , where each character is 0 , 1 , or ? . Consider making a string S' by replacing each occurrence of ? with 0 or 1 (we can choose the character for each ? independently). Let us define the unbalancedness of S' as follows: (The unbalancedness of S' ) = \max \{ The... | 38,470 |
Score : 1200 points Problem Statement Imagine a game played on a line. Initially, the player is located at position 0 with N candies in his possession, and the exit is at position E . There are also N bears in the game. The i -th bear is located at x_i . The maximum moving speed of the player is 1 while the bears do no... | 38,471 |
ã®ã£ã° (Gag) Segtree å㯠$N$ åã®ãã®ã£ã°ããæã£ãŠããŠãããããã«ãã§ãã°ãã $V_i$ ãšããå€ãå®ãŸã£ãŠããŸãã Segtree åã¯èªç±ãªé çªã§å
šãŠã®ã®ã£ã°ãå
¬éããããšã«ããŸããã ããã§ã $i$ çªç®ã®ã®ã£ã°ã $j$ çªç®ã«å
¬éããæã«åŸããããããããã㯠$V_i - j$ ãšè¡šãããŸãã Segtree åãåŸãããããããããã®åã®æå€§å€ãæ±ããŠãã ããã å
¥å å
¥åã¯ä»¥äžã®åœ¢åŒã§æšæºå
¥åããäžããããã $N$ $V_1$ $V_2$ $\ldots$ $V_N$ åºå ããããããã®åã®æå€§å€ãåºåããŠãã ããããã ããå€ã 32bit æŽæ°ã«åãŸããšã¯éããŸããã æåŸã«ã¯æ¹è¡ãå
¥... | 38,472 |
Score : 100 points Problem Statement We have three boxes A , B , and C , each of which contains an integer. Currently, the boxes A , B , and C contain the integers X , Y , and Z , respectively. We will now do the operations below in order. Find the content of each box afterward. Swap the contents of the boxes A and B S... | 38,473 |
Score : 300 points Problem Statement You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a self-loop is an edge where a_i = b_i (1â€iâ€M) , and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1â€i<jâ€M) . How many dif... | 38,474 |
Optimal Tournament In 21XX, an annual programming contest "Japan Algorithmist GrandPrix (JAG)" has been one of the most popular mind sport events. You, the chairperson of JAG, are preparing this year's JAG competition. JAG is conducted as a knockout tournament. This year, $N$ contestants will compete in JAG. A tourname... | 38,475 |
Range Search (kD Tree) The range search problem consists of a set of attributed records S to determine which records from S intersect with a given range. For n points on a plane, report a set of points which are within in a given range. Note that you do not need to consider insert and delete operations for the set. Inp... | 38,476 |
KND Factory Problem KNDåã¯äŒæŽ¥å€§åŠã«åšç±ããåŠçããã°ã©ãã§ããã圌ã®äœãçºã®åšèŸºã«ã¯ N åã®çºãããã圌ã¯çã¯ãªãŒã ã倧奜ããªã®ã§æ¯æ¥çã¯ãªãŒã ãé£ã¹ãããã«ããçºã«å·¥å Žã建èšããããã®å·¥å Žã§ã¯æ¯æ¥ F ãªããã«ã®çã¯ãªãŒã ã補é ããããçã¯ãªãŒã ã¯éã¶ãã³ã«ãç§»åå
ã®çºã®æ°æž©ãšç§»åå
ã®çºã®æ°æž©ã®çµ¶å¯Ÿå·®ã ãå·ãã§ããŸããå°ã£ãããšã«ãã®è¿èŸºã®çºã®æ°æž©ã¯å¯æèšã«ãã£ãŠèšæž¬ã§ããªããããããªãã調æ»ã«ãã£ãŠãããããã®çºã®æ°æž©ã倿°ãšãã N åã®äžæ¬¡æ¹çšåŒãããªã N å
äžæ¬¡é£ç«æ¹çšåŒãå°ãããšãã§ãããããªãã¯ãããè§£ãããšã«ãã£ãŠåçºã®æ°æž©ãç¥ãããšãã§ããããŸããããçºããä»ã®çºãžçã¯ãªãŒã ã鿬ãã... | 38,477 |
D: ãããšãå§çž® (Shiritori Compression) åé¡ ãã³ã¡ãããšãã«ã¡ããã®äºäººã¯ãããšããããŸããããã³ã¡ããã¯ãããšãã§åºãåèªã®ã¡ã¢ãèŠãŠããŸãã ãã³ã¡ããã¯ããã®åèªå w_1 , w_2 , ... , w_N ããåé·ãªé£ç¶éšååããååšããªããªããŸã§åãé€ããããšæã£ãŠããŸãããã³ã¡ããã®æãåé·ãªé£ç¶éšååãšã¯ä»¥äžã®ããã«å®çŸ©ãããŸãã 以äžãæºãã i , j ãååšãããšããé£ç¶éšåå w_i , ... , w_{j-1} ã¯åé·ã§ãã i < j ãªãæ·»å i , j ã«ã€ããŠãåèª w_i ãš w_j ã®å
é ã®æåãçããã ãã®ãšãããã³ã¡ããã¯æ·»å i ä»¥äž j-1 以äžã®åèªã... | 38,478 |
Score : 200 points Problem Statement You are given positive integers A and B . Find the K -th largest positive integer that divides both A and B . The input guarantees that there exists such a number. Constraints All values in input are integers. 1 \leq A, B \leq 100 The K -th largest positive integer that divides both... | 38,479 |
Score : 200 points Problem Statement Find the largest square number not exceeding N . Here, a square number is an integer that can be represented as the square of an integer. Constraints 1 \leq N \leq 10^9 N is an integer. Input Input is given from Standard Input in the following format: N Output Print the largest squa... | 38,480 |
Complex Paper Folding Dr. G, an authority in paper folding and one of the directors of Intercultural Consortium on Paper Crafts, believes complexity gives figures beauty. As one of his assistants, your job is to find the way to fold a paper to obtain the most complex figure. Dr. G defines the complexity of a figure by ... | 38,481 |
çŽ æ°ã®å p(i) ãå°ããæ¹ãã i çªç®ã®çŽ æ°ãšããŸããäŸãã°ã7 ã¯ã2, 3, 5, 7 ãšå°ããæ¹ãã 4 çªç®ã®çŽ æ°ãªã®ã§ã p(4) = 7 ã§ãã n ãäžãããããšãã i = 1 ãã n ãŸã§ã® p(i) ã®å s s = p(1) + p(2) + .... + p(n) ãåºåããããã°ã©ã ãäœæããŠãã ãããäŸãã°ã n = 9 ã®ãšãã s = 2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 = 100 ãšãªããŸãã Input è€æ°ã®ããŒã¿ã»ãããäžããããŸããåããŒã¿ã»ããã«æŽæ° n ( n †10000) ãäžããããŸãã n ã 0 ã®ãšãå
¥åã®æåŸãšããŸããããŒ... | 38,482 |
Score : 100 points Problem Statement You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? Constraints -40 \leq X \leq 40 X is an integer. Input Input is given from... | 38,483 |
ããã®ã㪠ããªãã®å®¶ã®è¿æã«ã¯å€ãã®ç«ãåºå
¥ãããæšªç©ŽããããŸããäžã¯è¡ãæ¢ãŸãã§éãæããããšã¯ã§ããŸããããè¿æã®ç«ãå
šéšå
¥ãããããã®å¥¥è¡ãããããŸãã穎ã®å¹
ã¯ç«ãã¡ããã©åãŸãããããªã®ã§ãå
ã«å
¥ã£ãç«ãåŸããå
¥ã£ãç«ãæŒãã®ããŠå¥¥ã«åããããšã¯ã§ããŸããããŸããå
ã«å
¥ã£ãç«ããåŸããå
¥ã£ãŠããç«ãæŒãã®ããŠåºå£ããåºãããšãã§ããŸããã ç«å¥œãã®ããªãã¯æšªç©Žã«åºå
¥ãããç«ãé çªã«èšé²ããŠãããŸãããèšé²ãã¯ããããšãã¯æšªç©Žã®äžã«ã¯äžå¹ãç«ã¯ããŸããã§ãããããããŠç«ãã¡ã¯æšªç©Žãžã®åºå
¥ããå§ããŸãããåãç«ãäœåºŠãåºå
¥ãããããšããããŸããã èšé²ãçµããããªãã¯ãæ£ããèšé²ã§ãããããã°ã©ã ãæžããŠãã§ãã¯ããããšã«ããŸ... | 38,484 |
Problem E Infallibly Crack Perplexing Cryptarithm You are asked to crack an encrypted equation over binary numbers. The original equation consists only of binary digits ("0" and "1"), operator symbols ("+", "-", and "*"), parentheses ("(" and ")"), and an equal sign ("="). The encryption replaces some occurrences of ch... | 38,485 |
Problem I: Reverse Game ãããšããã«ãªã»ããè¶£å³ãªå¥³ã®åãããŸãããæéããããšãã«å®¶æãšãªã»ããæ¥œããã§ããŸãã ããæ¥ã女ã®åã¯ãã€ãã®ããã«ãªã»ãã§éãŒããšããŸããããšããããã¿ããªå¿ãããŠèª°ãéãã§ãããŸããã§ããã ããã§ãªã»ãã®ããŒããšããŸã䜿ã£ãŠïŒäººã§éã¹ãã²ãŒã ãèãåºããŸããã åé¡ çžŠ\( R \)ãã¹ã暪\( C \)ãã¹ã®ãã¹ç®å
šãŠã«ãªã»ãã®é§ãäžé¢ãé»ãããã¯çœã«ãªãããã«é
眮ãããŠããã 以äžã®å³ã®ããã«ããããã¹ãéžãã§ããã®äžäžå·Šå³æãæ¹åã«ããé§ãå
šãŠè£è¿ãããšããæäœãç¹°ãè¿ãè¡ãããšãèããã å
šãŠã®é§ã®äžé¢ãçœã«ãããããªæäœã®ä»æ¹ã®åæ°ãæ±ããã ãã ãã以äžã®æ¡ä»¶ã... | 38,486 |
Score : 100 points Problem Statement You are given a string S of length 3 consisting of a , b and c . Determine if S can be obtained by permuting abc . Constraints |S|=3 S consists of a , b and c . Input Input is given from Standard Input in the following format: S Output If S can be obtained by permuting abc , print Y... | 38,487 |
Problem F: Mysterious Dungeons The Kingdom of Aqua Canora Mystica is a very affluent and peaceful country, but around the kingdom, there are many evil monsters that kill people. So the king gave an order to you to kill the master monster. You came to the dungeon where the monster lived. The dungeon consists of a grid o... | 38,488 |
Score : 2200 points Problem Statement You are given an undirected graph with N vertices and M edges. Here, N-1â€Mâ€N holds and the graph is connected. There are no self-loops or multiple edges in this graph. The vertices are numbered 1 through N , and the edges are numbered 1 through M . Edge i connects vertices a_i and ... | 38,489 |
Score : 2000 points Problem Statement Let us consider a grid of squares with N rows and N columns. Arbok has cut out some part of the grid so that, for each i = 1, 2, \ldots, N , the bottommost h_i squares are remaining in the i -th column from the left. Now, he wants to place rooks into some of the remaining squares. ... | 38,490 |
Problem E: Map of Ninja House An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least two doors. The Ninja House can be model... | 38,491 |
Problem Statement One day, my grandmas left $N$ cookies. My elder sister and I were going to eat them immediately, but there was the instruction. It said Cookies will go bad; you should eat all of them within $D$ days. Be careful about overeating; you should eat strictly less than $X$ cookies in a day. My sister said "... | 38,492 |
Score : 200 points Problem Statement There are N points in a D -dimensional space. The coordinates of the i -th point are (X_{i1}, X_{i2}, ..., X_{iD}) . The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2} . How man... | 38,493 |
Score : 1000 points Problem Statement There is a sequence of length N : a = (a_1, a_2, ..., a_N) . Here, each a_i is a non-negative integer. Snuke can repeatedly perform the following operation: Let the XOR of all the elements in a be x . Select an integer i ( 1 †i †N ) and replace a_i with x . Snuke's objective is t... | 38,494 |
Problem I: Lapin Noir ããã¯, å°é¢ãæ£å
è§åœ¢ãæ·ãè©°ãããã¹ç®ã«ãªã£ãŠããè¡ã§ãã. åãã¹ã¯, äžã®å³ã®ããã«2 ã€ã®æŽæ°ã§è¡šããã. ããã¯(0, 0) ã®ãã¹ãžè¡ãããšããŠãã. ãããã奜ãã®é»ãããã¯ãã®ããšãç¥ã£ãŠ, ããã®éªéãããããšèãã. é»ãããã¯ããããããã¹ãžè·³ã³, ãã®åšãã®6 ãã¹ã®ãã¡1 ã€ãŸãã¯é£ãåã2 ã€ããããã¯ããããšãã§ãã. ããã¯åšãã®6 ãã¹ã®ãã¡, ãããã¯ãããŠããªããã¹ã1 ã€éžãã§é²ã. ãããåããã³é»ãããã¯ããã远ããã, ãŸããããã¯ãè¡ãããšãã§ãã. é»ããããåããšå
ã®ãããã¯ã¯è§£é€ããã. äžã®å³ã¯ãããã¯ã®æ§åã瀺ããŠãã. ãã®è¡ã«... | 38,495 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.