mr_dot_convict

temp.cpp

Oct 4th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.08 KB | None | 0 0
  1. // Hack it and have it ;) //
  2. /*author* Priyanshu Shrivastav (from IIT Palakkad) *
  3.  * *_ __ ___  _ ______ ___  _ ____   ___  ___| |_  *
  4.  * | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
  5.  * | | | | | | | | (_| (_) | | | \ V /| | (__| |_  *
  6.  * |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
  7. When I wrote this, only God and I understood what I was doing
  8.  ** * * * * * * * Now, only God knows!* * * * * * */
  9. /************************************************************************************/
  10. #include      <bits/stdc++.h>                                                       //
  11. #include      <ext/pb_ds/assoc_container.hpp>                                       //
  12. #include      <ext/pb_ds/tree_policy.hpp>                                           //
  13. using namespace std;                                                                //
  14. using namespace __gnu_pbds;                                                         //
  15.                                                                                     //
  16. #ifndef CONVICTION                                                                  //
  17. #pragma GCC       optimize ("Ofast")                                                //
  18. #pragma GCC       optimize ("unroll-loops")                                         //
  19. #pragma GCC       target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
  20. #endif                                                                              //
  21.                                                                                     //
  22. #define IOS       ios_base::sync_with_stdio(false); cin.tie (nullptr)               //
  23. #define PREC      cout.precision (10); cout << fixed                                //
  24. #define x         first                                                             //
  25. #define y         second                                                            //
  26. #define fr(i,x,y) for (int i = x; i <= y; ++i)                                      //
  27. #define fR(i,x,y) for (int i = x; i >= y; --i)                                      //
  28. #define bg(x)     " [ " << #x << " : " << (x) << " ] "                              //
  29. #define un(x)     sort(x.begin(), x.end()), \
  30.                   x.erase(unique(x.begin(), x.end()), x.end())                      //
  31. using   ll  =     long long;                                                        //
  32. using   ull =     unsigned long long;                                               //
  33. using   ff  =     long double;                                                      //
  34. using   pii =     pair<int,int>;                                                    //
  35. using   pil =     pair<int,ll>;                                                     //
  36. typedef tree                                                                        //
  37. < int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>        //
  38. ordered_set;                                                                        //
  39.                                                                                     //
  40. struct chash {                                                                      //
  41.    int operator () (pii x) const { return x.x*31 + x.y; }                           //
  42. };                                                                                  //
  43. gp_hash_table <pii, int, chash> mp;                                                 //
  44.                                                                                     //
  45. #if __cplusplus > 201103L                                                           //
  46. seed_seq seq{                                                                       //
  47.    (uint64_t) chrono::duration_cast<chrono::nanoseconds>                            //
  48.       (chrono::high_resolution_clock::now().time_since_epoch()).count(),            //
  49.       (uint64_t) __builtin_ia32_rdtsc(),                                            //
  50.       (uint64_t) (uintptr_t) make_unique<char>().get()                              //
  51. };                                                                                  //
  52. mt19937 rng(seq); /*uniform_int_distribution<int> (l, h)(rng); [low, high]*/        //
  53. #else                                                                               //
  54. auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();        //
  55. mt19937 rng(seed);                                                                  //
  56. #endif                                                                              //
  57.                                                                                     //
  58. #define debug(args...) { \
  59.    /* WARNING : do NOT compile this debug func calls with following flags:
  60.     *  -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2 */ \
  61.    string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');\
  62.    stringstream _ss(_s); \
  63.    istream_iterator<string> _it(_ss); err(_it, args); \
  64. }                                                                                   //
  65. void err(istream_iterator<string> it) {                                             //
  66.    it->empty(); cerr << " (Line : " << __LINE__ << ")" << '\n';                     //
  67. }                                                                                   //
  68. template<typename T, typename... Args>                                              //
  69. void err(istream_iterator<string> it, T a, Args... args) {                          //
  70.    cerr << fixed << setprecision(15)                                                //
  71.       << " [ " <<  *it << " : " << a  << " ] "<< ' ';                               //
  72.    err(++it, args...);                                                              //
  73. }                                                                                   //
  74. /************************************************************************************/
  75. /*   Don’t practice until you get it right. Practice until you can’t get it wrong   */
  76. /************************************************************************************/
  77.  
  78. signed main() {
  79.    IOS; PREC;
  80.  
  81.    return EXIT_SUCCESS;
  82. }
Add Comment
Please, Sign In to add comment