Cod sursa(job #3283698)
| Utilizator | Data | 10 martie 2025 11:47:54 | |
|---|---|---|---|
| Problema | Distincte | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("distincte.in");
ofstream fout("distincte.out");
int n, a[100002], k, m;
bitset<100002> ap;
int main()
{
int i, j , ras;
fin >> n >> k >> m;
for(i = 1; i <= n; i++)
fin >> a[i];
while(m--)
{
fin >> i >> j;
ap.reset();
ras = 0;
while(i <= j)
{
if(ap[a[i]] == 0)
{
ras += a[i];
ap[a[i]] = 1;
}
i++;
}
fout << ras << "\n";
}
return 0;
}
