Advertisement
Saleh127

CF gym100735D

Oct 30th, 2020
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. map<ll,ll>x;
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11. ll a[10000],c,d,e,i,j,k,l;
  12. cin>>c;
  13. for(i=0;i<c;i++)
  14. {
  15. cin>>a[i];
  16. }
  17. sort(a,a+c);
  18. l=0;
  19. for(i=0;i<c-2;i++)
  20. {
  21. for(j=i+1;j<c-1;j++)
  22. {
  23. for(k=j+1;k<c;k++)
  24. {
  25. if(a[i]+a[j]>a[k])
  26. {
  27. if(x[i]==0 && x[j]==0 && x[k]==0)
  28. {
  29. l++;
  30. x[i]=1;
  31. x[j]=1;
  32. x[k]=1;
  33. }
  34.  
  35. }
  36. }
  37. }
  38. }
  39.  
  40. cout<<l<<endl;
  41. return 0;
  42. }
Advertisement
RAW Paste Data Copied
Advertisement