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

23179번 - Periodic Ruler 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB112424144.565%

문제

Hitagi has a ruler of infinite length. It has a mark on every integer, where the mark on integer $i$ has color $c_i$. Each color is represented by an integer from 1ドル$ to 100ドル$.

She noticed that the ruler's color pattern repeats with a period of $t$. The period $t$ is defined by the smallest positive integer that satisfies $c_i = c_{i+t}$ for all integers $i$.

Hitagi told Koyomi the colors of $n$ marks of her choice. Koyomi wants to find all positive integers that cannot be a period of the ruler, regardless of the colors of unchosen marks. Write a program to find all such numbers, and output their count and sum.

입력

The first line contains a single integer $n\ (1 \le n \le 50)$.

The following $n$ lines each contain two integers $x_i\ (|x_i| \le 10^9)$ and $a_i\ (1 \le a_i \le 100)$. This indicates that the integer $x_i$ is marked with the color $a_i$.

If $i \neq j,ドル then $x_i \neq x_j$.

출력

Output two integers on one line. The first integer is the number of positive integers that cannot be the period of the ruler. The second integer is their sum.

제한

예제 입력 1

3
-1 1
1 2
2 1

예제 출력 1

2 3

예제 입력 2

5
1 1
2 1
3 1
4 1
5 1

예제 출력 2

4 14

예제 입력 3

1
1000000000 100

예제 출력 3

0 0

힌트

출처

University > KAIST > KAIST ICPC Mock Competition > 2021 KAIST 11th ICPC Mock Competition J번

Contest > Open Cup > 2021/2022 Season > Stage 4: Grand Prix of Korea J번

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

출처

대학교 대회

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

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