Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string>
- #include <vector>
- #include <iostream>
- #include <fstream>
- #include <algorithm>
- #include <set>
- #include <map>
- #include <list>
- #include <deque>
- #include <memory>
- #include <utility>
- #include <queue>
- #include <math.h>
- using namespace std;
- int mex(vector<int>& a) {
- vector<int> v(a.size() + 1, 0);
- for (auto f : a)
- if (f <= a.size())
- v[f]++;
- for (int i = 0; i < v.size(); i++) {
- if (v[i] == 0)
- return i;
- }
- }
- vector<int> ans(5002, -1);
- int grande(int x) {
- if (ans[x] != -1)
- return ans[x];
- if (x == 1)
- return 0;
- vector<int> vvv;
- for (int i = 1; i <= x / 2; i++) {
- vvv.push_back(grande(x - i));
- }
- ans[x] = mex(vvv);
- return ans[x];
- }
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int a, b, c;
- cin >> a >> b >> c;
- int z = grande(a) ^ grande(b) ^ grande(c);
- ans[1] = 0;
- if (z == 0) {
- cout << "NO";
- }
- else{
- cout << "YES\n";
- for (int i = 1; i <= a / 2; i++) {
- if (ans[a - i] == 0)
- cout << a - i << ' ' << b << ' ' << c << '\n';
- }
- for (int i = 1; i <= b / 2; i++) {
- if (ans[b - i] == 0)
- cout << a << ' ' << b - i << ' ' << c << '\n';
- }
- for (int i = 1; i <= c / 2; i++) {
- if (ans[c - i] == 0)
- cout << a << ' ' << b << ' ' << c - i << '\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement