Submission #475151

#TimeUsernameProblemLanguageResultExecution timeMemory
475151Ahmed57Po (COCI21_po)C++14
10 / 70
1092 ms1868 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long n,ans = 0; cin>>n; vector<long long>arr(n),att(n); for(int i=0;i<n;i++){ cin>>arr[i]; att[i] = arr[i]; } sort(att.begin(),att.end()); for(int k = 0;k<n;k++){ if(k>0&&att[k]==att[k-1])continue; long long m = att[k]; bool ss = false; for(int i=0;i<n;i++){ if(arr[i]==m&&!ss){ ss = true; ans++; }else if(arr[i]<m)ss = false; } } cout<<ans<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...