Submission #991024

#TimeUsernameProblemLanguageResultExecution timeMemory
991024PacybwoahFestivals in JOI Kingdom 2 (JOI23_festival2)C++17
5 / 100
9083 ms348 KiB
#include<iostream> #include<vector> #include<algorithm> using namespace std; typedef long long ll; int n; ll mod; int main(){ cin >> n >> mod; ll ans = 0; for(int i = 0; i < (1 << (2 * n)); i++){ vector<int> a, b; for(int j = 0; j < 2 * n; j++){ if(i & (1 << j)) a.push_back(j); else b.push_back(j); } if(a.size() != b.size()) continue; do{ vector<pair<int, int>> vec; bool flag = 1; for(int k = 0; k < n; k++){ if(a[k] > b[k]){ flag = 0; break; } vec.push_back(make_pair(a[k], b[k])); } if(!flag) continue; int gre = 0, opt = 0; int now = -1; for(auto &[l, r]: vec){ if(now < l){ gre++; now = r; } } now = -1; for(auto &[l, r]: vec){ if(now < l){ opt++; now = r; } else now = min(now, r); } if(gre != opt) ans++; //cout << gre << " " << opt << "\n"; }while(next_permutation(b.begin(), b.end())); } cout << ans % mod << "\n"; } // g++ -std=gnu++20 pB.cpp -o run -Wall -Wextra -fsanitize=undefined -fsanitize=address
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...