fork download
  1. //#pragma GCC optimize("Ofast,no-stack-protector")
  2. //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
  3. //#pragma GCC target("avx,tune=native")
  4. // Anand Jaisingh
  5.  
  6. #include<bits/stdc++.h>
  7.  
  8. using namespace std;
  9.  
  10. typedef complex<double> base;
  11. typedef long double ld;
  12. typedef long long ll;
  13.  
  14. #define pb push_back
  15. #define pii pair<int,int>
  16. #define pll pair< ll , ll >
  17. #define vi vector<int>
  18. #define vvi vector< vi >
  19.  
  20. const int maxn=(int)(1605);
  21. const ll mod=(ll)(1e9+7);
  22. int a[maxn];
  23. ll answer[3][maxn];
  24.  
  25. void build()
  26. {
  27. ll now;int curr=0,z=0,add=0;
  28.  
  29. while(curr<maxn)
  30. {
  31. if(z%3==0)
  32. {
  33. now=(1ll<<add);
  34.  
  35. for(int j=curr;j<min(maxn,curr+2);j++)
  36. {
  37. answer[0][j]=now;
  38. }
  39.  
  40. z=(z+1)%3;curr+=2;
  41. }
  42.  
  43. else if(z%3==1)
  44. {
  45. for(int j=curr;j<min(curr+8,maxn);j++)
  46. {
  47. answer[1][j]=now;
  48. }
  49.  
  50. z=(z+1)%3;curr+=8;
  51. }
  52.  
  53. else
  54. {
  55. for(int j=curr;j<min(maxn,curr+16);j++)
  56. {
  57. answer[2][j]=now;
  58. }
  59.  
  60. z=(z+1)%3;curr+=16;
  61.  
  62. add++;
  63. }
  64. }
  65. }
  66.  
  67. int main()
  68. {
  69. ios_base::sync_with_stdio(0);cin.tie(0);
  70.  
  71. build();int t;cin>>t;
  72.  
  73. while(t>0)
  74. {
  75. int n;cin>>n;
  76.  
  77. cout<<answer[0][n-1]<<" "<<answer[1][n-1]<<" "<<answer[2][n-1]<<endl;
  78.  
  79. t--;
  80. }
  81.  
  82.  
  83. return 0;
  84. }
  85.  
Runtime error #stdin #stdout 0s 15280KB
stdin
Standard input is empty
stdout
Standard output is empty