ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1510. Order

I can't understand why compile write me: "Wrong answer"
Posted by lomobit 1 Nov 2012 00:50
This is my code:


program num_1510;
type ar = array of longint;
var N,i,j,c,a:longint;
arr,arr2,arr3:ar; pow:boolean;
BEGIN
    read(N);
    setlength(arr,N+2);
    setlength(arr2,N+2);
    setlength(arr3,N+2);
    for i:=1 to N do
        read(arr[i]);
    arr2[1]:=arr[1];
    c:=1;
    for i:=1 to N do
        begin
            for j:=1 to N do
                begin
                    if arr2[j]=arr[i]
                        then
                            begin
                                pow:=false;
                                break;
                            end
                        else
                            begin
                                pow:=true;
                            end;
                end;
            if pow then begin arr2[c]:=arr[i]; c:=c+1; end;
        end;
    for i:=1 to N do
        begin
            for j:=1 to N do
                begin
                    if arr[i]=arr2[j] then c:=j;
                end;
            arr3[c]:=arr3[c]+1;
        end;
    a:=arr3[1];
    for i:=1 to N do
        begin
            if a>arr3[i+1]
            then a:=a
            else a:=arr3[i+1];
        end;
    for i:=1 to N do
        begin
            if a = arr3[i]
            then begin a:=i; break; end;
        end;
    write(arr2[a]);
END.



Please, help me:)

Edited by author 01.11.2012 00:53