# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1054019 | 2024-08-12T04:44:30 Z | sleepntsheep | Diversity (CEOI21_diversity) | C++17 | 1 ms | 2396 KB |
#include <cstdio> #include <algorithm> #define N 300001 #define A 300001 int n, q, a[N], fr[N], fr2[N]; long long z, y; int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; ++i) scanf("%d", a + i), ++fr[a[i]]; for (int i = 1; i <= 300000; ++i) ++fr2[fr[i]]; for (int o = 1, j = 0, i = 1; i <= n; ++i) { for (; fr2[i]--; ++j) for (int xx = i; xx--;) a[o++] = j; } for (int c = 1, f = 0, i = n; i >= 1; --i) { z += (n - i + 1) * c - y; if (a[i] != a[i - 1]) { y += c; ++c; } else { y += c - 1; } } printf("%lld", z); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 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 | - |