Submission #1062565

#TimeUsernameProblemLanguageResultExecution timeMemory
1062565kunzaZa183Amusement Park (CEOI19_amusementpark)C++17
42 / 100
3091 ms170868 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 { long long val = 0; int in = 0; int curs = 0; for (auto a : vpii) { val *= 2; if ((ht[a.first] > ht[a.second])) { curs++; curs %= mod; 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...