본문 바로가기

코드포스

[코드포스 Practice10] B. Mislove Has Lost an Array Mislove had an array a1, a2, ⋯, an of n positive integers, but he has lost it. He only remembers the following facts about it: The number of different numbers in the array is not less than l and is not greater than r; For each array's element ai either ai=1 or ai is even and there is a number ai2 in the array. For example, if n=5, l=2, r=3 then an array could be [1,2,2,4,4] or [1,1,1,1,2]; but i.. 더보기
[코드포스 Practice10] A. Distinct Digits You have two integers l and r. Find an integer x which satisfies the conditions below: l≤x≤r. All digits of x are different. If there are multiple answers, print any of them. Input The first line contains two integers l and r (1≤l≤r≤105). Output If an answer exists, print any of them. Otherwise, print −1. 아 그래 A번ㅋㅋ 이거 풀면서 분명 더 쉽게 풀 수 있을 것 같은데?? 이게 최선인가?? 하면서 풀었음. 풀 줄은 알겠는데... 알겠는데...... 괜찮은 방법이 .. 더보기
[코드포스 Practice10] 후기 아이고 별건 아닌데 아침에 먹은게 체해가지고 중간에 허어어 하면서 문제 풀었다. 지금도 조금 괴로움 으으으 물론 이게 문제 푸는데 영향은 없는데 그냥 괴로웠음 으 오늘도 무난히 풀었다. A, B, C는 무난히 넘기고 D번은 고민하다 풀었는데 시간초과나고 E는 문제 읽다가 끝났다ㅋㅋㅋ 문제 읽는데만 20분 걸리다니 A - 31분 B - 16분 C - 26분 D - 28분- X 틀림 E - 19분 - X 못 품 지금보니 A에 시간 완전 많이 썼네 제발 20분 기준 맞추자,,, 젭알 더보기
[코드포스 Practice9] E. RGB Substring (hard version) The only difference between easy and hard versions is the size of the input. easy 와 hard 버젼의 유일한 차이는 입력 크기이다. You are given a string s consisting of n characters, each character is 'R', 'G' or 'B'. 너는 각 문자가 RGB로 이루어져 있고 n개의 문자로 구성된 문자열 s가 주어졌다. You are also given an integer k. Your task is to change the minimum number of characters in the initial string s so that after the changes there will be .. 더보기
[코드포스 Practice9] D. Minimum number of steps We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings "ab" in the string and replace it with the string "bba". If we have no "ab" as a substring, our job is done. Print the minimum number of steps we should perform to make our job done modulo 109 + 7. The string "ab" appears as a substring if there is a letter 'b' right after .. 더보기
[코드포스 Practice9] C. Treasure Hunt Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion might help them to reach the treasure. Bottle with potion has two values x and y written on it. These values define four moves which can be performed using the potion: Map shows that the position of Captain Bill the Hummingbird i.. 더보기
[코드포스 Practice9] B. New Year Garland Polycarp is sad — New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands. Polycarp은 슬퍼요ㅠㅠ 왜냐면 새해가 며칠 이내로 오는데 도시에 눈이 안 내렸기 때문이에요. 그래서 새해 분위기를 내기 위해 그는 집을 몇 개의 garland로 꾸미기로 했다. The local store introduced a new service this year, called "Build your own garland". So you can buy some red, green and bl.. 더보기
[코드포스 Practice9] A. Water Buying Polycarp wants to cook a soup. To do it, he needs to buy exactly n liters of water. Polycarp은 스프를 요리하고 싶다. 그렇게 하기 위해서, 그는 정확히 n 리터의 물을 사야한다. There are only two types of water bottles in the nearby shop — 1-liter bottles and 2-liter bottles. There are infinitely many bottles of these two types in the shop. 근처 상점에는 오직 두 종류의 물병이 있다. -- 1L 물병과 2L 물병임. 가게에는 이 두 종류의 물병이 무한개 있다. The bottle of the first.. 더보기