#include #include #include #include #define int long long using namespace std; int dlugi[2][102][102]; int pot2=1, pot21=0, pot3=1, pot31=0; bool check(int co, int mod, int dzien) { vector > harvest; int zostalo = 10000; set > > s; for (int j=1; j<=100; j++) { for (int pos=1; pos<=j; pos++) { s.insert(make_pair(dlugi[mod][j][pos], make_pair(4*j, pos))); s.insert(make_pair(dlugi[mod][j][pos], make_pair(4*j+2, pos))); } } while (zostalo > 0) { while (co < (*s.rbegin()).first) { s.erase(s.find(*s.rbegin())); } if ((*s.rbegin()).first == 0) { break; } co -= (*s.rbegin()).first; harvest.push_back((*s.rbegin()).second); s.erase(s.find(*s.rbegin())); zostalo--; if (co <= zostalo) { if (harvest.size() + co > 10000) { cout << "Kuuuuurwa\n" << (1/0) << "\n"; } cout << harvest.size() + co << " " << dzien << "\n"; for (int i = 0; i < harvest.size(); i++) { cout << harvest[i].first << " " << harvest[i].second << "\n"; } for (int i = 1; i <= co; i++) { cout << -2 * i << " 0\n"; } return true; } } return false; } void fun() { int szuk; cin >> szuk; if (szuk == 0) { cout << "0 0\n"; return; } pot2=1; pot21=0; pot3=1; pot31=0; for (int j=1; j<=100; j++) { for (int pos=1; pos<=j; pos++) { dlugi[0][j][pos] = 0; dlugi[1][j][pos] = 0; } } for (int i = 1; i <= 100; i++) { dlugi[0][i][1] = 1; } for (int i = 1; i <= 41; i++) { for (int j=1; j<=100; j++) { for (int pos=1; pos<=j; pos++) { int m1 = (i+1)%2; dlugi[i%2][j][pos] = dlugi[m1][j][pos] + dlugi[m1][j][pos - 1] + dlugi[m1][j][pos+1]; } } if (check(szuk, i%2, i)) return; } cout << "Kuuuuurwa\n" << (1/0) << "\n"; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); vector, int> > cut; for (int j=1; j<=100; j++) { cut.push_back(make_pair(make_pair(4*j, 1), 1)); cut.push_back(make_pair(make_pair(4*j+2, 1), 1)); for (int pos=2; pos<=j; pos++) { cut.push_back(make_pair(make_pair(4*j, pos), 0)); cut.push_back(make_pair(make_pair(4*j+2, pos), 0)); } } for (int i = 1; i <= 1000; i++) { cut.push_back(make_pair(make_pair(-2 * i, 0), 1)); } cout << cut.size() << "\n"; for (int i = 0; i < cut.size(); i++) { cout << cut[i].first.first << " " << cut[i].first.second << " " << cut[i].second << "\n"; } fun(); }