Submission #557874

#TimeUsernameProblemLanguageResultExecution timeMemory
557874FatihSolakW (RMI18_w)C++17
10 / 100
1099 ms2512 KiB
#include <bits/stdc++.h> #define N 200005 using namespace std; void solve(){ int n; cin >> n; vector<int> v; for(int i = 0;i<n;i++){ int x; cin >> x; v.push_back(x); } sort(v.begin(),v.end()); int ans = 0; do{ int cnt = 0; int last = -1; for(int i = 1;i<n;i++){ if(v[i] == v[i-1])continue; int now = (v[i] > v[i-1]); if(now != last){ if(last == -1 && now == 1){ break; } cnt++; last = now; } } if(cnt == 4){ ans++; } //if(cnt == 4){ // for(auto u:v){ // cout << u << " "; // } // cout << endl; //} }while(next_permutation(v.begin(),v.end())); cout << ans << endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); #ifdef Local freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif int t = 1; //cin >> t; while(t--){ solve(); } #ifdef Local cout << endl << fixed << setprecision(2) << 1000.0*clock()/CLOCKS_PER_SEC << " milliseconds."; #endif }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...