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;
const int nx=11, mx=1e3+5, mod=998244353;
int n, m, a[mx], b[mx], res;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>m;
for (int i=1; i<=m; i++) cin>>a[i]>>b[i];
vector<int> v;
for (int i=1; i<=n; i++) v.push_back(i);
do
{
for (int i=1; i<=m; i++) if (v[a[i]-1]>v[b[i]-1]) res=(res+1)%mod;
} while (next_permutation(v.begin(), v.end()));
cout<<res;
}
# | 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... |