Guest User

Untitled

a guest
Jan 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. typedef long double LD;
  5. #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  6. #define sortAndUnique(a) sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
  7.  
  8. double tick() {
  9. static clock_t oldticks;
  10. clock_t newticks = clock();
  11. double diff = 1.0 * (newticks - oldticks) / CLOCKS_PER_SEC;
  12. oldticks = newticks;
  13. return diff;
  14. }
  15.  
  16. #define DEBUG
  17.  
  18. #ifdef DEBUG
  19.  
  20. #define debug(args...) (Debugger()) , args
  21.  
  22. class Debugger
  23. {
  24. public:
  25. Debugger(const std::string& _separator = " - ") :
  26. first(true), separator(_separator){}
  27.  
  28. template<typename ObjectType> Debugger& operator , (const ObjectType& v)
  29. {
  30. if(!first)
  31. std:cerr << separator;
  32. std::cerr << v;
  33. first = false;
  34. return *this;
  35. }
  36. ~Debugger() { std:cerr << endl;}
  37.  
  38. private:
  39. bool first;
  40. std::string separator;
  41. };
  42.  
  43. #else
  44. #define debug(args...) // Just strip off all debug tokens
  45. #endif
  46.  
  47. int main(void) {
  48.  
  49. cerr << tick(); //Prints execution time on error screen
  50. }
Add Comment
Please, Sign In to add comment