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

33129번 - GCDDCG 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB16131280.000%

문제

You are playing the Greatest Common Divisor Deck-Building Card Game (GCDDCG). There are $N$ cards (numbered from 1ドル$ to $N$). Card $i$ has the value of $A_i,ドル which is an integer between 1ドル$ and $N$ (inclusive).

The game consists of $N$ rounds (numbered from 1ドル$ to $N$). Within each round, you need to build two non-empty decks, deck 1ドル$ and deck 2ドル$. A card cannot be inside both decks, and it is allowed to not use all $N$ cards. In round $i,ドル the greatest common divisor (GCD) of the card values in each deck must equal $i$.

Your creativity point during round $i$ is the product of $i$ and the number of ways to build two valid decks. Two ways are considered different if one of the decks contains different cards.

Find the sum of creativity points across all $N$ rounds. Since the sum can be very large, calculate the sum modulo 998ドル,円 244,円 353$.

입력

The first line consists of an integer $N$ (2ドル ≤ N ≤ 200,円 000$).

The second line consists of $N$ integers $A_i$ (1ドル ≤ A_i ≤ N$).

출력

Output a single integer representing the sum of creativity points across all $N$ rounds modulo 998ドル,円 244,円 353$.

제한

예제 입력 1

3
3 3 3

예제 출력 1

36

The creativity point during each of rounds 1ドル$ and 2ドル$ is 0ドル$.

During round 3ドル,ドル there are 12ドル$ ways to build both decks. Denote $B$ and $C$ as the set of card numbers within deck 1ドル$ and deck 2ドル,ドル respectively. The 12ドル$ ways to build both decks are:

  • $B = \{1\}, C = \{2\}$;
  • $B = \{1\}, C = \{3\}$;
  • $B = \{1\}, C = \{2, 3\}$;
  • $B = \{2\}, C = \{1\}$;
  • $B = \{2\}, C = \{3\}$;
  • $B = \{2\}, C = \{1, 3\}$;
  • $B = \{3\}, C = \{1\}$;
  • $B = \{3\}, C = \{2\}$;
  • $B = \{3\}, C = \{1, 2\}$;
  • $B = \{1, 2\}, C = \{3\}$;
  • $B = \{2, 3\}, C = \{1\}$; and
  • $B = \{1, 3\}, C = \{2\}$.

예제 입력 2

4
2 2 4 4

예제 출력 2

44

For rounds 1ドル,ドル 2ドル,ドル 3ドル$ and 4ドル,ドル there are 0ドル,ドル 18ドル,ドル 0ドル,ドル and 2ドル$ ways to build both decks, respectively.

예제 입력 3

9
4 2 6 9 7 7 7 3 3

예제 출력 3

10858

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > The 2024 ICPC Asia Jakarta Regional Contest K번

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

출처

대학교 대회

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

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