Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为甚么这个不过,下面拍了无数组(与AC的程序)

Posted by hzoi_hexing at 2014-02-23 18:19:03 on Problem 2533
In Reply To:Re:为甚么这个不过,下面拍了无数组(与AC的程序) Posted by:hzoi_hexing at 2014-02-23 18:18:15
var
    n,i,l,r,x,mid:longint;
    f:array[0..10000]of longint;
begin
  
    read(n);
    for i:=1 to n do
    begin
      read(x);
      l:=1;r:=f[0];
      while l<r do
        begin
          mid:=(l+r)shr 1;
          if f[mid]<x then
            l:=mid+1 else r:=mid;
        end;
      if (l>=r)and(x>f[f[0]])then
        begin
          f[0]:=f[0]+1;
          f[f[0]]:=x;
          l:=f[0];
        end else
          if x<f[l] then
            f[l]:=x;
     end;
    write(f[0]);
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator