#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #include #include using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(int)(n); i++) const i64 INF = 1001001001001001001; i64 dp[2501][2501]; int main(){ int N; cin >> N; vector> wWVD; rep(i,N){ i64 w, c, v; w = i+1; cin >> c >> v; if(c >= N/w){ int C=1; while(C=D; k--){ for(i64 i=W; i<=N; i++){ dp[k][i] = max(dp[k][i], dp[k-D][i-W] + V); } } } for(int k=1; k<=N; k++) cout << dp[k][N] << '\n'; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;