# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062562 | kunzaZa183 | Amusement Park (CEOI19_amusementpark) | C++17 | 95 ms | 10836 KiB |
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 <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<long long> svi;
do {
int val = 0;
int in = 0;
int curs = 0;
for (auto a : vpii) {
val *= 2;
if ((ht[a.first] > ht[a.second])) {
curs++;
val++;
}
}
auto it = svi.insert(val);
if (it.second) {
sumc += curs;
sumc %= mod;
}
} while (next_permutation(ht.begin(), ht.end()));
cout << sumc << "\n";
}
Compilation message (stderr)
# | 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... |