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 1512. Zinium

What's wrong?
Posted by Muchacho 2 Apr 2007 13:28
I get WA in 1 test, why? This solution right at the least for N from 4 to 16.

var
  q, w, r, e : integer;
begin
readln( r);
e := r mod 12;

if (e = 8) or (e = 9) or (e = 3) then
  begin
  w := 6;
  for q := 1 to r div 2 do
    begin
      if w > r then w := 2;
      writeln( q, ' ', w);
      inc( w, 2)
    end;
  end
else
  begin
  w := 2;
  for q := 1 to r div 2 do
    begin
      writeln( q, ' ', w);
      inc( w, 2)
    end
  end;

w := 1;
for q := (r div 2) + 1 to r do
  begin
    writeln( q, ' ', w);
    inc( w, 2);
  end
end.


Edited by author 02.04.2007 13:30
Re: What's wrong?
Posted by Alexander Kouprin 2 Apr 2007 14:05
First test is 8.
your output:

1 6
2 8
3 2
4 4
5 1
6 3
7 5
8 7

Look:
000000+0
0000+000
00+00000
+0000000
000+0000
0+000000
0000000+
00000+00

8 7 and 3 2 placed on one 45 degrees line (diagonal).
Result: wrong answer.

Good luck!