Submission #1034222

#TimeUsernameProblemLanguageResultExecution timeMemory
1034222vjudge1Diversity (CEOI21_diversity)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define int long long map<int, int> val; bool cmp(int a, int b){ return val[a] < val[b]; } signed main() { int n, q; cin >> n >> q; vector<int> a(n); for (int i = 0; i < n; i++){ cin >> a[i]; val[a[i]]++; } sort(a.begin(), a.end(), cmp); int ans = 0; while(q--){ int l, r; cin >> l >> r; l--; r--; for (int i = 0; i < n; i++){ set<int> v; for (int j = i; j < n; j++){ v.insert(a[j]); ans += v.size(); } } } cout << ans << endl; }
#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...