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 |
求助:哪里错了?Program p1083(Input, Output); Type rec = Record a, b, count, l, r: Longint; End; rec1 = Record a, b: Longint; End; Var i, j, n, m, num, p, q, t1, Min, Max: Longint; t: Array[1..1000000] Of rec; c: Array[1..300] Of rec1; Procedure Maketree(p, q, x: Longint); Var mid: Longint; Begin t[x].a := p; t[x].b := q; t[x].count := 0; If q - p > 1 Then Begin mid := (p + q) Div 2; Inc(num); t[x].l := num; Maketree(p, mid, t[x].l); Inc(num); t[x].r := num; Maketree(mid, q, t[x].r); End; End; Procedure Fill(p, q, x: Longint); Begin If (p >= t[x].b) Or (q <= t[x].a) Then Exit; If (p <= t[x].a) And (q >= t[x].b) And (t[x].a + 1 = t[x].b) Then Begin Inc(t[x].count); If t[x].count > Max Then Max := t[x].count; Exit; End; Fill(p, q, t[x].l); Fill(p, q, t[x].r); End; Begin Readln(n); For i := 1 To n Do Begin Readln(m); Max := -1; Min := Maxint; For j := 1 To m Do Begin Readln(p, q); If p > q Then Begin t1 := p; p := q; q := t1; End; c[j].a := p; c[j].b := q; If Min > p Then Min := p; If Max < q Then Max := q; End; num := 1; Maketree(Min, Max, 1); Max := -1; For j := 1 To m Do Fill(c[j].a, c[j].b, 1); Writeln(Max * 10); End; End. 蟹蟹…… Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator