본문 바로가기

코드포스/div34

B. Alphabetical Strings ### 문제 설명 : ; A stringssof lengthnn(1≤n≤261≤n≤26) is calledalphabeticalif it can be obtained using the following algorithm: first, write an empty string toss(i.e. perform the assignmentss := ""); then perform the next stepnntimes; at theii-th step takeii-th lowercase letter of the Latin alphabet and write it either to the left of the stringssor to the right of the stringss(i.e. perform the assig.. 2021. 8. 9.
A. Shortest Path with Obstacle 문제 설명 : There are three cells on an infinite 2-dimensional grid, labeled A, B, and F. Find the length of the shortest path from A to B if: in one move you can go to any of the four adjacent cells sharing a side; visiting the cell F is forbidden (it is an obstacle). 주어진 a, b, f좌표가 있는데 f는 피하면서 가장 짧은 a - > b로의 거리를 찾는 문제였다. 틀린 이유 처음에 가장 짧은이면서 그래프가 나오길래 흥분해서 bfs로 했다. 시간초과가 발생하였다 그 이유는 t가 10^4이고 맵이 1,.. 2021. 8. 9.
B2. Wonderful Coloring - 2 문제 설명 each element of the sequence is either painted in one of k colors or isn't painted; each two elements which are painted in the same color are different (i. e. there's no two equal values painted in the same color); let's calculate for each of k colors the number of elements painted in the color — all calculated numbers must be equal; the total number of painted elements of the .. 2021. 8. 5.
B1.WonderfulColoring 이 문제의 조건들이 있다 each letter of the string is either painted in exactly one color (red or green) or isn't painted; each two letters which are painted in the same color are different; the number of letters painted in red is equal to the number of letters painted in green; the number of painted letters of this coloring is maximum among all colorings of the string which meet the first three condit.. 2021. 7. 29.