Submission #1090808

# Submission time Handle Problem Language Result Execution time Memory
1090808 2024-09-18T19:26:22 Z farica Diversity (CEOI21_diversity) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MAX_N = 3e5;

int b[MAX_N + 5];

void solve() {
    int n, q;
    cin >> n >> q;
    set<int>s;
    for(int i=0; i<n; ++i) {
        int x;
        cin >> x;
        ++b[x];
        s.insert(x);
    }
    int L, R;
    cin >> L >> R;
    ll ans = 0, cnt = 0, cnt2 = 0;
    for(auto it = s.begin(); it != s.end(); ++it) {
        int cur = *it;
        cnt2 += b[cur];
        cnt += cnt2;
        ans += cnt * b[cur];
    }
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int t = 1;
    while(t--) solve();

    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -