#include <bits/stdc++.h> #define thicc(boi) boi.size() #define magiczne ios_base::sync_with_stdio(0); #define linijki cin.tie(NULL); using namespace std; int xd[307]; int main() { magiczne linijki; int n; cin >> n; for (int i = 1;i<=n;i++) cin >> xd[i]; for (int i = 1;i<=n;i++) for (int j = i;j<=n;j++) if (i + j <= n and xd[i] + xd[j] < xd[i + j]) { cout << "NIE\n"; return 0; } cout << "TAK\n" << n << '\n'; cout << xd[1] << ' '; for (int i = 2;i<=n;i++) cout << xd[i] - xd[i - 1] << ' '; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <bits/stdc++.h> #define thicc(boi) boi.size() #define magiczne ios_base::sync_with_stdio(0); #define linijki cin.tie(NULL); using namespace std; int xd[307]; int main() { magiczne linijki; int n; cin >> n; for (int i = 1;i<=n;i++) cin >> xd[i]; for (int i = 1;i<=n;i++) for (int j = i;j<=n;j++) if (i + j <= n and xd[i] + xd[j] < xd[i + j]) { cout << "NIE\n"; return 0; } cout << "TAK\n" << n << '\n'; cout << xd[1] << ' '; for (int i = 2;i<=n;i++) cout << xd[i] - xd[i - 1] << ' '; return 0; } |