|
|
Использую метод отжига и у меня ТЛ 16 тест, в кф проверил что у меня на макс тесте работает не более 2с. Возник вопрос, админы специально поставили такое ограничение чтобы метод отжига не проходил ? Of course It's n queens puzzle Solution can be found in wikipedia I got AC now. It is solvable without random. There is a certain algo for placing the queens. Look wikipedia for example. Edited by author 23.01.2007 22:54 I agreed with you.To use random to don't know! But in wiki algo named as heuristics? Why it not a theorem? I do't understand. random FOREVER - 0.21 I think that the matter not in wikpedia algorithm but in manner of thinking that help us to produce right algorithm quickly during context From this position random is more perspective Or problem must be understood in some standard way. Edited by author 10.09.2007 22:49 0.21 with random while 0.1 with O(N) wiki solution? HOW? I can't understand why search work with time ~0.2 sec? HOW? Who can give me the idea of full search or random solution? Can anybody tell me what is the 1-st test. can somebody tell what is the 5th test? As I understand by random selecting I cannt solve this problem, so I have searching a bit in internet some info to find algo of it - AC. But how could ACM participants check this problem? What another approach? Random --> while (true) subbmiting or what? Please tell me... Random solution combined with a local collision minimization is acceptable.
Are you sure? It's only for good luck - my random prog quikly works only for n = 200 at max. Maybe one more hint... I use approach as in standart full search by verticals and O(1) - checking diagonals and horisontals and on every step use random. Yes, the solution has the O(n) complexity. This solution is the the first approach with linear complexity for this problem. 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 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! What does Compilation error mean? Sorry, I just had to reply with sarcasm, too silly question. Sorry again. It may have syntax error, or you just use another compiler and do not know some features of local one. Please, read FAQ: http://acm.timus.ru/faq.aspxsubj Edited by author 17.12.2006 20:08 subj There is some bug in program, that check your output file. I think that admins will correct it some times later. What does Compilation error mean? |
|
|