using System; using System.Collections; using System.Collections.Generic; using System.Drawing; namespace A333866 { class Program { static void Main(string[] args) { List seq = new List(); Size z = new Size(); int n = 0; while (!Out(z) && seq.Count < 10000) { n++; bool ok = true; foreach (Size o in seq) { Size dir = o - z; Size xdir = new Size(dir.Height, -dir.Width); if (Seen(z + xdir) && Seen(o + xdir)) { ok = false; break; } } if (ok) { See(z); seq.Add(z); Console.WriteLine("{0} {1}", seq.Count, n); } z = Move(z); } } static Size Move(Size z) { int w = Math.Max(Math.Abs(z.Width), Math.Abs(z.Height)); if (z.Height == -w) { return z + new Size(1, 0); } else if (z.Width == -w) { return z + new Size(0, -1); } else if (z.Height == w) { return z + new Size(-1, 0); } else { return z + new Size(0, 1); } } static bool Out(Size z) { return Math.Max(Math.Abs(z.Width), Math.Abs(z.Height)) > W; } static bool Seen(Size z) { return !Out(z) && seen[z.Width + W][z.Height + W]; } static void See(Size z) { seen[z.Width + W][z.Height + W] = true; } private const int W = 250; private static readonly BitArray[] seen = new BitArray[2 * W + 1]; static Program() { for (int m = 0; m < seen.Length; m++) { seen[m] = new BitArray(2 * W + 1); } } } }