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>
using namespace std;
using ll = long long;
const int MOD = 998244353;
int a[155], b[155], p[22];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
for (int i = 1;i <= m;i++) {
cin >> a[i] >> b[i];
}
for (int i = 1;i <= n;i++) p[i] = i;
int ans = 0;
do {
for (int i = 1;i <= m;i++) {
if (p[a[i]] > p[b[i]]) ans++;
}
} while (next_permutation(p + 1, p + 1 + n));
cout << ans;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |