# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920238 | 2024-02-02T10:22:51 Z | vjudge1 | Diversity (CEOI21_diversity) | C++17 | 1 ms | 600 KB |
#include <iostream> #include <vector> #include <algorithm> #include <cassert> #include <cstring> #include <set> #warning That's the baby, that's not my baby typedef long long ll; const int NMAX = 3e5; int a[NMAX + 1]; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); int n, q; std::cin >> n >> q; for (int i = 1; i <= n; i++) { std::cin >> a[i]; } while (q--) { int l, r; std::cin >> l >> r; std::vector<int> b; for (int i = l; i <= r; i++) { b.push_back(a[i]); } std::sort(b.begin(), b.end()); int m = (int) b.size(); ll answer = 0; for (int i = 0; i < m; i++) { std::set<int> st; for (int j = i; j < m; j++) { st.insert(b[j]); answer += (int) st.size(); } } std::cout << answer << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 600 KB | Output is correct |
3 | Incorrect | 0 ms | 344 KB | Output isn't correct |
4 | 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 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 600 KB | Output is correct |
3 | Incorrect | 0 ms | 344 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 600 KB | Output is correct |
3 | Incorrect | 0 ms | 344 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |