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;
  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] = 1;
  19. ++putere;
  20. cif += putere;
  21. r = cif;
  22. }
  23. for (int i = 1; i <= n; ++i) {
  24. cout << a[v[i]] << ' ';
  25. }
  26. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty