Advertisement
Dang_Quan_10_Tin

PAINTING TS10 PTNK 2020-2021

Jan 5th, 2022
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #define task "PAINTING"
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. using ll = long long;
  9. using ld = long double;
  10.  
  11. constexpr int N = 1e5 + 5;
  12. int n, q;
  13.  
  14. void Read()
  15. {
  16.     cin >> n >> q;
  17. }
  18.  
  19. void Solve()
  20. {
  21.     while (q--)
  22.     {
  23.         int x, y;
  24.         cin >> x >> y;
  25.         if (x * 2 > n)
  26.             x = n - x + 1;
  27.         if (y * 2 > n)
  28.             y = n - y + 1;
  29.  
  30.         int ans = (y <= x) ? (y % 3) : (x % 3);
  31.  
  32.         if (ans == 1)
  33.             cout << "RED\n";
  34.         else if (ans == 2)
  35.             cout << "BLUE\n";
  36.         else
  37.             cout << "YELLOW\n";
  38.     }
  39. }
  40.  
  41. int32_t main()
  42. {
  43.     ios::sync_with_stdio(0);
  44.     cin.tie(0);
  45.     cout.tie(0);
  46.     if (fopen(task ".INP", "r"))
  47.     {
  48.         freopen(task ".INP", "r", stdin);
  49.         freopen(task ".OUT", "w", stdout);
  50.     }
  51.     Read();
  52.     Solve();
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement