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

Dlakavac

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

의견: 0

설명

\(4^{th}\) round, January \(19^{th}\), 2013

In the faraway city of Xanadu, a flu epidemic has broken out, caused by a strain known as hairy flu.
There are M people living in the city, each resident having a unique personal ID number from the
range of 0 to M – 1, inclusive. Infection with this strain lasts exactly one day, and a person can catch it
multiple times per season (since it mutates too quickly for lasting immunity).
On the first day of the epidemic, the flu was brought from another faraway country by a group of
residents nicknamed “in\(it-pa\)tients”, whose ID numbers are known. The flu's spread is based on them.
Each following day, a resident with ID number p will catch the flu iff there exists a resident with ID a
who was infected the previous day, as well as an in\(it-pa\)tient with ID b, such that:
(\(a * b\)) mod \(M = p\).
The numbers a and b need not be distinct. For example, consider a case where there are 101 people in
the town, and the in\(it-pa\)tients are 5 and 50. On the first day, the in\(it-pa\)tients are infected by definition.
On the second day, the residents infected are 25, 48 (250 mod 101), and 76 (2500 mod 101). On the
third day, one of the infected patients is 77, since (\(48 * 50\)) mod \(101 = 77\).
Who will catch the flu on the \(K-th\) day?

제약
입력 형식

The first line of input contains three positive integers, K, M, and N (\(1 \le K \le 10^{18}\), \(3 \le M \le 1500\), N <
M).
The second line of input contains N spa\(ce-se\)parated nonnegative integers, the personal ID numbers of
residents who were infected on the first day (the in\(it-pa\)tients). These numbers are unique, increasing,
and do not exceed \(M - 1\).

출력 형식

The first and only line of output must contain the personal ID numbers of residents infected with flu
on the \(K-th\) day, given spa\(ce-se\)parated and in increasing order.

예제 1
입력
1 100 3
1 2 3
출력
1 2 3
예제 2
입력
2 100 3
1 2 3
출력
1 2 3 4 6 9
예제 3
입력
10 101 2
5 50
출력
36 44 57 65
문제 정보

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

출처 COCI 2012/2013 Contest 4

평가 및 의견

Dlakavac

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

Log in to rate problems.

개별 의견

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

풀이 제출

Dlakavac

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