SHARE
TWEET

Untitled

a guest Jul 19th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string>
  3. #include <vector>
  4. #include <iostream>
  5. #include <fstream>
  6. #include <algorithm>
  7. #include <set>
  8. #include <map>
  9. #include <list>
  10. #include <deque>
  11. #include <memory>
  12. #include <utility>
  13. #include <queue>
  14. #include <math.h>
  15.  
  16. using namespace std;
  17.  
  18. int mex(vector<int>& a) {
  19.     vector<int> v(a.size() + 1, 0);
  20.     for (auto f : a)
  21.         if (f <= a.size())
  22.             v[f]++;
  23.     for (int i = 0; i < v.size(); i++) {
  24.         if (v[i] == 0)
  25.             return i;
  26.     }
  27. }
  28.  
  29. vector<int> ans(5002, -1);
  30.  
  31. int grande(int x) {
  32.     if (ans[x] != -1)
  33.         return ans[x];
  34.     if (x == 1)
  35.         return 0;
  36.     vector<int> vvv;
  37.     for (int i = 1; i <= x / 2; i++) {
  38.         vvv.push_back(grande(x - i));
  39.     }
  40.     ans[x] = mex(vvv);
  41.     return ans[x];
  42. }
  43.  
  44. int main() {
  45.     ios_base::sync_with_stdio(0);
  46.     cin.tie(0);
  47.     int a, b, c;
  48.     cin >> a >> b >> c;
  49.     int z = grande(a) ^ grande(b) ^ grande(c);
  50.     ans[1] = 0;
  51.     if (z == 0) {
  52.         cout << "NO";
  53.     }
  54.     else{
  55.         cout << "YES\n";
  56.  
  57.         for (int i = 1; i <= a / 2; i++) {
  58.             if (ans[a - i] == 0)
  59.                 cout << a - i << ' ' << b << ' ' << c << '\n';
  60.         }
  61.  
  62.         for (int i = 1; i <= b / 2; i++) {
  63.             if (ans[b - i] == 0)
  64.                 cout << a << ' ' << b - i << ' ' << c << '\n';
  65.         }
  66.  
  67.         for (int i = 1; i <= c / 2; i++) {
  68.             if (ans[c - i] == 0)
  69.                 cout << a << ' ' << b << ' ' << c - i << '\n';
  70.         }
  71.  
  72.     }
  73.  
  74.     return 0;
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top