# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
861009 | rati | Poklon (COCI17_poklon) | C++14 | 5087 ms | 4716 KiB |
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 <iostream>
#include <vector>
#include <unordered_map>
#include <set>
using namespace std;
int main() {
int N, Q;
cin >> N >> Q;
vector<int> array(N);
for (int i = 0; i < N; i++) {
cin >> array[i];
}
unordered_map<int, int> count;
for (int num : array) {
count[num]++;
}
for (int q = 0; q < Q; q++) {
int L, R;
cin >> L >> R;
set<int> unique_twice;
for (int i = L - 1; i < R; i++) {
if (count[array[i]] == 2) {
unique_twice.insert(array[i]);
}
}
cout << unique_twice.size() << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |