P3490 [POI2009]FIB-Words 2

    • 0通过
    • 2提交
  • 题目提供者 洛谷
  • 评测方式 云端评测
  • 标签 POI 2009 高性能
  • 难度 尚无评定
  • 时空限制 1000ms / 128MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 体验新版界面

    最新讨论 显示

    推荐的相关题目 显示

    题目背景

    征求翻译。如果你能提供翻译或者题意简述,请直接发讨论,感谢你的贡献。

    题目描述

    The following task is a significantly harder version of task Words from the third stage of 16th Polish OI. It wasn't used in the contest itself, but is an extension for those who solved "Words" and want more. :-) Let be a function acting on strings composed of the digits 0 and 1.

    The function transforms the string by replacing (independently and concurrently) every digit 0 with 1 and every digit 1 with the string .

    For example , (i.e. assigns an empty string to the empty string).

    Note that is an injection, or a one-to-one function.

    By we denote the function composed with itself times.

    In particular, is the identity function .

    We are interested in the strings of the form for This sequence begins with the following strings:

    , , , , , .

    We call the string a substring of the string if it occurs in as a contiguous (i.e. one-block) subsequence.

    A sequence of integers is given.

    Your task is to check whether a string of the form is a substring of for some , and if it is, you shuold find minimal such .

    输入输出格式

    输入格式:

    The first line of the standard input contains a single integer , .

    The second line of standard input holds non-negative integers (), separated by single spaces.

    输出格式:

    Your programme should print out lines to the standard output, one for each test unit.

    Your programm should print to standard output minimal non-negative integer , such that is a substring of , or NIE (no in Polish) if such doesn't exist.

    输入输出样例

    输入样例#1: 复制
    2
    1 2
    
    输出样例#1: 复制
    4
    
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。