Archive for 五月 24th, 2008

SPOJ 1771 — Yet Another N-Queen Problem (code: NQUEEN)

Posted on 五月 24th, 2008.

n皇后问题,其中n<=50,而且棋盘上有一些部分已经放置皇后.Dancing Links算法搞掉,另外jl大牛似乎用一个改进的DLX算法(貌似是一个十八向的链表…)用极快的速度AC了这道题…另:C++比Pascal快一倍,真TMD无语…
{ SPOJ 1771; Yet Another N-Queen Problem - sqybi’s code - DLX}//for my winstyprogram nqueen_sqybi;  const    nn = 50;    tt = nn * 6 - 2 + nn * nn * 4;
  var    n, i, j, k, temp, tot: longint;    a: array[1..nn]of longint;    col, row, u, d, l, r, size: array[0..tt]of longint;    used: […]

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...