fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int count=0;
  7. vector<int>v={1,2,3};
  8. make_heap(v.begin(),v.end());
  9. //for(int i=0;i<v.size();i++){
  10. // cout<<v[i]<<" ";
  11. //}
  12. do{
  13. if(is_heap(v.begin(),v.end())){
  14. count=count+1;
  15.  
  16. }
  17.  
  18. }while (next_permutation(v.begin()+1,v.end()));
  19.  
  20.  
  21. cout<<count;
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
1