Submission #558096

# Submission time Handle Problem Language Result Execution time Memory
558096 2022-05-06T20:01:04 Z status_coding Diversity (CEOI21_diversity) C++14
0 / 100
1 ms 304 KB
#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 time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -