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

Lutrija

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

의견: 0

설명

Grandpa Vedran is watching his favorite lottery show on TV in the hopes of
becoming an overnight millionaire. The lottery balls are spinning and bouncing
around before yielding the following draw: 2, 5, 7, 11, 19, 23 and 31.
Vedran sighs as he didn’t guess a single one of those numbers. “Looks like I’m
past my prime...”, he thought to himself while turning offthe old TV. His vision
is also getting worse, so he pressed the wrong button on the remote control and
switched to the COCI channel.
The host, Mr. Malnar, calmly spoke: “Dear viewers, on the left side of the screen I will show you a prime
number \(A\) and on the right side of the screen I will show you a prime number \(B\). The first person that
calls in with an array of prime numbers which starts with \(A\), ends with \(B\) and has a prime absolute
difference between each two neighbouring elements will receive a free trip to IOI 2020 in Singapore.”
Old Vedran is reminiscing about his glory days of being a competitive programmer. Unfortunately, he is
rusty and is not able to solve the problem. Being kindhearted, you decide to help Vedran win a trip to
Singapore.
Note: A prime number is a positive integer greater than 1 that is only divisible by 1 and itself.

제약

In test cases worth a total of 14 points, it will hold that if a solution exists, there is at least one such that
the number of elements in the resulting array is not greater than 3 and all of its elements are not greater
than 1000.
In test cases worth additional 28 points, it will hold \(2 \le A\), \(B \le 1000\).

입력 형식

The first line contains two prime numbers \(A\) and \(B\) (\(2 \le A\), \(B \le 10^{14}\), A̸ = \(B\)) from the task description.

출력 형식

If the task is impossible, i.e., there is no array satisfying the conditions from task statement, simply output
-1 in a single line.
Otherwise, in the first line output the number of elements in the array and in the second line output its
elements separated by spaces. The size of array must not be greater than 30 and its elements must not be
greater than \(10^{15}\). It is guaranteed that, if a solution exists, there is at least one satisfying those bounds.
If there are multiple correct solutions, output any of them.

예제 1
입력
13 11
출력
2
13 11
예제 2
입력
37 11
출력
-1
예제 3
입력
2 17
출력
3
2 19 17
문제 정보

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

출처 COCI 2019/2020 Contest 1

평가 및 의견

Lutrija

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

Log in to rate problems.

개별 의견

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

풀이 제출

Lutrija

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