fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. long long int n, maxi, v[65535], a[1000000], cif = 1, putere = 1, r = 1, check;
  6.  
  7. int main()
  8. {
  9. cin >> n;
  10. for (int i = 1; i <= n; ++i) {
  11. cin >> v[i];
  12. if (v[i] > maxi)
  13. maxi = v[i];
  14. }
  15. a[1] = 1;
  16. while (cif < maxi) {
  17. ++r;
  18. a[r] = cif + 1;
  19. ++putere;
  20. cif += putere;
  21. }
  22. for (int i = 1; i <= n; ++i) {
  23. check = 0;
  24. if (v[i] > a[r]) {
  25. cout << 0 << ' ';
  26. check = 1;
  27. }
  28. for (int j = 1; j <= r; ++j)
  29. {
  30. if (check == 1)
  31. break;
  32. if (a[j] == v[i]) {
  33. cout << 1 << ' ';
  34. break;
  35. }
  36. if (a[j] > v[i]) {
  37. cout << 0 << ' ';
  38. break;
  39. }
  40. }
  41. }
  42. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty