Submission #881881

#TimeUsernameProblemLanguageResultExecution timeMemory
881881TAhmed33Diversity (CEOI21_diversity)C++98
0 / 100
1 ms504 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 3e5 + 25; int n, a[MAXN], q; int main () { cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; while (q--) { int l, r; cin >> l >> r; sort(a + 1, a + n + 1); ll sum = 0; for (int i = 1; i <= n; i++) { set <int> dd; for (int j = i; j <= n; j++) { dd.insert(a[j]); sum += dd.size(); } } cout << sum << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...