Tainel

src/main.cpp

May 15th, 2023 (edited)
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | Source Code | 0 0
  1. // Base headers.
  2. #include"base/index.hpp"
  3.  
  4. // Topic-specific headers.
  5. #include"topics/index.hpp"
  6.  
  7. // Run the solution to the problem.
  8. void solve(){}
  9.  
  10. #ifndef LOCAL
  11. // Optional online input and output filenames respectively.
  12. constexpr char const*infile=nullptr;
  13. constexpr char const*outfile=nullptr;
  14. #endif
  15.  
  16. // Run the program.
  17. int main(){
  18.     // Desynchronize the standard C and C++ streams.
  19.     ios::sync_with_stdio(false);
  20.     // Configure the standard character input stream.
  21.     cin.tie(nullptr);
  22.     // Configure the standard character output stream.
  23.     cout<<fixed<<setprecision(numeric_limits<f80>::max_digits10);
  24. #ifdef LOCAL
  25.     // Configure the standard character error stream locally.
  26.     cerr<<fixed<<setprecision(numeric_limits<f80>::max_digits10);
  27.     // Run the solution to the problem at least once locally.
  28.     LOG(YELLOW,BOLD,"Start");
  29.     do{
  30.         solve();
  31.         LOG(GREEN,BOLD,"Accepted");
  32.         cin>>ws;
  33.     }while(cin.good());
  34.     LOG(YELLOW,BOLD,"Finish");
  35. #else
  36.     // Maybe redirect the input online.
  37.     if constexpr(infile){
  38.         static ifstream const in(infile);
  39.         cin.rdbuf(in.rdbuf());
  40.     }
  41.     // Maybe redirect the output online.
  42.     if constexpr(outfile){
  43.         static ofstream const out(outfile);
  44.         cout.rdbuf(out.rdbuf());
  45.     }
  46.     // Run the solution to the problem once online.
  47.     solve();
  48. #endif
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment