Submission #558096

#TimeUsernameProblemLanguageResultExecution timeMemory
558096status_codingDiversity (CEOI21_diversity)C++14
0 / 100
1 ms304 KiB
#include <bits/stdc++.h> using namespace std; long long n,q; long long nr, ans; long long a[300005]; long long fr[300005]; bool comp(int a, int b) { return fr[a] > fr[b]; } int main() { cin>>n>>q; for(int i=1;i<=n;i++) { cin>>a[i]; fr[ a[i] ] ++; } int l, r; cin>>l>>r; sort(a+1, a+n+1, comp); for(int i=1;i<=n;i++) { int nr=1; for(int j=i;j<=n;j++) { if(i != j && a[j] != a[j-1]) nr++; ans += nr; } } cout<<ans; return 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...
#Verdict Execution timeMemoryGrader output
Fetching results...