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 1744. The Captain's Squad

WA#3
Posted by Iosif inf-10 24 Jan 2010 16:00
what is wrong in my solution?

Program N1744;
Var
n,i,j,t,k:integer;
A:array[1..100,1..100] of integer;
R:array[1..50000,1..3] of integer;
begin
  Readln(n);

  for i:=1 to N do
    for j:=1 to N do
    if i<>j then A[i,j]:=0 else A[i,j]:=3;

  k:=0;
  for i:=1 to N do
    for j:=1 to n do
      for t:=1 to n  do

      if (A[i,j]<3)and(A[i,t]<3) and(A[j,t]<3) then
      begin
      inc(k);
      R[k,1]:=i;
      R[k,2]:=j;
      R[k,3]:=t;
      inc(A[i,j]);
      inc(A[i,t]);
      inc(A[j,t]);
      inc(A[j,i]);
      inc(A[t,i]);
      inc(A[t,j]);
      end;
    writeln(k);

    for i:=1 to k do
      writeln(R[i,1],' ',R[i,2],' ',R[i,3]);
    Readln;
end.

is there a difference in what order the output numbers of soldiers?

Edited by author 24.01.2010 16:02

Edited by author 24.01.2010 16:03
Re: WA#3
Posted by bsu.mmf.team 27 Jan 2010 04:07
For n=7 your program returns k=13 and for n=9 k=28, but correct answers are 21 and 36

Edited by author 27.01.2010 04:07
Re: WA#3
Posted by Iosif inf-10 27 Jan 2010 23:41
Can you write full output for n=7 ?
Re: WA#3
Posted by bsu.mmf.team 29 Jan 2010 17:46
For example,
21
1 2 3
1 2 3
1 2 3
1 4 5
1 4 5
1 4 5
1 6 7
1 6 7
1 6 7
2 4 6
2 4 6
2 4 6
2 5 7
2 5 7
2 5 7
3 4 7
3 4 7
3 4 7
3 5 6
3 5 6
3 5 6

I hope, it will help you.