Codeforces Round 787 (Div. 3)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1675 Codeforces Round 787 (Div. 3) FINISHED False 8100 80061899 May 5, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 18331 ) C Detective Task PROGRAMMING dp greedy

B"Polycarp bought a new expensive painting and decided to show it to his n friends. He hung it in his room. n of his friends entered and exited there one by one. At one moment there was no more than one person in the room. In other words, the first friend entered and left first, then the second, and so on. It is known that at the beginning (before visiting friends) a picture hung in the room. At the end (after the n -th friend) it turned out that it disappeared. At what exact moment it disappeared -- there is no information. Polycarp asked his friends one by one. He asked each one if there was a picture when he entered the room. Each friend answered one of three: Everyone except the thief either doesn't remember or told the truth. The thief can say anything (any of the three options). Polycarp cannot understand who the thief is. He asks you to find out the number of those who can be considered a thief according to the answers. The first number t ( 1 <= t <= 10^4 ) -- the number of test cases in the test. The following is a description of test cases. The first line of each test case contains one string s (length does not exceed 2 cdot 10^5 ) -- a description of the friends' answers, where s_i indicates the answer of the i -th friend. Each character in the string is either 0 or 1 or ?. The given regularity is described in the actual situation. In particular, on the basis of answers, at least one friend can be suspected of stealing a painting. It is guaranteed that the sum of string lengths over the entire input data set does not exceed 2 cdot 10^5 . Output one positive (strictly more zero) number xe2 x80 x93 the number of people who could steal the picture based on the data shown. In the first case, the answer is 1 since we had exactly 1 friend. The second case is similar to the first. In the third case, the suspects are the third and fourth friends (we count from one). It can be shown that n"...

Tutorials

102550

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
156034646 chenbxxx C May 6, 2022, 2:20 a.m. OK Clang++17 Diagnostics TESTS 9 62 13004800

remove filters

Back to search problems