This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
#ifdef B01
#include "../deb.h"
#else
#define deb(...)
#endif
const int N = 2003;
int n;
set<vector<int>> se;
void initialize(int n_) {
n = n_;
vector<int> p(n);
iota(p.begin(), p.end(), 0);
do {
se.insert(p);
} while (next_permutation(p.begin(), p.end()));
}
int hasEdge(int u, int v) {
vector<vector<int>> rem;
for (const auto& p : se) {
bool bl = false;
for (int i = 0; i < n - 1; i++) {
if ((p[i] == u && p[i + 1] == v) || (p[i] == v && p[i + 1] == u)) {
bl = true;
}
}
if (bl) {
rem.push_back(p);
}
}
if (se.size() == rem.size()) {
return 1;
}
for (const auto& p : rem) {
se.erase(p);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |