#pragma GCC optimize("Ofast") #include using namespace std; using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define rrep(i, s, t) for (ll i = ((t) - 1); i >= (ll)(s); i--) template bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; // randxor unsigned int randxor(){ static unsigned int x=123456789,y=362436069,z=521288629,w=88675123; unsigned int t=(x^(x<<11)); x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) ); } constexpr unsigned int INF = -1; // ms コピペ int timer(){ static auto st = chrono::system_clock::now(); auto en = chrono::system_clock::now(); return chrono::duration_cast(en - st).count(); } constexpr int N = 50; vector> a(N,vector(N,-1)); constexpr int MOD = 100000000; ll score(const vector &c){ vector> tmp(N,vector(N)); tmp[N-1]=c; for(int i=N-1;i>0;i--){ rep(j,0,i) tmp[i-1][j]=(tmp[i][j]+tmp[i][j+1])%MOD; } int mx=-1; int cnt=0; rep(i,0,N) rep(j,0,i+1){ int d=abs(tmp[i][j]-a[i][j]); chmin(d,MOD-d); if(mx>n; } rep(i,0,N){ rep(j,0,i+1) cin>>a[i][j]; } vector ans=a.back(); ll now_score=score(ans); rep(loop,0,100000){ vector tmp(N); rep(i,0,N) tmp[i]=randxor()%MOD; ll tmp_score=score(tmp); if(now_score>tmp_score){ swap(tmp,ans); swap(now_score,tmp_score); } } rep(loop,0,100000){ int idx=randxor()%N; int ad=(randxor()&1?1:-1); ans[idx]+=ad; if(ans[idx]<0) ans[idx]+=MOD; if(ans[idx]>=MOD) ans[idx]-=MOD; ll tmp_score=score(ans); if(now_score>tmp_score){ swap(now_score,tmp_score); }else{ ans[idx]-=ad; if(ans[idx]<0) ans[idx]+=MOD; if(ans[idx]>=MOD) ans[idx]-=MOD; } } rep(i,0,N) cout<