fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define task "FB8B1SUS"
  5. #define fi first
  6. #define se second
  7. #define pii pair<ll,ll>
  8. #define pb push_back
  9. #define dou double
  10. #define el '\n'
  11. #define ull usigned long long
  12. const ll maxN = 1e6;
  13. const ll maxM = 1e3;
  14. const ll LIM = 1e9;
  15. const ll oo = 1e18;
  16. const ll mod = 1e9+7;
  17. const ll LOG = 23;
  18.  
  19. ll T;
  20. ll p[maxN+5], u[maxN+5], f[maxN+5];
  21.  
  22. vector<pii> res = {{1LL, 1}, {2LL, 2}, {4LL, 3}, {6LL, 4}, {12LL, 6}, {24LL, 8}, {36LL, 9}, {48LL, 10}, {60LL, 12}, {120LL, 16},
  23. {180LL, 18}, {240LL, 20}, {360LL, 24}, {720LL, 30}, {840LL, 32}, {1260LL, 36}, {1680LL, 40}, {2520LL, 48},
  24. {5040LL, 60}, {7560LL, 64}, {10080LL, 72}, {15120LL, 80}, {20160LL, 84}, {25200LL, 90}, {27720LL, 96},
  25. {45360LL, 100}, {50400LL, 108}, {55440LL, 120}, {83160LL, 128}, {110880LL, 144}, {166320LL, 160}, {221760LL, 168},
  26. {277200LL, 180}, {332640LL, 192}, {498960LL, 200}, {554400LL, 216}, {665280LL, 224}, {720720LL, 240}, {1081080LL, 256},
  27. {1441440LL, 288}, {2162160LL, 320}, {2882880LL, 336}, {3603600LL, 360}, {4324320LL, 384}, {6486480LL, 400},
  28. {7207200LL, 432}, {8648640LL, 448}, {10810800LL, 480}, {14414400LL, 504}, {17297280LL, 512}, {21621600LL, 576},
  29. {32432400LL, 600}, {36756720LL, 640}, {43243200LL, 672}, {61261200LL, 720}, {73513440LL, 768}, {110270160LL, 800},
  30. {122522400LL, 864}, {147026880LL, 896}, {183783600LL, 960}, {245044800LL, 1008}, {294053760LL, 1024}, {367567200LL, 1152},
  31. {551350800LL, 1200}, {698377680LL, 1280}, {735134400LL, 1344}, {1102701600LL, 1440}, {1396755360LL, 1536},
  32. {2095133040LL, 1600}, {2205403200LL, 1680}, {2327925600LL, 1728}, {2793510720LL, 1792}, {3491888400LL, 1920},
  33. {4655851200LL, 2016}, {5587021440LL, 2048}, {6983776800LL, 2304}, {10475665200LL, 2400}, {13967553600LL, 2688},
  34. {20951330400LL, 2880}, {27935107200LL, 3072}, {41902660800LL, 3360}, {48886437600LL, 3456}, {64250746560LL, 3584},
  35. {73329656400LL, 3600}, {80313433200LL, 3840}, {97772875200LL, 4032}, {128501493120LL, 4096}, {146659312800LL, 4320},
  36. {160626866400LL, 4608}, {240940299600LL, 4800}, {293318625600LL, 5040}, {321253732800LL, 5376}, {481880599200LL, 5760},
  37. {642507465600LL, 6144}, {963761198400LL, 6720}, {1124388064800LL, 6912}, {1606268664000LL, 7168}, {1686582097200LL, 7200},
  38. {1927522396800LL, 7680}, {2248776129600LL, 8064}, {3212537328000LL, 8192}, {3373164194400LL, 8640}, {4497552259200LL, 9216},
  39. {6746328388800LL, 10080}, {8995104518400LL, 10368}, {9316358251200LL, 10752}, {13492656777600LL, 11520},
  40. {18632716502400LL, 12288}, {26985313555200LL, 12960}, {27949074753600LL, 13440}, {32607253879200LL, 13824},
  41. {46581791256000LL, 14336}, {48910880818800LL, 14400}, {55898149507200LL, 15360}, {65214507758400LL, 16128},
  42. {93163582512000LL, 16384}, {97821761637600LL, 17280}, {130429015516800LL, 18432}, {195643523275200LL, 20160},
  43. {260858031033600LL, 20736}, {288807105787200LL, 21504}, {391287046550400LL, 23040}, {577614211574400LL, 24576},
  44. {782574093100800LL, 25920}, {866421317361600LL, 26880}, {1010824870255200LL, 27648}, {1444035528936000LL, 28672},
  45. {1516237305382800LL, 28800}, {1732842634723200LL, 30720}, {2021649740510400LL, 32256}, {2888071057872000LL, 32768},
  46. {3032474610765600LL, 34560}, {4043299481020800LL, 36864}, {6064949221531200LL, 40320}, {8086598962041600LL, 41472},
  47. {10108248702552000LL, 43008}, {12129898443062400LL, 46080}, {18194847664593600LL, 48384}, {20216497405104000LL, 49152},
  48. {24259796886124800LL, 51840}, {30324746107656000LL, 53760}, {36389695329187200LL, 55296}, {48519593772249600LL, 57600},
  49. {60649492215312000LL, 61440}, {72779390658374400LL, 62208}, {74801040398884800LL, 64512}, {106858629141264000LL, 65536},
  50. {112201560598327200LL, 69120}, {149602080797769600LL, 73728}, {224403121196654400LL, 80640}, {299204161595539200LL, 82944},
  51. {374005201994424000LL, 86016}, {448806242393308800LL, 92160}, {673209363589963200LL, 96768}, {748010403988848000LL, 98304},
  52. {897612484786617600LL, 103680}};
  53.  
  54.  
  55. void prepro()
  56. {
  57. for(ll i=1; i<=maxN; i++)
  58. {
  59. for(ll j=i; j<=maxN; j+=i)u[j]++;
  60. }
  61. for(ll i=1; i<=maxN; i++)
  62. {
  63. if(u[p[i-1]] < u[i]) p[i] = i;
  64. else p[i] = p[i-1];
  65. }
  66. while(T--)
  67. {
  68. ll n ; cin >> n;
  69. cout<<p[n]<<" "<<u[p[n]]<<el;
  70. }
  71. }
  72.  
  73.  
  74. void sub2()
  75. {
  76. while(T--)
  77. {
  78. ll n; cin >> n;
  79. ll num = -1, maxDiv = -1;
  80. for(ll i=0; i<156 && res[i].fi <= n; i++)
  81. {
  82. if(res[i].se > maxDiv)
  83. {
  84. num = res[i].fi;
  85. maxDiv = res[i].se;
  86. }
  87. }
  88. cout<<num<<" "<<maxDiv<<el;
  89. }
  90.  
  91. }
  92.  
  93. int main()
  94. {
  95. ios_base::sync_with_stdio(0); cin.tie(0);
  96. if(fopen(task".inp","r"))
  97. {
  98. freopen(task".inp","r",stdin);
  99. freopen(task".out","w",stdout);
  100. }
  101. cin >> T;
  102. sub2();
  103. return 0;
  104. }
  105.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty