# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018819 | biserailieva | Poklon (COCI17_poklon) | C++14 | 5088 ms | 4284 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 <bits/stdc++.h>
using namespace std;
int main()
{
int n, q;
cin>>n>>q;
int A[n];
for(int i=0;i<n;i++)
{
cin>>A[i];
}
for(int i=0;i<q;i++)
{
int l, r;
cin>>l>>r;
map<int, int>freq;
int cnt=0;
for(int i=l-1;i<=r-1;i++)
{
freq[A[i]]++;
}
for(int i=l-1;i<=r-1;i++)
{
if(freq[A[i]]==2)
{
cnt++;
freq[A[i]]=0;
}
}
cout<<cnt<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |