willy108

Chinese Samples

Jul 25th, 2024
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1.  
  2. //misaka and elaina will carry me to master
  3. #include <iostream>
  4. #include <cstdio>
  5. #include <cstring>
  6. #include <cmath>
  7. #include <utility>
  8. #include <cassert>
  9. #include <algorithm>
  10. #include <vector>
  11. #include <functional>
  12. #include <numeric>
  13. #include <set>
  14. #include <array>
  15. #include <queue>
  16. #include <map>
  17. #include <chrono>
  18. #include <random>
  19.  
  20. #define ll long long
  21. #define lb long double
  22. #define sz(vec) ((int)(vec.size()))
  23. #define all(x) x.begin(), x.end()
  24. #define pb push_back
  25. #define mp make_pair
  26. #define kill(x, s) {int COND = x; if(COND){ cout << s << "\n"; return ; }}
  27.  
  28. #ifdef ONLINE_JUDGE
  29. #define cerr while(0) cerr
  30. #endif
  31.  
  32. const lb eps = 1e-9;
  33. const ll mod = 1e9 + 7, ll_max = 1e18;
  34. //const ll mod = (1 << (23)) * 119 +1, ll_max = 1e18;
  35. const int MX = 2e5 +10, int_max = 0x3f3f3f3f;
  36.  
  37. struct {
  38.   template<class T>
  39.   operator T() {
  40.     T x; std::cin >> x; return x;
  41.   }
  42. } in;
  43.  
  44. using namespace std;
  45.  
  46. void solve(){
  47.     int n = in, m = in;
  48.     int ans = 1;
  49.     for(int i = 0; i<m; i++){
  50.         int l = in, r = in;
  51.         if((r - l + 1)%2 == 1){
  52.             cout << "N\n";
  53.             ans = 0;
  54.             return ;
  55.         }
  56.     }
  57.     if(ans){
  58.         cout << "Y\n";
  59.         for(int i = 0; i<n; i++){
  60.             if(i%2 == 0){
  61.                 cout << "M";
  62.             }else{
  63.                 cout << "T";
  64.             }          
  65.         }          
  66.         cout << "\n";
  67.     }
  68. }
  69.  
  70. signed main(){
  71.   cin.tie(0) -> sync_with_stdio(0);
  72.  
  73.   int T = 1;
  74.     cin >> T;
  75.   for(int i = 1; i<=T; i++){
  76.         solve();
  77.     }
  78.   return 0;
  79. }
  80.  
  81.  
  82.  
  83.  
Advertisement
Add Comment
Please, Sign In to add comment