Ones

시간 제한1초메모리 제한1024 MB

요약
주어진 구간 [l,r]에 1이 있는지 묻는 질의만으로, 1이 정확히 k개인 숨겨진 이진 수열을 찾는 문제다.
난이도

보통10점 중 7점

유형
이분 탐색, 분할 정복, 구간, 구현
정답자
아직 제출이 없습니다

문제

Radko again wants to know Marti’s sequence p_1,p_2,…,p_np\_1 , p\_2 , \dots , p\_n. This time, Marti decided to be more helpful and directly say that the sequence consists of nn bits of 00 and 11, exactly kk of which are 11. This time he will only answer the following question:

  • “Is there a 11 among p_l,p_l+1,…,p_rp\_l , p\_{l+1}, \dots , p\_r?”

Unfortunately, Radko is still too busy and again outsources the task to you. Your program will be tested on n_testsn\_{tests} subtests for each test, and your score will be calculated based on the total number of questions you use to find the respective sequences.

제한

  • Every sequence is uniform random generated.
  • n=100,000n = 100\\,000
  • n_tests=100n\_{tests} = 100

예제

이 문제는 공개된 예제가 없습니다.