Submission #71953

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
719532018-08-26 03:30:07고윤하 연말콘 언제하니 (#119)Get Hundred Points! (FXCUP3_hundred)Text
0 / 100
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
bool isp[10004], g[104][104];
int deg[104];
default_random_engine re(20000901);
int mxk, k, u[104], ans[104];
bool run() {
if (k > mxk) {
cout << k << ": ";
for (int i=0; i<k; i++) cout << ans[i] << ' ';
cout << '\n';
mxk = k;
}
if (k==100) return true;
vector<int> w;
for (int i=1; i<=100; i++) if (!u[i]) if (!k or g[ans[k-1]][i]) w.push_back(i);
if (w.empty()) return false;
shuffle(w.begin(), w.end(), re);
for (int i : w) {
u[i] = 1, ans[k++] = i;
if (run()) return true;
else u[i] = 0, k--;
}
return false;
}
int main() {
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...