我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

本页主题: ACM题征解(活动结束) 显示签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

richardxx





性别: 保密 状态: 该用户目前不在线
等级: 品行端正
发贴: 193
威望: 0
浮云: 1144
在线等级:
注册时间: 2005-10-01
最后登陆: 2009-02-28

5come5帮你背单词 [ toothbrush /'tu:θbrΛ/ n. 牙刷 ]


ACM题征解(活动结束)

Binary codes   poj1147
Time Limit:1000MS Memory Limit:65536K
Total Submit:1695 Accepted:626

Description

Consider a binary string (b1…bN) with N binary digits. Given such a string, the matrix of Figure 1 is formed from the rotated versions of the string.

  b1   b2 … bN-1 bN

  b2   b3 … bN   b1

  …

  bN-1 bN … bN-3 bN-2

  bN   b1 … bN-2 bN-1



  Figure 1. The rotated matrix

Then rows of the matrix are sorted in alphabetical order, where ‘0’ is before ‘1’. You are to write a program which, given the last column of the sorted matrix, finds the first row of the sorted matrix.

As an example, consider the string (00110). The sorted matrix is

  0 0 0 1 1

  0 0 1 1 0

  0 1 1 0 0

  1 0 0 0 1

  1 1 0 0 0

and the corresponding last column is (1 0 0 1 0). Given this last column your program should determine the first row, which is (0 0 0 1 1).

Input

The first line contains one integer N ≤ 3000, the number of binary digits in the binary string. The second line contains N integers, the binary digits in the last column from top to bottom.

Output

The first line contains N integers: the binary digits in the first row from left to right.

Sample Input

5
1 0 0 1 0

Sample Output

0 0 0 1 1

Source
IOI 2001 (back-up task)


[ 此贴被kangtalc在2007-04-16 12:28重新编辑 ]
顶端 Posted: 2007-04-10 13:14 | [楼 主]
richardxx





性别: 保密 状态: 该用户目前不在线
等级: 品行端正
发贴: 193
威望: 0
浮云: 1144
在线等级:
注册时间: 2005-10-01
最后登陆: 2009-02-28

5come5帮你背单词 [ gasoline /'gæsəli:n/ n. (美语)汽油 ]


我自己解决加浮云否?
本帖最近评分记录:
  • 浮云:0 (by kangtalc) | 理由: 可以加~~不过要少那么点点~
  • 顶端 Posted: 2007-04-10 21:19 | [1 楼]
    richardxx





    性别: 保密 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 193
    威望: 0
    浮云: 1144
    在线等级:
    注册时间: 2005-10-01
    最后登陆: 2009-02-28

    5come5帮你背单词 [ mean /mi:n/ B v. 表…的意思,意指,意为,意欲,意味着… ]


    当,,!!!
    是从小到大排列的,哪来的问题。。。

    嘿嘿,再给你一次机会吧,我其实已经搞定了。。。
    顶端 Posted: 2007-04-11 17:18 | [2 楼]
    richardxx





    性别: 保密 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 193
    威望: 0
    浮云: 1144
    在线等级:
    注册时间: 2005-10-01
    最后登陆: 2009-02-28

    5come5帮你背单词 [ truthful /'tru:θful/ a. 真实的,说实话的,诚实的 ]


    到poj去提,你就知道对不对了。。。
    顶端 Posted: 2007-04-11 17:18 | [3 楼]
    richardxx





    性别: 保密 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 193
    威望: 0
    浮云: 1144
    在线等级:
    注册时间: 2005-10-01
    最后登陆: 2009-02-28

    5come5帮你背单词 [ fill /fil/ v. 装满,真(空) ]


    比赛完了我来公布答案,版主先不要慌加FY给楼上...
    顶端 Posted: 2007-04-13 00:30 | [4 楼]
    richardxx





    性别: 保密 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 193
    威望: 0
    浮云: 1144
    在线等级:
    注册时间: 2005-10-01
    最后登陆: 2009-02-28

    5come5帮你背单词 [ striking /'straikiŋ/ a. 引人注目的,显著的 ]


    把compile error 的错误贴出来给我。。。
    顶端 Posted: 2007-04-13 13:13 | [5 楼]
    richardxx





    性别: 保密 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 193
    威望: 0
    浮云: 1144
    在线等级:
    注册时间: 2005-10-01
    最后登陆: 2009-02-28

    5come5帮你背单词 [ couch /kaut/ n. 睡椅,长沙发椅;vt. 表达,隐含 ]


    我看见kiwiy过了。
    楼楼上的再加油。。
    顶端 Posted: 2007-04-13 16:59 | [6 楼]
    richardxx





    性别: 保密 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 193
    威望: 0
    浮云: 1144
    在线等级:
    注册时间: 2005-10-01
    最后登陆: 2009-02-28

    5come5帮你背单词 [ obligation /obli'geiən/ n. 义务,职责,恩惠 ]


    Quote:
    引用第30楼hhbhhb于2007-04-16 12:16发表的:
    汗。。
    数下有几个1,,然后全放到最后就可以了。。



    hhb,这不应该是你的水平吧。。。。
    顶端 Posted: 2007-04-16 12:18 | [7 楼]
    我来我网·5come5 Forum » 程序员之家

    Total 0.014455(s) query 6, Time now is:07-11 19:42, Gzip enabled
    Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号