This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n, q; cin >> n >> q;
vector<int> a(n);
for (int i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
int ans = 0;
while(q--){
int l, r; cin >> l >> r;
l--; r--;
for (int i = 0; i < n; i++){
set<int> val;
for (int j = i; j < n; j++){
val.insert(a[j]);
ans += val.size();
}
}
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |