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

Spiderman

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

의견: 0

설명

Little Ivan likes to play Yamb and read Marvel superhero comics. His
favorite superhero is spid\(er-ma\)n, a friendly neighbourhood teenager named
Peter Parker who got his superpowers via a radioactive spider bite. Ivan
fantasizes that one day he will be able to jump from one skyscraper to
another, just like spid\(er-ma\)n does in the comics. During one such fantasy,
he fell asleep.
In his dream he was no longer named Ivan, his name was Peter Parkour and,
you guessed it, he was able to use his parkour^{1} skills to jump between skyscrapers. He quickly realized that
there are exactly \(N\) skyscrapers in his surroundings and he somehow knew that \(i-th\) of those skyscrapers
is \(h_{i}\) meters tall. He knows that he is able to jump from the \(i-th\) skyscraper to the \(j-th\) skyscraper if the
remainder when dividing \(h@@RISE_MATH_BLOCK_0@@j\) is equal to \(K\). Help Ivan determine, for every skyscraper, the number
of other skyscrapers he can jump to.

제약

In test cases worth a total of 14 points, it will hold \(1 \le N \le 2\,000\)
In test cases worth an additional 14 points, there will be at most 2 000 skyscrapers of different heights.
In test cases worth an additional 14 points, it will hold \(K = 0\).

입력 형식

The first line contains two integers \(N\) (\(1 \le N \le 300\,000\)) and \(K\) (\(0 \le K < 10^{6}\)) from the task description.
The next line contains \(N\) integers \(h@@RISE_MATH_BLOCK_0@@i \le 10^{6}\)) from the task description.

출력 형식

In a single line you should output \(N\) spa\(ce-se\)parated integers such that the \(i-th\) of those integers represents
the number of different skyscrapers on which Peter Parkour can jump on if he jumps from the \(i-th\)
skyscraper.

예제 1
입력
2 1
5 5
출력
0 0
예제 2
입력
6 3
4 3 12 6 8 2
출력
0 4 0 0 0 0
예제 3
입력
5 1
1 3 5 7 2
출력
4 1 1 2 0
설명

Clarification of the third example:
From the first skyscraper of height 1 Peter can jump on any other skyscraper.
From the second skyscraper of height 3 Peter can jump only on a skyscraper of height 2.
From the third skyscraper of height 5 Peter can jump only on a skyscraper of height 2.
From the fourth skyscraper of height 7 Peter can jump on skyscrapers of heights 2 and 3.
From the fifth skyscraper of height 2 Peter cannot jump on any other skyscraper.
1Internet sensation of 2004., it was in the Bond films, the goal is to get from point A to point B as creatively as possible.

문제 정보

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

출처 COCI 2019/2020 Contest 4

평가 및 의견

Spiderman

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

Log in to rate problems.

개별 의견

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

풀이 제출

Spiderman

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