Repunits

AtCoder
IDarc202_c
Time2000ms
Memory256MB
Difficulty
For a positive integer $n$, define $R_n$ as "the integer obtained by interpreting a string of $n$ consecutive $1$s as a decimal number". For example, $R_3 = 111$. You are given a positive integer sequence $A = (A_1, A_2, \dots, A_N)$. For $k = 1, 2, \dots, N$, calculate $\mathrm{LCM}(R_{A_1}, R_{A_2}, \dots, R_{A_k}) \bmod 998244353$. Here, $\mathrm{LCM}$ is the function that calculates the least common multiple. ## Constraints * $1 \leq N \leq 2 \times 10^5$ * $1 \leq A_i \leq 2 \times 10^5$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $A_1$ $A_2$ $\dots$ $A_N$ [samples]
Samples
Input #1
3
2 4 6
Output #1
11
1111
11222211

For $k=1$, $\mathrm{LCM}(11) \bmod 998244353 = 11$.  
For $k=2$, $\mathrm{LCM}(11,1111) \bmod 998244353= 1111$.  
For $k=3$, $\mathrm{LCM}(11,1111,111111) \bmod 998244353= 11222211$.
Input #2
1
200000
Output #2
202819780
Input #3
10
47718 21994 98917 104184 160670 190107 125377 29127 7017 177076
Output #3
429620650
844699313
355160870
608402385
858856681
605347397
566966598
429324494
370941155
567238109
API Response (JSON)
{
  "problem": {
    "name": "Repunits",
    "description": {
      "content": "For a positive integer $n$, define $R_n$ as \"the integer obtained by interpreting a string of $n$ consecutive $1$s as a decimal number\". For example, $R_3 = 111$. You are given a positive integer sequ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc202_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For a positive integer $n$, define $R_n$ as \"the integer obtained by interpreting a string of $n$ consecutive $1$s as a decimal number\". For example, $R_3 = 111$.\nYou are given a positive integer sequ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments