Logo
(追記) (追記ここまで)

32098번 - Ones 서브태스크점수다국어언어 제한함수 구현

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB14000.000%

문제

Radko again wants to know Marti’s sequence $p_1 , p_2 , \dots , p_n$. This time, Marti decided to be more helpful and directly say that the sequence consists of $n$ bits of 0ドル$ and 1ドル,ドル exactly $k$ of which are 1ドル$. This time he will only answer the following question:

  • “Is there a 1ドル$ among $p_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_{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.

구현 상세

Your function guessOnes has the following prototype: std::vector guessOnes(int n, int k);

It will be called $n_{tests}$ times for each test and will receive as arguments the sequence length $n$ and the number of ones $k$. The function should return a vector of $k$ numbers - the positions of the ones in ascending order.

The jury’s function hasOnes has the following prototype: bool hasOnes(int l, int r);

Your program can call it as many times as it wants. It receives two indexes $l$ and $r$ from 1ドル$ to $n$ for which you want to ask a question. The function returns whether there is a 1ドル$ among $p_l , p_{l+1}, \dots , p_r$. It works with complexity $O(1)$.

Your program must implement the function guessOnes, but should not contain a function main. Also, it must not read from the standard input or print to the standard output. Your program must also include the header file ones.h by an instruction to the preprocessor: #include "ones.h"

As long as it respects these conditions, your program can contain any helper functions, variables, constants, and so on.

입력

출력

제한

  • Every sequence is uniform random generated.
  • $n = 100,000円$
  • $n_{tests} = 100$

점수

The fraction of points you will get on a subtask depends on the total number of questions you ask on a subtest, $q_{participant}$ and the subtask constant $q_{author}$.

  • If $q_{participant} ≤ q_{author},ドル $score = 1$
  • Otherwise $score = 1 - \displaystyle\sqrt[4]{1 - \frac{q_{author}}{q_{participant}}}$

서브태스크

Subtasks Points $k$ $q_{author}$
1 10 10ドル$ 14ドル,480円$
2 10 20ドル$ 27ドル,201円$
3 10 50ドル$ 61ドル,908円$
4 10 100ドル$ 114ドル,144円$
5 10 200ドル$ 208ドル,697円$
6 10 500ドル$ 455ドル,937円$
7 10 1000ドル$ 811ドル,792円$
8 10 2000ドル$ 1ドル,422円,396円$
9 10 5000ドル$ 2ドル,879円,675円$
10 10 10ドル,000円$ 4ドル,723円,779円$

힌트

로컬 테스팅

The file Lgrader.cpp is provided on the system, with which you can test your program locally. To do so, you need to add #include "Lgrader.cpp" to your code.

The first line of the standard input contains the numbers $n,ドル $k$ and $n_{tests}$.

The next $n_{tests}$ lines contain $k$ numbers each – the positions of the ones. If your program successfully finds the correct sequence for each test, it will output the total number of questions you used for all sequences.

출처

Olympiad > International Autumn Tournament in Informatics > 2024 > Senior 1번

제출할 수 있는 언어

C++17, C++20, C++17 (Clang), C++20 (Clang)

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /