fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n, a[100005], b[1000006];
  6.  
  7. int main(){
  8. cin >> n;
  9. for(int i = 1; i <= n; i++){
  10. cin >> a[i];
  11. }
  12. for(int i = 1; i <= n; i++){
  13. int j = a[i] + 100000;
  14. b[j]++;
  15. }
  16. for(int i = 1; i <= n; i++){
  17. cout << a[i] << ' ' << b[a[i] + 100000] << '\n';
  18. }
  19. }
  20.  
  21.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty