#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int maxN = 300;
int maxK = 10;
int main(int argc, char *argv[]){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
ll inf = -1000000000000;
vector<ll> t;
ll x;
for(int i = 0 ; i <n ;i++){
cin >> x;
t.push_back(x);
}
bool ok = true;
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
if(t[j]+t[i-j-1]<t[i])
ok=false;
}
}
if(ok){
cout << "TAK\n";
}
else{
cout << "NIE\n";
return 0;
}
vector<ll> ans;
ll sum = 0;
cout << n*n << "\n";
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
cout << ans[j] << " ";
}
cout << t[i]-sum << " ";
ans.push_back(t[i]-sum);
sum=t[i];
for(int j = i+1; j < n; j++)
cout << inf << " ";
}
cout << "\n";
}
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 | #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<vector<int> > vvi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int maxN = 300; int maxK = 10; int main(int argc, char *argv[]){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; ll inf = -1000000000000; vector<ll> t; ll x; for(int i = 0 ; i <n ;i++){ cin >> x; t.push_back(x); } bool ok = true; for(int i = 0; i < n; i++){ for(int j = 0; j < i; j++){ if(t[j]+t[i-j-1]<t[i]) ok=false; } } if(ok){ cout << "TAK\n"; } else{ cout << "NIE\n"; return 0; } vector<ll> ans; ll sum = 0; cout << n*n << "\n"; for(int i = 0; i < n; i++){ for(int j = 0; j < i; j++){ cout << ans[j] << " "; } cout << t[i]-sum << " "; ans.push_back(t[i]-sum); sum=t[i]; for(int j = i+1; j < n; j++) cout << inf << " "; } cout << "\n"; } |
English