#include #include #include using namespace std; using namespace atcoder; using ll = long long; using ull = unsigned long long; using ld = long double; using P = pair; using tp = tuple; template using vec = vector; template using vvec = vector>; #define all(hoge) (hoge).begin(), (hoge).end() #define en '\n' #define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i) #define rep2(i, m, n) for(ll i = (ll)(n)-1; i >= (ll)(m); --i) #define REP(i, n) rep(i, 0, n) #define REP2(i, n) rep2(i, 0, n) constexpr long long INF = 1LL << 60; constexpr int INF_INT = 1 << 25; // constexpr long long MOD = (ll)1e9 + 7; constexpr long long MOD = 998244353LL; static const ld pi = 3.141592653589793L; template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } constexpr double TL = 1.5; struct Timer { chrono::system_clock::time_point start, last_updated; Timer() { start = chrono::system_clock::now(); last_updated = chrono::system_clock::now(); } void reset() { start = chrono::system_clock::now(); } void update() { last_updated = chrono::system_clock::now(); } double getTime() { auto now = chrono::system_clock::now(); return chrono::duration(now - start).count(); } double should_finish_search1() { return getTime() > TL; } bool should_reset() { auto now = chrono::system_clock::now(); return chrono::duration(now - last_updated).count() > 1.0 || chrono::duration(now - start).count() > TL; } }; Timer timer; struct Xor128 { unsigned x, y, z, w; Xor128() : x(123456789), y(362436069), z(521288629), w(88675123){}; inline unsigned xor128() { unsigned t; t = x ^ (x << 11); x = y; y = z; z = w; return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); } int nextInt(int x, int y) { return xor128() % (y - x) + x; } double nextDouble(double a, double b) { return (double)(xor128() & 0xffff) / 0xffff * (b - a) + a; } }; auto rnd = Xor128(); void solve() { const ll n = 50; ll _n; cin >> _n; using mint = modint; modint::set_mod(100000000); vvec a(n); REP(i, n) { a[i] = vector(i + 1, mint(0)); REP(j, i + 1) { ll aa; cin >> aa; a[i][j] = aa; } } const ll m = 1275; // 各ますの影響度が入る array, n> d; REP(s, n) { vvec dd(n); dd[n - 1].resize(n, 0); dd[n - 1][s] = 1; REP2(i, n - 1) { dd[i].resize(i + 1, 0); REP(j, i + 1) { dd[i][j] = dd[i + 1][j] + dd[i + 1][j + 1]; } } int t = 0; REP2(i, n) { REP(j, i + 1) { d[s][t] = dd[i][j].val(); t++; } } } vvec b(n); b[n - 1] = a[n - 1]; REP2(i, n - 1) { b[i].resize(i + 1, 0); REP(j, i + 1) { b[i][j] = b[i + 1][j] + b[i + 1][j + 1]; } } array aa; { int t = 0; REP2(i, n) { REP(j, i + 1) { aa[t++] = a[i][j].val(); } } } array bb; { int t = 0; REP2(i, n) { REP(j, i + 1) { bb[t++] = b[i][j].val(); } } } REP(_, 200000) { int s = rnd.nextInt(0, n); int t = rnd.nextInt(0, 1e8); ll ma = -1; ll nma = -1; REP(i, m) { ll diff = min(mint(bb[i] - aa[i]).val(), mint(aa[i] - bb[i]).val()); chmax(ma, diff); bb[i] = (bb[i] + mint(d[s][i]) * t).val(); ll ndiff = min(mint(bb[i] - aa[i]).val(), mint(aa[i] - bb[i]).val()); chmax(nma, ndiff); } if(nma < ma) continue; // rollback REP(i, m) { bb[i] = (bb[i] - mint(d[s][i]) * t).val(); } } REP(i, n) { cout << bb[i] << " "; } cout << en; #if !defined(ONLINE_JUDGE) // ローカル用出力 // ll x = 0; // REP(t, m) { // ll diff = min((bb[i] - aa[i]).val(), (a[i][j] - b[i][j]).val()); // chmax(x, diff); // } // ll score = 5e7 - x; // cerr << score << en; #endif } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); // cout << fixed << setprecision(10); // ll t; // cin >> t; // REP(i, t - 1) { // solve(); // } solve(); return 0; }