I tried submitting my code on cses but every-time the time limit exceeds for last test. I tried using scanf
and printf
instead but of no use plz help me ..
It basically counts the number of distinct numbers in an array. here is the task
Here is my code
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
unordered_set<ll> a;
for(ll i=0; i\<n; i++) {
ll num;
cin >> num;
a.insert(num);
}
cout << a.size() << "\n";
return 0;
}