Submission #955844

#TimeUsernameProblemLanguageResultExecution timeMemory
955844Trisanu_DasAmusement Park (CEOI19_amusementpark)C++17
42 / 100
3011 ms162160 KiB
#include "bits/stdc++.h" using namespace std; #define int long long typedef array<int, 2> pii; int a[200], b[200]; int32_t main(){ int n, m; cin >> n >> m; for(int i = 0; i < m; ++i){ cin >> a[i] >> b[i]; --a[i], --b[i]; } unordered_set<int> ans; vector<int> perm(n); for(int i = 0; i < n; ++i) perm[i] = i; int ret = 0; do { int x = 0; int y = 0; for(int i=0; i<m; ++i) if(perm[a[i]] < perm[b[i]]) x |= 1ll << i, ++y; if(!ans.count(x)){ ans.insert(x); ret += y; } } while(next_permutation(perm.begin(), perm.end())); cout << ret % 998244353 << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...