{ const int N = 1000; typedef List<SInt<0, oo> > Queens; Queens queens(N); List<Int> queens1(N); List<Int> queens2(N); for (int i = 0 ; i < N ; ++i) queens[i] < N; for(int i = 0 ; i < N ; ++i) { queens1[i] == queens[i] + i; queens2[i] == queens[i] - i; } all_diff(queens); all_diff(queens1); all_diff(queens2); SolSet<Queens> S(queens); S.Search().use(queens, choice::variable::smallest_domain, valueChoice); cout << to_string(*S.begin()); }
Notice, however, that EasyCP's first focus is not efficiency. Rather, emphasis is put on ease of use and rapid prototyping.