{"id":255,"date":"2010-05-17T14:47:00","date_gmt":"2010-05-17T06:47:00","guid":{"rendered":"http:\/\/localhost\/?p=255"},"modified":"2010-05-17T14:47:00","modified_gmt":"2010-05-17T06:47:00","slug":"jsoi2007_character_encryption_cipher","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=255","title":{"rendered":"[JSOI2007]\u5b57\u7b26\u52a0\u5bc6Cipher"},"content":{"rendered":"\n<p>[JSOI2007]\u5b57\u7b26\u52a0\u5bc6Cipher<\/p>\n<p>Time Limit:10000MS  Memory Limit:165536K<br \/>Total Submit:76 Accepted:34 <br \/>Case Time Limit:1000MS<\/p>\n<p><strong>Description <\/strong><\/p>\n<p>\u559c\u6b22\u94bb\u7814\u95ee\u9898\u7684JS \u540c\u5b66\uff0c\u6700\u8fd1\u53c8\u8ff7\u4e0a\u4e86\u5bf9\u52a0\u5bc6\u65b9\u6cd5\u7684\u601d\u8003\u3002\u4e00\u5929\uff0c\u4ed6\u7a81\u7136\u60f3\u51fa\u4e86\u4e00\u79cd\u4ed6\u8ba4\u4e3a\u662f\u7ec8\u6781\u7684\u52a0\u5bc6\u529e\u6cd5\uff1a\u628a\u9700\u8981\u52a0\u5bc6\u7684\u4fe1\u606f\u6392\u6210\u4e00\u5708\uff0c\u663e\u7136\uff0c\u5b83\u4eec\u6709\u5f88\u591a\u79cd\u4e0d\u540c\u7684\u8bfb\u6cd5\u3002\u4f8b\u5982\u4e0b\u56fe\uff0c\u53ef\u4ee5\u8bfb\u4f5c\uff1a <br \/><img decoding=\"async\" src=\"http:\/\/61.187.179.132:8080\/JudgeOnline\/images\/1031\/1.jpg\" \/> <br \/>JSOI07 <br \/>SOI07J <br \/>OI07JS <br \/>I07JSO <br \/>07JSOI <br \/>7JSOI0 <br \/>\u628a\u5b83\u4eec\u6309\u7167\u5b57\u7b26\u4e32\u7684\u5927\u5c0f\u6392\u5e8f\uff1a <br \/>07JSOI <br \/>7JSOI0 <br \/>I07JSO <br \/>JSOI07 <br \/>OI07JS <br \/>SOI07J <br \/>\u8bfb\u51fa\u6700\u540e\u4e00\u5217\u5b57\u7b26\uff1aI0O7SJ\uff0c\u5c31\u662f\u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\uff08\u5176\u5b9e\u8fd9\u4e2a\u52a0\u5bc6\u624b\u6bb5\u5b9e\u5728\u5f88\u5bb9\u6613\u7834\u89e3\uff0c\u9274\u4e8e\u8fd9\u662f\u7a81\u7136\u60f3\u51fa\u6765\u7684\uff0c\u90a3\u5c31^^\uff09\u3002 <br \/>\u4f46\u662f\uff0c\u5982\u679c\u60f3\u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\u5b9e\u5728\u592a\u957f\uff0c\u4f60\u80fd\u5199\u4e00\u4e2a\u7a0b\u5e8f\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u5417\uff1f <\/p>\n<p><strong>Input <\/strong><\/p>\n<p>\u8f93\u5165\u6587\u4ef6\u5305\u542b\u4e00\u884c\uff0c\u6b32\u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\u3002\u6ce8\u610f\u5b57\u7b26\u4e32\u7684\u5185\u5bb9\u4e0d\u4e00\u5b9a\u662f\u5b57\u6bcd\u3001\u6570\u5b57\uff0c\u4e5f\u53ef\u4ee5\u662f\u7b26\u53f7\u7b49\u3002 <\/p>\n<p><strong>Output <\/strong><\/p>\n<p>\u8f93\u51fa\u4e00\u884c\uff0c\u4e3a\u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\u3002 <\/p>\n<p><strong>Sample Input <\/strong><\/p>\n<\/p>\n<p><strong>Sample Output <\/strong><\/p>\n<\/p>\n<p><strong>Source <br \/>\u5f88\u663e\u7136\uff0c\u66b4\u529b\u4e0a\u540e\u7f00\u6570\u7ec4\u3002\u3002\u3002\u54ce\u3002\u539f\u6765\u89c9\u5f97\u540e\u7f00\u6570\u7ec4\u5f88\u96be\uff0c\u73b0\u5728\u968f\u4fbf\u5199\u4e86\uff0c\u770b\u6765\u4e8b\u5728\u4eba\u4e3a\u554a\u56e7\u3002\u3002<br \/>Code\uff1a<br \/><\/strong><\/p>\n<p>#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;iostream&gt;#define rep(i,n) for(int i=0;i&lt;n;i++)using namespace std;const int maxn=100000*2+1;int n,m,sa[maxn],ta[maxn],tb[maxn],*x=ta,*y=tb;char C[maxn];bool cmp(int i,int j,int l){    return y[i]==y[j]&amp;&amp;y[i+l]==y[j+l];}void Sort(){    static int w[maxn];    rep(i,m)w[i]=0;rep(i,n)w[x[y[i]]]++;    rep(i,m-1)w[i+1]+=w[i];    for(int i=n-1;i&gt;=0;i&#8211;)sa[&#8211;w[x[y[i]]]]=y[i];}void Da(){    int i,j,p;    rep(i,n)x[i]=C[i],y[i]=i;Sort();    for(p=1,j=1;p&lt;n;m=p,j*=2)    {        for(p=0,i=n-j;i&lt;n;i++)y[p++]=i;        rep(i,n)if(sa[i]&gt;=j)y[p++]=sa[i]-j;Sort();        for(swap(x,y),i=1,p=1,x[sa[0]]=0;i&lt;n;i++)            x[sa[i]]=cmp(sa[i-1],sa[i],j)?p-1:p++;    }}int main(){    \/\/freopen(&quot;in&quot;,&quot;r&quot;,stdin);    gets(C);n=strlen(C);    rep(i,n)C[n+i]=C[i];n&lt;&lt;=1;C[n++]=0;m=256;    Da();int s=n\/2;    rep(i,n)if(sa[i]&lt;s)printf(&quot;%c&quot;,C[s+sa[i]-1]);    printf(&quot;n&quot;);}I0O7SJ\u6570\u636e\u89c4\u6a21\u5bf9\u4e8e40%\u7684\u6570\u636e\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u4e0d\u8d85\u8fc710000\u3002\u5bf9\u4e8e100%\u7684\u6570\u636e\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u4e0d\u8d85\u8fc7100000\u3002JSOI07 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[JSOI2007]\u5b57\u7b26\u52a0\u5bc6Cipher Time Limit:10000MS Memory Limit:165536KTotal Submit:76 Accepted:34 Case Time Limit:1000MS Description \u559c\u6b22\u94bb\u7814\u95ee\u9898\u7684JS \u540c\u5b66\uff0c\u6700\u8fd1\u53c8\u8ff7\u4e0a\u4e86\u5bf9\u52a0\u5bc6\u65b9\u6cd5\u7684\u601d\u8003\u3002\u4e00\u5929\uff0c\u4ed6\u7a81\u7136\u60f3\u51fa\u4e86\u4e00\u79cd\u4ed6\u8ba4\u4e3a\u662f\u7ec8\u6781\u7684\u52a0\u5bc6\u529e\u6cd5\uff1a\u628a\u9700\u8981\u52a0\u5bc6\u7684\u4fe1\u606f\u6392\u6210\u4e00\u5708\uff0c\u663e\u7136\uff0c\u5b83\u4eec\u6709\u5f88\u591a\u79cd\u4e0d\u540c\u7684\u8bfb\u6cd5\u3002\u4f8b\u5982\u4e0b\u56fe\uff0c\u53ef\u4ee5\u8bfb\u4f5c\uff1a JSOI07 SOI07J OI07JS I07JSO 07JSOI 7JSOI0 \u628a\u5b83\u4eec\u6309\u7167\u5b57\u7b26\u4e32\u7684\u5927\u5c0f\u6392\u5e8f\uff1a 07JSOI 7JSOI0 I07JSO JSOI07 OI07JS SOI07J \u8bfb\u51fa\u6700\u540e\u4e00\u5217\u5b57\u7b26\uff1aI0O7SJ\uff0c\u5c31\u662f\u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\uff08\u5176\u5b9e\u8fd9\u4e2a\u52a0\u5bc6\u624b\u6bb5\u5b9e\u5728\u5f88\u5bb9\u6613\u7834\u89e3\uff0c\u9274\u4e8e\u8fd9\u662f\u7a81\u7136\u60f3\u51fa\u6765\u7684\uff0c\u90a3\u5c31^^\uff09\u3002 \u4f46\u662f\uff0c\u5982\u679c\u60f3\u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\u5b9e\u5728\u592a\u957f\uff0c\u4f60\u80fd\u5199\u4e00\u4e2a\u7a0b\u5e8f\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u5417\uff1f Input \u8f93\u5165\u6587\u4ef6\u5305\u542b\u4e00\u884c\uff0c\u6b32\u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\u3002\u6ce8\u610f\u5b57\u7b26\u4e32\u7684\u5185\u5bb9\u4e0d\u4e00\u5b9a\u662f\u5b57\u6bcd\u3001\u6570\u5b57\uff0c\u4e5f\u53ef\u4ee5\u662f\u7b26\u53f7\u7b49\u3002 Output \u8f93\u51fa\u4e00\u884c\uff0c\u4e3a\u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\u3002 Sample Input Sample Output Source \u5f88\u663e\u7136\uff0c\u66b4\u529b\u4e0a\u540e\u7f00\u6570\u7ec4\u3002\u3002\u3002\u54ce\u3002\u539f\u6765\u89c9\u5f97\u540e\u7f00\u6570\u7ec4\u5f88\u96be\uff0c\u73b0\u5728\u968f\u4fbf\u5199\u4e86\uff0c\u770b\u6765\u4e8b\u5728\u4eba\u4e3a\u554a\u56e7\u3002\u3002Code\uff1a #include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;iostream&gt;#define rep(i,n) for(int i=0;i&lt;n;i++)using namespace std;const int maxn=100000*2+1;int n,m,sa[maxn],ta[maxn],tb[maxn],*x=ta,*y=tb;char C[maxn];bool cmp(int i,int j,int l){ return y[i]==y[j]&amp;&amp;y[i+l]==y[j+l];}void Sort(){ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/255"}],"collection":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=255"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}