Submission #1062545

#TimeUsernameProblemLanguageResultExecution timeMemory
1062545thinknoexitAmusement Park (CEOI19_amusementpark)C++17
19 / 100
117 ms14404 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 998244353; int a[155], b[155], p[22]; map<ll, bool> ch; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; set<int> s; for (int i = 0;i < m;i++) { cin >> a[i] >> b[i]; } for (int i = 1;i <= n;i++) p[i] = i; int ans = 0; do { int now = 0; ll bit = 0; for (int i = 0;i < m;i++) { if (p[a[i]] > p[b[i]]) { now++; bit |= (1 << i); } } if (!ch.count(bit)) { ch[bit] = 1; ans += now; } } while (next_permutation(p + 1, p + 1 + n)); cout << ans; return 0; }
#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...