# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1048147 | 2024-08-08T02:30:32 Z | 12345678 | Diversity (CEOI21_diversity) | C++17 | 1 ms | 2508 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const int nx=3e5+5; ll n, a[nx], v[nx], q, l, r, c, d, t, res; map<ll, ll> mp; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>q; for (int i=1; i<=n; i++) cin>>a[i], mp[a[i]]++; cin>>c>>d; l=1, r=mp.size(); for (auto [x, y]:mp) { t++; res+=y*(n-y)+y*(y+1)/2; if (t%2) v[l++]=y; else v[r--]=y; } for (int i=1; i<=mp.size(); i++) v[i]+=v[i-1]; for (int i=1; i<=mp.size(); i++) res+=v[i-1]*(n-v[i]); cout<<res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |