Submission #265581

#TimeUsernameProblemLanguageResultExecution timeMemory
265581taulantAmusement Park (CEOI19_amusementpark)C++14
42 / 100
3065 ms148092 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; //height of ith start point 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 << endl; }
#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...