/*
what does odbyt mean?
who is paris platynov and why is he rhyming about stara and stary?
░░░░░░░░░░░░░▄▄▀▀▀▀▀▀▄▄
░░░░░░░░░░▄▄▀▄▄▄█████▄▄▀▄
░░░░░░░░▄█▀▒▀▀▀█████████▄█▄
░░░░░░▄██▒▒▒▒▒▒▒▒▀▒▀▒▀▄▒▀▒▀▄
░░░░▄██▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▄
░░░░██▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▌
░░░▐██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐█
░▄▄███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
▐▒▄▀██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐▌
▌▒▒▌▒▀▒▒▒▒▒▒▄▀▀▄▄▒▒▒▒▒▒▒▒▒▒▒▒█▌
▐▒▀▒▌▒▒▒▒▒▒▒▄▄▄▄▒▒▒▒▒▒▒▀▀▀▀▄▒▐
░█▒▒▌▒▒▒▒▒▒▒▒▀▀▒▀▒▒▐▒▄▀██▀▒▒▒▌
░░█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐▒▒▒▒▒▒▒▒█
░░░▀▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▌▒▒▒▒▒▒▄▀
░░░▐▒▒▒▒▒▒▒▒▒▄▀▐▒▒▒▒▒▐▒▒▒▒▄▀
░░▄▌▒▒▒▒▒▒▒▄▀▒▒▒▀▄▄▒▒▒▌▒▒▒▐▀▀▀▄▄▄
▄▀░▀▄▒▒▒▒▒▒▒▒▀▀▄▄▄▒▄▄▀▌▒▒▒▌░░░░░░
▐▌░░░▀▄▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▄▀░░░░░░░
░█░░░░░▀▄▄▒▒▒▒▒▒▒▒▒▒▒▒▄▀░█░░░░░▒▒
░░█░░░░░░░▀▄▄▄▒▒▒▒▒▒▄▀░░░░█░░░▒▒▒
░░░█░░░░░░░░░▌▀▀▀▀▀▀▐░░░░░▐▌░▒▒▒▒
░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒
░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒░
░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒░░
░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒░░░
░░░░░░░░░░░░░░░░░░░░░░░▄▄▒▒▒▒▒░░░
░░░░░░░░░░░░░░░▄▄▄████████▒▒░░░░░
░░░░▄▄▄▄▄▄█████▀▀▀▀▀░░░░░░░░░░░░░
░░░▀▀▀▀▀▀▀░░░░░░░░░░░░░░░░░░░░░░░
NIE BIERZ TEGO BLUNTA SYNU
1 MARIHUANA = 1 ZNISZCZONE ŻYCIE
Papież chroni papież radzi
Papież nigdy cię nie zdradzi
słuchaj Papieża, żyj zdrowo i miej Boga w sercu
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define satori int bepis;cin >> bepis;while(bepis--)
#define st first
#define nd second
#define mp make_pair
#define int long long
using namespace std;
int32_t main()
{
std::ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> d(n);
for(int i = 0;i<n;i++)cin >>d[i];
vector<int> v(n);
v[0] = d[0];
for(int i = 1;i<n;i++)v[i] = d[i] - d[i-1];
for(int i = 1;i<n+1;i++)
{
int x = 0;
for(int j = 0;j<i;j++)x+=v[j];
int j = i-1;
while(1)
{
if(x>d[i-1])
{
cout <<"NIE\n" ;
return 0;
}
if(j == n-1)break;
j++;
x+=v[j];
x-=v[j-i];
}
}
cout << "TAK\n" << n << '\n';
for(auto x:v)cout << x << ' ';
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | /* what does odbyt mean? who is paris platynov and why is he rhyming about stara and stary? ░░░░░░░░░░░░░▄▄▀▀▀▀▀▀▄▄ ░░░░░░░░░░▄▄▀▄▄▄█████▄▄▀▄ ░░░░░░░░▄█▀▒▀▀▀█████████▄█▄ ░░░░░░▄██▒▒▒▒▒▒▒▒▀▒▀▒▀▄▒▀▒▀▄ ░░░░▄██▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▄ ░░░░██▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▌ ░░░▐██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐█ ░▄▄███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█ ▐▒▄▀██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐▌ ▌▒▒▌▒▀▒▒▒▒▒▒▄▀▀▄▄▒▒▒▒▒▒▒▒▒▒▒▒█▌ ▐▒▀▒▌▒▒▒▒▒▒▒▄▄▄▄▒▒▒▒▒▒▒▀▀▀▀▄▒▐ ░█▒▒▌▒▒▒▒▒▒▒▒▀▀▒▀▒▒▐▒▄▀██▀▒▒▒▌ ░░█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐▒▒▒▒▒▒▒▒█ ░░░▀▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▌▒▒▒▒▒▒▄▀ ░░░▐▒▒▒▒▒▒▒▒▒▄▀▐▒▒▒▒▒▐▒▒▒▒▄▀ ░░▄▌▒▒▒▒▒▒▒▄▀▒▒▒▀▄▄▒▒▒▌▒▒▒▐▀▀▀▄▄▄ ▄▀░▀▄▒▒▒▒▒▒▒▒▀▀▄▄▄▒▄▄▀▌▒▒▒▌░░░░░░ ▐▌░░░▀▄▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▄▀░░░░░░░ ░█░░░░░▀▄▄▒▒▒▒▒▒▒▒▒▒▒▒▄▀░█░░░░░▒▒ ░░█░░░░░░░▀▄▄▄▒▒▒▒▒▒▄▀░░░░█░░░▒▒▒ ░░░█░░░░░░░░░▌▀▀▀▀▀▀▐░░░░░▐▌░▒▒▒▒ ░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒ ░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒░ ░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒░░ ░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒░░░ ░░░░░░░░░░░░░░░░░░░░░░░▄▄▒▒▒▒▒░░░ ░░░░░░░░░░░░░░░▄▄▄████████▒▒░░░░░ ░░░░▄▄▄▄▄▄█████▀▀▀▀▀░░░░░░░░░░░░░ ░░░▀▀▀▀▀▀▀░░░░░░░░░░░░░░░░░░░░░░░ NIE BIERZ TEGO BLUNTA SYNU 1 MARIHUANA = 1 ZNISZCZONE ŻYCIE Papież chroni papież radzi Papież nigdy cię nie zdradzi słuchaj Papieża, żyj zdrowo i miej Boga w sercu */ #pragma GCC optimize("Ofast") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define satori int bepis;cin >> bepis;while(bepis--) #define st first #define nd second #define mp make_pair #define int long long using namespace std; int32_t main() { std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> d(n); for(int i = 0;i<n;i++)cin >>d[i]; vector<int> v(n); v[0] = d[0]; for(int i = 1;i<n;i++)v[i] = d[i] - d[i-1]; for(int i = 1;i<n+1;i++) { int x = 0; for(int j = 0;j<i;j++)x+=v[j]; int j = i-1; while(1) { if(x>d[i-1]) { cout <<"NIE\n" ; return 0; } if(j == n-1)break; j++; x+=v[j]; x-=v[j-i]; } } cout << "TAK\n" << n << '\n'; for(auto x:v)cout << x << ' '; return 0 ; } |
English