Skip to content

Commit

Permalink
Create 1616A-IntegerDiversity.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
DionysiosB committed Jan 16, 2022
1 parent 18cee34 commit 459fe6c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 1616A-IntegerDiversity.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <cstdio>
#include <set>

int main(){

long t; scanf("%ld", &t);
while(t--){
long n; scanf("%ld", &n);
std::set<long> s;
for(long p = 0; p < n; p++){
long x; scanf("%ld", &x);
if(s.count(x)){s.insert(-x);}
else{s.insert(x);}
}

printf("%ld\n", s.size());
}

}

0 comments on commit 459fe6c

Please sign in to comment.