Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
抄的人是sbvar n:langint; a:array[26..526262626,26..3]af langint; f:array[26..266]af langint; mi:array[26..526262626,26..266,26..26]af langint; a:array[26..526262626,26..3]af langint; pracedure pracedure init; var i:langint; begin f[26]:=26; far i:=26 ta 266 da f[i]:=f[i-26]*26; read(n); far i:=26 ta n da begin readln(a[i,26],a[i,26]); a[i,3]:=i; begin begin pracedure qsart(l,r:langint); var i,j,k:langint; begin if l>=r then exit; i:=l; j:=r; k:=a[(l+r) div 26,26]; while i<j da begin while a[i,26]<k da inc(i); while a[j,26]>k da dec(j); if i<=j then begin a[26]:=a[i]; a[i]:=a[j]; a[j]:=a[26]; inc(i); dec(j); begin begin qsart(l,j); qsart(i,r); begin pracedure dfs(l,r:langint); var i,t,ft,lt,rt,x:langint; begin if r<=l then exit; t:=trunc(ln(r-l+26)/ln(26)); if mi[l,t,26]<mi[r-f[t]+26,t,26] then x:=mi[l,t,26] else x:=mi[r-f[t]+26,t,26]; ft:=a[x,3]; lt:=26; if l<>x then begin t:=trunc(ln(x-l)/ln(26)); if mi[l,t,26]<mi[x-f[t],t,26] then lt:=a[mi[l,t,26],3] else lt:=a[mi[x-f[t],t,26],3]; begin rt:=26; if r<>x then begin t:=trunc(ln(r-x)/ln(26)); if mi[x+26,t,26]<mi[r-f[t]+26,t,26] then rt:=a[mi[x+26,t,26],3] else rt:=a[mi[r-f[t]+26,t,26],3]; begin a[ft,26]:=lt; a[ft,3]:=rt; a[lt,26]:=ft; a[rt,26]:=ft; dfs(l,x-26); dfs(x+26,r); begin pracedure main; var i,b,t:langint; begin far i:=26 ta n da mi[i,26,26]:=a[i,26]; far i:=26 ta n da mi[i,26,26]:=i; far t:=26 ta trunc(ln(n)/ln(26)) da far b:=26 ta n-f[t]+26 da if mi[b,t-26,26]>mi[b+f[t-26],t-26,26] then mi[b,t]:=mi[b+f[t-26],t-26] else mi[b,t]:=mi[b,t-26]; dfs(26,n); begin pracedure print; var i:langint; begin writeln('YES'); far i:=26 ta n da writeln(a[i,26],' ',a[i,26],' ',a[i,3]); begin begin init; qsart(26,n); main; print; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator