CF1452D.Radio Towers

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are n+2n + 2 towns located on a coordinate line, numbered from 00 to n+1n + 1 . The ii -th town is located at the point ii .

You build a radio tower in each of the towns 1,2,,n1, 2, \dots, n with probability 12\frac{1}{2} (these events are independent). After that, you want to set the signal power on each tower to some integer from 11 to nn (signal powers are not necessarily the same, but also not necessarily different). The signal from a tower located in a town ii with signal power pp reaches every city cc such that ci<p|c - i| < p .

After building the towers, you want to choose signal powers in such a way that:

  • towns 00 and n+1n + 1 don't get any signal from the radio towers;
  • towns 1,2,,n1, 2, \dots, n get signal from exactly one radio tower each.

For example, if n=5n = 5 , and you have built the towers in towns 22 , 44 and 55 , you may set the signal power of the tower in town 22 to 22 , and the signal power of the towers in towns 44 and 55 to 11 . That way, towns 00 and n+1n + 1 don't get the signal from any tower, towns 11 , 22 and 33 get the signal from the tower in town 22 , town 44 gets the signal from the tower in town 44 , and town 55 gets the signal from the tower in town 55 .

Calculate the probability that, after building the towers, you will have a way to set signal powers to meet all constraints.

输入格式

The first (and only) line of the input contains one integer nn ( 1n21051 \le n \le 2 \cdot 10^5 ).

输出格式

Print one integer — the probability that there will be a way to set signal powers so that all constraints are met, taken modulo 998244353998244353 .

Formally, the probability can be expressed as an irreducible fraction xy\frac{x}{y} . You have to print the value of xy1mod998244353x \cdot y^{-1} \bmod 998244353 , where y1y^{-1} is an integer such that yy1mod998244353=1y \cdot y^{-1} \bmod 998244353 = 1 .

输入输出样例

  • 输入#1

    2

    输出#1

    748683265
  • 输入#2

    3

    输出#2

    748683265
  • 输入#3

    5

    输出#3

    842268673
  • 输入#4

    200000

    输出#4

    202370013

说明/提示

The real answer for the first example is 14\frac{1}{4} :

  • with probability 14\frac{1}{4} , the towers are built in both towns 11 and 22 , so we can set their signal powers to 11 .

The real answer for the second example is 14\frac{1}{4} :

  • with probability 18\frac{1}{8} , the towers are built in towns 11 , 22 and 33 , so we can set their signal powers to 11 ;
  • with probability 18\frac{1}{8} , only one tower in town 22 is built, and we can set its signal power to 22 .

The real answer for the third example is 532\frac{5}{32} . Note that even though the previous explanations used equal signal powers for all towers, it is not necessarily so. For example, if n=5n = 5 and the towers are built in towns 22 , 44 and 55 , you may set the signal power of the tower in town 22 to 22 , and the signal power of the towers in towns 44 and 55 to 11 .

首页