Submission #1062536

#TimeUsernameProblemLanguageResultExecution timeMemory
1062536kunzaZa183Amusement Park (CEOI19_amusementpark)C++17
19 / 100
3060 ms180556 KiB
#include <algorithm> #include <bits/stdc++.h> using namespace std; signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int n, m; cin >> n >> m; vector<int> ht(n); vector<pair<int, int>> vpii(m); for (auto &a : vpii) { cin >> a.first >> a.second; a.first--, a.second--; } iota(ht.begin(), ht.end(), 0); long long sumc = 0; const int mod = 998244353; set<vector<int>> svi; do { vector<int> real; int curs = 0; for (auto a : vpii) { if ((ht[a.first] > ht[a.second])) { curs++; real.emplace_back(a.second); real.emplace_back(a.first); } real.emplace_back(a.first); real.emplace_back(a.second); } auto it = svi.insert(real); if (it.second) { sumc += curs; sumc %= mod; } } while (next_permutation(ht.begin(), ht.end())); cout << sumc << "\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...