RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00648

Logaritam

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Hrvoje has recently learned about the logarithm function. He really likes the
property log(\(xy\)) = log(\(x\)) + log(\(y\)), for each pair of positive real numbers \(x\) and \(y\).
He is actually not interested in the function itself, but in logarithmic sequences.
A logarithmic sequence of length \(n\) is a sequence of real numbers (\(a\)1, a2, . . . , a\(n\))
for which \(a@@RISE_MATH_BLOCK_0@@x + a@@RISE_MATH_BLOCK_1@@i\) of the element Matej had changed in the
\(i-th\) sequence.
Note: It can be proven that for any starting logarithmic sequence the minimal number of changes is the
same.

제약

Subtask 1 (19 points): \(n \le 20\), \(q \le 20\)

Subtask 2 (26 points): \(q \le 8\)

Subtask 3 (29 points): \(n \le 10^{4}\)

Subtask 4 (36 points): No additional constraints.

입력 형식

In the first line there are two positive integers \(n\) and \(q\) (\(1 \le n \le 10^{8}\), \(1 \le q \le 10^{4}\)), the length of each
sequence and the number of sequences.
In the \(i-th\) of the next \(q\) lines there is a positive integer \(x@@RISE_MATH_BLOCK_0@@i \le n\)), the index of the element Matej
had changed in the \(i-th\) sequence.

출력 형식

In the \(i-th\) line outp\(ut -1\) if Hrvoje cannot change the other elements of the \(i-th\) sequence such that the
sequence becomes logarithmic again, otherwise output the minimal number of changes needed to make
the sequence logarithmic again.

서브태스크
서브태스크점수설명

1

19점

\(n \le 20\), \(q \le 20\)

2

26점

\(q \le 8\)

3

29점

\(n \le 10^{4}\)

4

36점

No additional constraints.

예제 1
입력
6 6
1
2
3
4
5
6
출력
-1
2
1
2
0
1
예제 2
입력
20 5
7
8
2
19
12
출력
1
9
9
0
5
예제 3
입력
10000 4
1234
2345
3456
7890
출력
15
148
3332
37
설명

Clarification of the first example:
If the starting sequence was 0, 1, π, 2, 0.7, 1 + π and Matej changes the fourth element to 8, Hrvoje can
change the second element to 4 and the sixth to 4 + π, after which the sequence 0, 4, π, 8, 0.7, 4 + π will be
logarithmic again.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2022/2023 Contest 5

평가 및 의견

Logaritam

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Logaritam

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8