#include <bits/stdc++.h>
using i64 = long long;
struct Query {
int l;
int r;
};
int main() {
int N, Q;
std::cin >> N >> Q;
std::vector<int> A(N);
for (auto &e : A) {
std::cin >> e;
}
std::vector<Query> queries(Q);
for (auto &[l, r] : queries) {
std::cin >> l >> r;
--l;
}
assert(Q == 1 and queries[0].l == 0 and queries[0].r == N);
std::sort(A.begin(), A.end());
i64 ans = 0;
for (int i = 0; i < N; ++i) {
for (int j = 1; j <= N; ++j) {
std::set<int> s;
for (int k = i; k < j; ++k) {
s.insert(A[k]);
}
ans += (int)s.size();
}
}
std::cout << ans << std::endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Incorrect |
1 ms |
288 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Incorrect |
1 ms |
288 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Incorrect |
1 ms |
288 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |