Submission #1062562

#TimeUsernameProblemLanguageResultExecution timeMemory
1062562kunzaZa183Amusement Park (CEOI19_amusementpark)C++17
19 / 100
95 ms10836 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<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)

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:21:9: warning: unused variable 'in' [-Wunused-variable]
   21 |     int in = 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...