problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define all(x) (x).begin(), (x).end() #define ub upper_bound #define lb lower_bound #define int long long #define endl '\n' #define ff first #define ss second #define ull unsigned long long #define pb push...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define all(x) (x).begin(), (x).end() #define ub upper_bound #define lb lower_bound #define int long long #define endl '\n' #define ff first #define ss second #define ull unsigned long long #define pb push...
replace
75
76
75
76
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, W; cin >> n >> W; vector<int> w(n), v(n); vector<long long int> dp(W + 1, 0); for (int i = 0; i < n; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i < n; i++) { for (int j = W; j >= 0; j--) { dp[j] = max(dp[j], dp[j - w[i]] +...
#include <bits/stdc++.h> using namespace std; int main() { int n, W; cin >> n >> W; vector<int> w(n), v(n); vector<long long int> dp(W + 1, 0); for (int i = 0; i < n; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i < n; i++) { for (int j = W; j >= w[i]; j--) { dp[j] = max(dp[j], dp[j - w[i]...
replace
12
13
12
13
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int N, W; int N_MAX = 100; int W_MAX = 100000; vector<int> w(N_MAX), v(N_MAX); vector<vector<long long>> dp(N_MAX, vector<long long>(W_MAX + 1, 0)); int main() { cin >> N >> W; for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; for (int i = 0; i < N; i++) { fo...
#include <bits/stdc++.h> using namespace std; int N, W; int N_MAX = 100; int W_MAX = 100000; vector<int> w(N_MAX), v(N_MAX); vector<vector<long long>> dp(N_MAX + 1, vector<long long>(W_MAX, 0)); int main() { cin >> N >> W; for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; for (int i = 0; i < N; i++) { fo...
replace
7
8
7
8
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define int long long using namespace std; int N, W; int w[105], v[105]; int cache[105][105]; int dp(int n, int wt) { if (wt > W) return -1e15; if (n == N) return 0; if (cache[n][wt] != -1) return cache[n][wt]; cache[n][wt] = max(dp(n + 1, wt), v[n] + dp(n + 1, wt + w[n]))...
#include <bits/stdc++.h> #define int long long using namespace std; int N, W; int w[105], v[105]; int cache[105][100005]; int dp(int n, int wt) { if (wt > W) return -1e15; if (n == N) return 0; if (cache[n][wt] != -1) return cache[n][wt]; cache[n][wt] = max(dp(n + 1, wt), v[n] + dp(n + 1, wt + w[n...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define int long long using namespace std; int dp[110][100010]; int a[110][2]; int32_t main() { int n, w; cin >> n >> w; for (int i = 1; i <= n; i++) cin >> a[i][0] >> a[i][1]; for (int i = 1; i <= w; i++) { for (int j = 1; j <= n; j++) { dp[i][j] = dp[i][j - 1]; ...
#include <bits/stdc++.h> #define int long long using namespace std; int dp[100010][110]; int a[110][2]; int32_t main() { int n, w; cin >> n >> w; for (int i = 1; i <= n; i++) cin >> a[i][0] >> a[i][1]; for (int i = 1; i <= w; i++) { for (int j = 1; j <= n; j++) { dp[i][j] = dp[i][j - 1]; ...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using lint = long long; lint Knapsack(int limit, vector<int> &v, vector<int> &w) { vector<lint> dyn(limit, -1); int n = w.size(); dyn[0] = 0; for (int i = 0; i < n; ++i) for (int j = limit; j >= w[i]; --j) if (dyn[j - w[i]] >= 0) dyn[j] = max(dyn...
#include <bits/stdc++.h> using namespace std; using lint = long long; lint Knapsack(int limit, vector<int> &v, vector<int> &w) { vector<lint> dyn(limit + 1, -1); int n = w.size(); dyn[0] = 0; for (int i = 0; i < n; ++i) for (int j = limit; j >= w[i]; --j) if (dyn[j - w[i]] >= 0) dyn[j] = max...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define flp(i, a, b) for (int i = a; i < b; i++) #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define flp(i, a, b) for (int i = a; i < b; i++) #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
replace
12
13
12
13
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n, k; cin >> n >> k; ll w[n + 1], v[n + 1]; w[0] = 0; v[0] = 0; for (int i = 1; i <= n; ++i) { cin >> w[i] >> v[i]; } ll dp[n][k]; for (int i = 0; i <= n; ++i) { for (int j = 0; j <= k; ++j) { if (...
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n, k; cin >> n >> k; ll w[n + 1], v[n + 1]; w[0] = 0; v[0] = 0; for (int i = 1; i <= n; ++i) { cin >> w[i] >> v[i]; } ll dp[n + 1][k + 1]; for (int i = 0; i <= n; ++i) { for (int j = 0; j <= k; ++j) { ...
replace
15
16
15
16
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define endl ...
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define endl ...
replace
40
42
40
41
TLE
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> using namespace std; int N = 0; int W = 0; int w[100]; long long v[100]; long long dp[110][110] = {0}; int main(void) { cin >> N >> W; for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i < N; i++) { for (int j...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> using namespace std; int N = 0; int W = 0; int w[100]; long long v[100]; long long dp[110][1000010] = {0}; int main(void) { cin >> N >> W; for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i < N; i++) { for (i...
replace
9
10
9
10
0
p03163
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define fw(x) freopen("x.txt", "w", stdout) #define For(i, a, b, c) for (int i =...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define fw(x) freopen("x.txt", "w", stdout) #define For(i, a, b, c) for (int i =...
replace
60
61
60
61
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll w[105], f[105]; ll v[105]; signed main() { ll N, W; while (cin >> N >> W) { for (ll i = 1; i <= N; i++) cin >> w[i] >> v[i]; // 01背包 memset(f, 0, sizeof f); for (ll i = 1; i <= N; i++) { for (ll j = W; j >= w[i]; j...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll w[105], f[100005]; ll v[105]; signed main() { ll N, W; while (cin >> N >> W) { for (ll i = 1; i <= N; i++) cin >> w[i] >> v[i]; // 01背包 memset(f, 0, sizeof f); for (ll i = 1; i <= N; i++) { for (ll j = W; j >= w[i]...
replace
4
5
4
5
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; int n, w; int const pp = 10e5; int arr[32][2]; long long dp[30][pp]; long long solve(int idx, int rem) { if (idx >= n) return 0; long long &ret = dp[idx][rem]; if (ret) return ret; if (rem - arr[idx][0] >= 0) ret = arr[idx][1] + sol...
#include <bits/stdc++.h> #include <iostream> using namespace std; int n, w; int const pp = 10e5; int arr[102][2]; long long dp[102][pp]; long long solve(int idx, int rem) { if (idx >= n) return 0; long long &ret = dp[idx][rem]; if (ret) return ret; if (rem - arr[idx][0] >= 0) ret = arr[idx][1] + s...
replace
6
8
6
8
-11
p03163
C++
Runtime Error
// In The Name Of Allah // #include <bits/stdc++.h> #define pb emplace_back #define inf (int)1e9 #define ff first #define ss second #define ll long long #define sp(n) cout << setprecision(n) << fixed #define hellcat ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define give(x) cout << #x << " " << x << endl #define ...
// In The Name Of Allah // #include <bits/stdc++.h> #define pb emplace_back #define inf (int)1e9 #define ff first #define ss second #define ll long long #define sp(n) cout << setprecision(n) << fixed #define hellcat ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define give(x) cout << #x << " " << x << endl #define ...
replace
29
30
29
30
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define F first #define S second #define PB push_back #define int ll using namespace std; typedef long long ll; signed main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout...
#include <bits/stdc++.h> #define F first #define S second #define PB push_back #define int ll using namespace std; typedef long long ll; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, w; cin >> n >> w; vector<pair<int, int>> items; for (int i = 0; i < n; i++...
delete
12
17
12
12
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9 + 7; int dy[] = {1, -1, 0, 0}; int dx[] = {0, 0, 1, -1}; int main() { int N, W; cin >> N >> W; vector<int> w(N), v(N); for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } vector<vector<ll>> dp(N, vector<ll>(1e7 + 1...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9 + 7; int dy[] = {1, -1, 0, 0}; int dx[] = {0, 0, 1, -1}; int main() { int N, W; cin >> N >> W; vector<int> w(N), v(N); for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } vector<vector<ll>> dp(N, vector<ll>(1e5 + 1...
replace
15
16
15
16
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int knapsack(int w, int wt[], int val[], int n) { int dp[n + 1][w + 1]; for (int i = 0; i <= n; ++i) { for (int j = 0; j <= w; ++j) { if (i == 0 || j == 0) dp[i][j] = 0; else if (wt[i - 1] <= j) { dp[i][j] = max(va...
#include <bits/stdc++.h> using namespace std; #define int long long int knapsack(int w, int wt[], int val[], int n) { int dp[n + 1][w + 1]; for (int i = 0; i <= n; ++i) { for (int j = 0; j <= w; ++j) { if (i == 0 || j == 0) dp[i][j] = 0; else if (wt[i - 1] <= j) { dp[i][j] = max(va...
replace
25
29
25
29
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define loop(i, a, b) for (ll i = a; i < b; i++) #define initialize(array, size, value) ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define loop(i, a, b) for (ll i = a; i < b; i++) #define initialize(array, size, value) ...
replace
63
67
63
67
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fo(i, n) for (ll i = 0; i < n; i++) #define endl "\n" #define of(i, n) for (ll i = n - 1; i >= 0; i--) #define ll long long #define vec vector<ll> #define fio \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define fo(i, n) for (ll i = 0; i < n; i++) #define endl "\n" #define of(i, n) for (ll i = n - 1; i >= 0; i--) #define ll long long #define vec vector<ll> #define fio \ ios_base::sync_with_stdio(false); ...
replace
55
56
55
56
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define mk make_pair #define fi first #define se second #define vll vector<ll> #define pii pair<ll, ll> #define vvll vector<vector<ll>> #define pb push_back #define sz...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define mk make_pair #define fi first #define se second #define vll vector<ll> #define pii pair<ll, ll> #define vvll vector<vector<ll>> #define pb push_back #define sz...
replace
64
65
64
65
TLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; long long w, w_arr[100], v_arr[100], dp[101]; // (W+1) memset(dp, 0, sizeof(dp)); cin >> n >> w; for (int i = 0; i < n; i++) { cin >> w_arr[i] >> v_arr[i]; } for (int i = 0; i < n; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; long long w, w_arr[100], v_arr[100], dp[100001]; // (W+1) memset(dp, 0, sizeof(dp)); cin >> n >> w; for (int i = 0; i < n; i++) { cin >> w_arr[i] >> v_arr[i]; } for (int i = 0; i < ...
replace
8
9
8
9
0
p03163
C++
Runtime Error
#include <iostream> using namespace std; typedef long long ll; const ll inf = 1LL << 60; int n, W; ll dp[100][100010]; ll w[110]; ll v[110]; int main() { cin >> n >> W; for (int i = 0; i < n; i++) { cin >> w[i] >> v[i]; } for (int i = n - 1; i >= 0; i--) { for (int j = 0; j <= W; j++) { if (j ...
#include <iostream> using namespace std; typedef long long ll; const ll inf = 1LL << 60; int n, W; ll dp[110][100010] = {0}; ll w[110]; ll v[110]; int main() { cin >> n >> W; for (int i = 0; i < n; i++) { cin >> w[i] >> v[i]; } for (int i = n - 1; i >= 0; i--) { for (int j = 0; j <= W; j++) { ...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> // ok 理解 using namespace std; using ll = long long; ll n, W; ll w[110], v[110]; vector<vector<ll>> dp(110, vector<ll>(110, -1)); ll rec(ll i, ll j) { if (dp.at(i).at(j) != -1) { return dp.at(i).at(j); } ll res = 0; if (i == n) { res = 0; } else if (j < w[i]) { res = rec(...
#include <bits/stdc++.h> // ok 理解 using namespace std; using ll = long long; ll n, W; ll w[110], v[110]; vector<vector<ll>> dp(110, vector<ll>(100010, -1)); ll rec(ll i, ll j) { if (dp.at(i).at(j) != -1) { return dp.at(i).at(j); } ll res = 0; if (i == n) { res = 0; } else if (j < w[i]) { res = r...
replace
7
8
7
8
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, W, v[107], w[107]; long long dp[107][107]; int main() { ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); cin >> n >> W; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int i = 1; i <= n; i++) { for (int wt = 1; wt <= W; wt++) { ...
#include <bits/stdc++.h> using namespace std; int n, W, v[107], w[107]; long long dp[107][100007]; int main() { ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); cin >> n >> W; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int i = 1; i <= n; i++) { for (int wt = 1; wt <= W; wt++) { ...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; long long dp[110][100010]; // dp[i][j]はi番目までの品物を重さjまでに入れたときの最大値 int main() { int N; int W; int v[110], w[110]; cin >> N >> W; for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; // dp初期条件 for (int j = 0; j <= W; j++) dp[0][j] = 0; ...
#include <algorithm> #include <iostream> using namespace std; long long dp[110][100010]; // dp[i][j]はi番目までの品物を重さjまでに入れたときの最大値 int main() { int N; int W; int v[110], w[110]; cin >> N >> W; for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; // dp初期条件 for (int j = 0; j <= W; j++) dp[0][j] = 0; ...
replace
21
22
21
22
0
p03163
C++
Runtime Error
#pragma GCC optimize "Ofast" #pragma GCC optimize "unroll-loops" #pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native" #include <bits/stdc++.h> #define scan(x) \ do { ...
#pragma GCC optimize "Ofast" #pragma GCC optimize "unroll-loops" #pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native" #include <bits/stdc++.h> #define scan(x) \ do { ...
replace
15
16
15
16
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("-O3") #define ll long long #define en "\n" const ll inf = 1e9; const ll mod = 1e9 + 7; using namespace std; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); ll a[100005], b[100005], m, n, dp[100005] = {0}; cin >> n >> m; for (int i = 1; i <= ...
#include <bits/stdc++.h> #pragma GCC optimize("-O3") #define ll long long #define en "\n" const ll inf = 1e9; const ll mod = 1e9 + 7; using namespace std; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); ll a[100005], b[100005], m, n, dp[300005] = {0}; cin >> n >> m; for (int i = 1; i <= ...
replace
11
12
11
12
0
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <list> #include <queue> #include <vector> using namespace std; const int mx = 1e5 + 123; #define mem(a, b) memset(a, b, sizeof(a)); int w[120], v[120], W, n; long long dp[120][mx]; long long solve(int i, int j) { if (i > n) ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <list> #include <queue> #include <vector> using namespace std; const int mx = 1e5 + 123; #define mem(a, b) memset(a, b, sizeof(a)); int w[120], v[120], W, n; long long dp[120][mx]; long long solve(int i, int j) { if (i > n) ...
replace
26
28
26
27
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int dp[123456]; int N, W, price[123], wt[123]; int32_t main() { cin >> N >> W; for (int i = 0; i < N; i++) { cin >> wt[i] >> price[i]; } for (int i = 0; i < N; i++) { for (int j = W - wt[i]; j >= 0; j--) { dp[j + wt[i]] = max(dp[...
#include <bits/stdc++.h> using namespace std; #define int long long int dp[123456]; int N, W, price[123], wt[123]; int32_t main() { cin >> N >> W; for (int i = 0; i < N; i++) { cin >> wt[i] >> price[i]; } for (int i = 0; i < N; i++) { for (int j = W - wt[i]; j >= 0; j--) { dp[j + wt[i]] = max(dp[...
replace
13
14
13
14
0
p03163
C++
Runtime Error
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, W; cin >> N >> W; vector<long> w(N); vector<long> v(N); for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; vector<vector<long>> dp(N + 1, vector<long>(W + 1)); dp[0] = vector<long>(W); for (int i = 0; i...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, W; cin >> N >> W; vector<long> w(N); vector<long> v(N); for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; vector<vector<long>> dp(N + 1, vector<long>(W + 1)); dp[0] = vector<long>(W); for (int i = 0; i...
replace
29
30
29
30
1
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, s, n) for (int i = s; i < (n); ++i) using namespace std; typedef long long ll; static const int INTINF = (2147483647); static const ll LLINF = (9223372036854775807); static const int MAX = 100001; static const ll MOD = 100000000...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, s, n) for (int i = s; i < (n); ++i) using namespace std; typedef long long ll; static const int INTINF = (2147483647); static const ll LLINF = (9223372036854775807); static const int MAX = 100001; static const ll MOD = 100000000...
replace
47
48
47
50
0
p03163
C++
Runtime Error
/* @uthor: Amit Kumar user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus; */ #include <bits/stdc++.h> #include <chrono> using namespace std; using namespace std::chrono; // #include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; /...
/* @uthor: Amit Kumar user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus; */ #include <bits/stdc++.h> #include <chrono> using namespace std; using namespace std::chrono; // #include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; /...
replace
58
60
58
60
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03163
C++
Runtime Error
#include <iostream> using namespace std; long long dp[100][100010] = {0}; // N-1番目までで入れた容量の価値を最大にするもの long long weight[110], value[110]; int main() { int N, W; cin >> N >> W; for (int i = 0; i < N; ++i) { cin >> weight[i] >> value[i]; } for (int i = 0; i < N; ++i) { for (int sum_W = 0; sum_W <= W; ...
#include <iostream> using namespace std; long long dp[110][100010] = {0}; // N-1番目までで入れた容量の価値を最大にするもの long long weight[110], value[110]; int main() { int N, W; cin >> N >> W; for (int i = 0; i < N; ++i) { cin >> weight[i] >> value[i]; } for (int i = 0; i < N; ++i) { for (int sum_W = 0; sum_W <= W; ...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const ll MOD = 1000000007; ll dp[2][100000 + 100]; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } retur...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const ll MOD = 1000000007; ll dp[2][100000 + 100]; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } retur...
replace
24
25
24
26
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define PRINT(V) cout << V << "\n" #define SORT(V) sort((V).begin(), (V).end()) #define RSORT(V) sort((V).rbegin(), (V).rend()) using namespace std; using ll = long long; te...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define PRINT(V) cout << V << "\n" #define SORT(V) sort((V).begin(), (V).end()) #define RSORT(V) sort((V).rbegin(), (V).rend()) using namespace std; using ll = long long; te...
replace
25
26
25
26
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; ll t[105][10005]; vector<int> wt, val; ll knapsack(int n, int w) { if (n == 0 || w == 0) return 0; if (t[n][w] != -1) return t[n][w]; if (wt[n - 1] <= w) { return t[n][w] = max(val[n - 1] + knapsack(n - 1, w - wt[n - 1]), ...
#include <bits/stdc++.h> #define ll long long using namespace std; ll t[105][100005]; vector<int> wt, val; ll knapsack(int n, int w) { if (n == 0 || w == 0) return 0; if (t[n][w] != -1) return t[n][w]; if (wt[n - 1] <= w) { return t[n][w] = max(val[n - 1] + knapsack(n - 1, w - wt[n - 1]), ...
replace
4
5
4
5
0
p03163
C++
Runtime Error
#pragma GCC optimze("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; #define ll long long #define pp pair<ll, ll> #define ppp pair<ll, pp> #define...
#pragma GCC optimze("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; #define ll long long #define pp pair<ll, ll> #define ppp pair<ll, pp> #define...
replace
35
36
35
36
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int inf = 1001001001; int main() { int n, w; cin >> n >> w; vector<ll> v(n); vector<ll> m(n); rep(i, n) cin >> m.at(i) >> v.at(i); vector<vector<ll>> dp(100, vector<ll>(100000)); fo...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int inf = 1001001001; int main() { int n, w; cin >> n >> w; vector<ll> v(n); vector<ll> m(n); rep(i, n) cin >> m.at(i) >> v.at(i); vector<vector<ll>> dp(110, vector<ll>(100010)); fo...
replace
14
15
14
15
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long int #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queu...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long int #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queu...
delete
37
41
37
37
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MN = 112; ll n, c, w[MN], v[MN], dp[MN][MN]; int main(void) { cin >> n >> c; for (ll i = 0; i < n; i++) cin >> w[i] >> v[i]; for (ll cc = 1; cc <= c; cc++) { for (ll i = 1; i <= n; i++) { ll cw = w[i - 1], cv = v[i - 1]; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MN = 112; const int MW = 100012; ll n, c, w[MN], v[MN], dp[MW][MN]; int main(void) { cin >> n >> c; for (ll i = 0; i < n; i++) cin >> w[i] >> v[i]; for (ll cc = 1; cc <= c; cc++) { for (ll i = 1; i <= n; i++) { ll cw = w[i...
replace
4
5
4
6
0
p03163
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef pair<int,...
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef pair<int,...
replace
45
47
45
47
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define sc second #define fr first #define mk make_pair #define ll long long #define ii pair<int, int> #define mp make_pair using namespace std; int n; ll memo[101][10005]; ll a[105]; ll w[105]; ll solve(int i, int sum) { if (i == n) { return 0; } ll &ret = memo[i...
#include <bits/stdc++.h> #define pb push_back #define sc second #define fr first #define mk make_pair #define ll long long #define ii pair<int, int> #define mp make_pair using namespace std; int n; ll memo[101][100005]; ll a[105]; ll w[105]; ll solve(int i, int sum) { if (i == n) { return 0; } ll &ret = memo[...
replace
10
11
10
11
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // #include <boost/multiprecision/cpp_int.hpp> // using multiInt = boost::multiprecision::cpp_int; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; template <typename Q_temp> using smaller_queue = priority_queue<Q_temp...
#include <bits/stdc++.h> using namespace std; // #include <boost/multiprecision/cpp_int.hpp> // using multiInt = boost::multiprecision::cpp_int; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; template <typename Q_temp> using smaller_queue = priority_queue<Q_temp...
replace
47
48
47
48
TLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define maxn 100 #define maxw 10001 int main() { long long n, w; cin >> n >> w; long long dp[maxn][maxw], weight[maxn], val[maxn]; for (long long i = 0; i < n; i++) cin >> weight[i] >> val[i]; for (long long i = 0; i <= w; i++) dp[0][i] = 0; dp[0][w - we...
#include <bits/stdc++.h> using namespace std; #define maxn 100 #define maxw 100001 int main() { long long n, w; cin >> n >> w; long long dp[maxn][maxw], weight[maxn], val[maxn]; for (long long i = 0; i < n; i++) cin >> weight[i] >> val[i]; for (long long i = 0; i <= w; i++) dp[0][i] = 0; dp[0][w - w...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <iostream> #include <vector> template <class T> inline bool chmax(T &a, const T &b) { return (a < b) ? a = b, true : false; } int main() { int N; int W; std::cin >> N >> W; std::vector<int> w(N); std::vector<long long> v(N); for (int i = 0; i < N; ++i) std::cin >> w[i] >> v[i]; // dp[i]...
#include <iostream> #include <vector> template <class T> inline bool chmax(T &a, const T &b) { return (a < b) ? a = b, true : false; } int main() { int N; int W; std::cin >> N >> W; std::vector<int> w(N); std::vector<long long> v(N); for (int i = 0; i < N; ++i) std::cin >> w[i] >> v[i]; // dp[i]...
replace
18
20
18
20
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long dp[610]; int w[610], v[610]; int N, W; int main() { cin >> N >> W; for (int i = 1; i <= N; i++) cin >> w[i] >> v[i]; dp[0] = 0; for (int i = 1; i <= N; i++) { for (int j = W - w[i]; j >= 0; j--) { dp[j + w[i]] = max(dp[j] + v[i], dp[j + w[...
#include <bits/stdc++.h> using namespace std; long long dp[100100]; int w[100100], v[100100]; int N, W; int main() { cin >> N >> W; for (int i = 1; i <= N; i++) cin >> w[i] >> v[i]; dp[0] = 0; for (int i = 1; i <= N; i++) { for (int j = W - w[i]; j >= 0; j--) { dp[j + w[i]] = max(dp[j] + v[i], ...
replace
4
6
4
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define f .first #define s .second using namespace std; using ll = long long; int n, W; pair<ll, ll> item[105]; ll dp[10005], maxv; int main() { cin >> n >> W; for (int i = 1; i <= n; ++i) { cin >> item[i] f >> item[i] s; } for (int i = 0; i <= W; ++i) { dp[i] = -1; } sort(i...
#include <bits/stdc++.h> #define f .first #define s .second using namespace std; using ll = long long; int n, W; pair<ll, ll> item[100005]; ll dp[100005], maxv; int main() { cin >> n >> W; for (int i = 1; i <= n; ++i) { cin >> item[i] f >> item[i] s; } for (int i = 0; i <= W; ++i) { dp[i] = -1; } so...
replace
6
8
6
8
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n...
delete
14
18
14
14
0
p03163
C++
Runtime Error
#include <algorithm> #include <cstdlib> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; long N, W; long w[100], v[100]; long dp[100][100000]; int main() { cin >> N >> W; for (int i = 0; i < N; ++i) cin >> w[i] >> v[i]; // initialize for (int j = 0; j <= W; ...
#include <algorithm> #include <cstdlib> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; long N, W; long w[110], v[110]; long dp[110][100100]; int main() { cin >> N >> W; for (int i = 0; i < N; ++i) cin >> w[i] >> v[i]; // initialize for (int j = 0; j <= W; ...
replace
10
12
10
12
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef int in; #define int long long int MAX = 1e9; int MAXEST = 1e18; int MOD = 1e9 + 7; int n, w; int v[105], s[105]; int dp[2][100005]; in main() { int tc = 1; // cin>>tc; while (tc--) { cin >> n >> w; for (int i = 1; i <= n; i++) { cin >> s[i]...
#include <bits/stdc++.h> using namespace std; typedef int in; #define int long long int MAX = 1e9; int MAXEST = 1e18; int MOD = 1e9 + 7; int n, w; int v[105], s[105]; int dp[2][100005]; in main() { int tc = 1; // cin>>tc; while (tc--) { cin >> n >> w; for (int i = 1; i <= n; i++) { cin >> s[i]...
replace
28
29
28
29
-11
p03163
C++
Runtime Error
#include <iostream> using namespace std; typedef long long ll; ll dp[105][105], weight[105], value[105]; int n, cap; int main() { cin >> n >> cap; for (int i = 1; i <= n; i++) { ll x, y; cin >> x >> y; weight[i] = x; value[i] = y; } for (int i = 1; i <= n; i++) { ll w = weight[i], v = value[...
#include <iostream> using namespace std; typedef long long ll; ll dp[105][100005], weight[105], value[105]; int n, cap; int main() { cin >> n >> cap; for (int i = 1; i <= n; i++) { ll x, y; cin >> x >> y; weight[i] = x; value[i] = y; } for (int i = 1; i <= n; i++) { ll w = weight[i], v = val...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; long long knapsack(int *w, int *v, vector<vector<long long>> &dp, int i, int maxw) { if (maxw <= 0) return 0; if (i < 0) return 0; if (dp[i][maxw] != -1) return dp[i][maxw]; if (w[i] <= maxw) { dp[i][maxw] = ...
#include <bits/stdc++.h> #include <iostream> using namespace std; long long knapsack(int *w, int *v, vector<vector<long long>> &dp, int i, int maxw) { if (maxw <= 0) return 0; if (i < 0) return 0; if (dp[i][maxw] != -1) return dp[i][maxw]; if (w[i] <= maxw) { dp[i][maxw] = ...
replace
28
29
28
29
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define ld long double typedef pair<ll, ll> P; #define boost \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define ld long double typedef pair<ll, ll> P; #define boost \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
replace
25
26
25
26
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long int lmax(long long int a, long long int b) { if (a < b) return b; else return a; } int main() { long long int n, W; cin >> n >> W; vector<long long int> w(n); vector<long long int> v(n); for (long long int i = 0; i < n; i++) { cin >> w[i]...
#include <bits/stdc++.h> using namespace std; long long int lmax(long long int a, long long int b) { if (a < b) return b; else return a; } int main() { long long int n, W; cin >> n >> W; vector<long long int> w(n); vector<long long int> v(n); for (long long int i = 0; i < n; i++) { cin >> w[i]...
replace
17
18
17
18
0
p03163
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include ...
replace
49
50
49
50
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> #define ll long long #define MOD 1000000007 using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll s, n; cin >> s >> n; ll size[n]; ll value[n]; for (ll i = 0; i < n; i++) cin >> size[i] >> value[i]; ll dp[...
#include <bits/stdc++.h> #include <iostream> #define ll long long #define MOD 1000000007 using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n, s; cin >> n >> s; ll size[n]; ll value[n]; for (ll i = 0; i < n; i++) cin >> size[i] >> value[i]; ll dp[...
replace
9
11
9
11
-11
p03163
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using llong = long long; llong N, W; llong w[105], v[105]; llo...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using llong = long long; llong N, W; llong w[105], v[105]; llo...
replace
18
19
18
19
0
p03163
C++
Runtime Error
// #include <stdio.h> #include <algorithm> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <utility> #include <vector> using namespace std; #define ll long long vector<vector<ll>> dp; vector<ll> w, v; ll N, W; ll res(ll i, ll j) { if (i >= N) ...
// #include <stdio.h> #include <algorithm> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <utility> #include <vector> using namespace std; #define ll long long vector<vector<ll>> dp; vector<ll> w, v; ll N, W; ll res(ll i, ll j) { if (i >= N) ...
replace
38
39
38
39
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
replace
46
48
46
48
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<in...
insert
44
44
44
46
TLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; ...
replace
33
34
33
34
-11
p03163
C++
Runtime Error
// Subhash Suman // Description : #include <bits/stdc++.h> #define ll long long int #define pll pair<ll, ll> #define pii pair<int, int> using namespace std; const int N = 100, W = 1e5 + 5; ll n, w, dp[N][W], arr1[N], arr2[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >...
// Subhash Suman // Description : #include <bits/stdc++.h> #define ll long long int #define pll pair<ll, ll> #define pii pair<int, int> using namespace std; const int N = 105, W = 1e5 + 5; ll n, w, dp[N][W], arr1[N], arr2[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >...
replace
9
10
9
10
0
p03163
C++
Runtime Error
/* Author: Racer5x *************************************** UNAUTHORISED COPYING OF CODE PROHIBITED ********************************** */ /*#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/ ...
/* Author: Racer5x *************************************** UNAUTHORISED COPYING OF CODE PROHIBITED ********************************** */ /*#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/ ...
replace
54
60
54
55
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define Rushia_mywife \ ios::sync_with_stdio(0); \ cin.tie(0); #define rep(i, head, n) for (int i = (head); i < n; i++) #define F first #define S second #define FF first.first #defi...
#include <bits/stdc++.h> #define Rushia_mywife \ ios::sync_with_stdio(0); \ cin.tie(0); #define rep(i, head, n) for (int i = (head); i < n; i++) #define F first #define S second #define FF first.first #defi...
replace
49
50
49
50
0
p03163
C++
Time Limit Exceeded
#include "bits/stdc++.h" #pragma GCC optimize("Ofast") // Begin {{{ using namespace std; #ifndef DEBUG #define dump(...) #endif template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); } template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a =...
#include "bits/stdc++.h" #pragma GCC optimize("Ofast") // Begin {{{ using namespace std; #ifndef DEBUG #define dump(...) #endif template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); } template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a =...
replace
44
45
44
46
TLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define intt long long const int N = 105; const int NN = 10005; int n, W; int v[N], w[N]; intt dp[NN]; int main() { cin >> n >> W; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int k = 1; k <= n; k++) { for (int x = W; x >= 0; x--) { ...
#include <bits/stdc++.h> using namespace std; #define intt long long const int N = 105; const int NN = 100005; int n, W; int v[N], w[N]; intt dp[NN]; int main() { cin >> n >> W; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int k = 1; k <= n; k++) { for (int x = W; x >= 0; x--) { ...
replace
7
8
7
8
0
p03163
C++
Runtime Error
// It's time to be who I am, rather than who I am supposed to be. #include <bits/stdc++.h> #define int long long using namespace std; const int inf = 1e12; const int N = 105; const int W = 1e5 + 5; int n, total, weight[N], value[N], dp[N][W]; int solve(int item, int remain) { if (remain < 0) return -inf; if ...
// It's time to be who I am, rather than who I am supposed to be. #include <bits/stdc++.h> #define int long long using namespace std; const int inf = 1e12; const int N = 105; const int W = 1e5 + 5; int n, total, weight[N], value[N], dp[N][W]; int solve(int item, int remain) { if (remain < 0) return -inf; if ...
delete
34
39
34
34
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long ll wt[101], pft[101]; ll n; ll dp[101][101]; ll solve(ll st_index, ll wt_left) { if (st_index == n) return 0; if (dp[st_index][wt_left] != -1) return dp[st_index][wt_left]; ll ans = solve(st_index + 1, wt_left); i...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long ll wt[101], pft[101]; ll n; ll dp[110][100001]; ll solve(ll st_index, ll wt_left) { if (st_index == n) return 0; if (dp[st_index][wt_left] != -1) return dp[st_index][wt_left]; ll ans = solve(st_index + 1, wt_left); ...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define itc \ ll t; ...
#include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define itc \ ll t; ...
replace
50
55
50
59
0
p03163
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long #define PB push_back #define MP make_pair #define S second #define F first // #define D cout<<"*\n"; #define fast \ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define PB push_back #define MP make_pair #define S second #define F first // #define D cout<<"*\n"; #define fast \ ios_base::sync_with_stdio(0); ...
replace
17
18
17
18
MLE
p03163
C++
Runtime Error
#include <iostream> using namespace std; int n; int max_weight; int w[101]; long long int v[101]; long long int dp[101][100001]; long long int ans = 0; int main() { cin >> n >> max_weight; for (int i = 0; i < n; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i <= n; i++) { for (int j = 0; j <= max_weigh...
#include <iostream> using namespace std; int n; int max_weight; int w[101]; long long int v[101]; long long int dp[101][100001]; long long int ans = 0; int main() { cin >> n >> max_weight; for (int i = 0; i < n; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i < n; i++) { for (int j = 0; j <= max_weight...
replace
14
15
14
15
0
p03163
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> // #include <bits/stdc++.h> #define lson l, mid, rt << 1 #define rson mid + 1, r, rt << 1 | 1 const int N = 1e5 + 100; usi...
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> // #include <bits/stdc++.h> #define lson l, mid, rt << 1 #define rson mid + 1, r, rt << 1 | 1 const int N = 1e5 + 100; usi...
replace
22
23
22
23
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long ll v[105], weight[105], dp[105][10005], n, CAP; ll KnapSack(int i, ll w) { if (i == n) { return 0; } if (dp[i][w] != -1) return dp[i][w]; ll ans1 = 0, ans2 = 0; if (w + weight[i] <= CAP) { ans1 = KnapSack(i + 1, w + weight[i]) ...
#include <bits/stdc++.h> using namespace std; #define ll long long ll v[105], weight[105], dp[105][100005], n, CAP; ll KnapSack(int i, ll w) { if (i == n) { return 0; } if (dp[i][w] != -1) return dp[i][w]; ll ans1 = 0, ans2 = 0; if (w + weight[i] <= CAP) { ans1 = KnapSack(i + 1, w + weight[i])...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, CAP, w[105], v[105], dp[105][105]; ll knapsack(ll item, ll weight) { if (item > n) { return 0; } if (dp[item][weight] != -1) return dp[item][weight]; ll ans1 = 0; if (weight + w[item] <= CAP) { ans1 = knapsack(item + 1...
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, CAP, w[105], v[105], dp[105][100005]; ll knapsack(ll item, ll weight) { if (item > n) { return 0; } if (dp[item][weight] != -1) return dp[item][weight]; ll ans1 = 0; if (weight + w[item] <= CAP) { ans1 = knapsack(item ...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int const int INF = 1e9 + 5; #undef int int main() { #define int long long int int n, w; cin >> n >> w; vector<int> weight(n, 0); vector<int> values(n, 0); int dp[n + 5][w + 5]; memset(dp, 0, sizeof(dp)); for (int i = 0; i < n; i++) {...
#include <bits/stdc++.h> using namespace std; #define int long long int const int INF = 1e9 + 5; #undef int int main() { #define int long long int int n, w; cin >> n >> w; vector<int> weight(n, 0); vector<int> values(n, 0); int dp[n + 5][w + 5]; memset(dp, 0, sizeof(dp)); for (int i = 0; i < n; i++) {...
replace
28
29
28
30
0
p03163
C++
Runtime Error
#include <cmath> #include <iostream> using namespace std; #define MAXN 120 #define MAXW 100001 long long N, W; long long w[MAXN], v[MAXN]; long long dp[MAXN][MAXW]; int main() { cin >> N >> W; for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } for (int i = w[0]; i <= W; i++) { dp[0][i] = v[0]; }...
#include <cmath> #include <iostream> using namespace std; #define MAXN 120 #define MAXW 100001 long long N, W; long long w[MAXN], v[MAXN]; long long dp[MAXN][MAXW]; int main() { cin >> N >> W; for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } for (int i = w[0]; i <= W; i++) { dp[0][i] = v[0]; }...
replace
22
23
22
27
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTIO \ ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(nullptr) #define INF (1LL << 62) - 1 #define F first #define S second #define pb push_back ll dp[102][100002]; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTIO \ ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(nullptr) #define INF (1LL << 62) - 1 #define F first #define S second #define pb push_back ll dp[102][100002]; ...
replace
29
31
29
31
-11
p03163
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cstdio> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long li; typedef unsigned long long ul...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cstdio> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long li; typedef unsigned long long ul...
replace
35
36
35
36
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 1; i <= (n); i++) using ll = long long; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1000000007; int main() { ll N, W; cin >> N >> W; vector<ll> w(N + 1), v(N + 1); rep(i, N) cin >> w[i] >> v[i]; vector<vector<ll>> d...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 1; i <= (n); i++) using ll = long long; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1000000007; int main() { ll N, W; cin >> N >> W; vector<ll> w(N + 1), v(N + 1); rep(i, N) cin >> w[i] >> v[i]; vector<vector<ll>> d...
replace
14
15
14
15
-6
Fatal glibc error: malloc assertion failure in sysmalloc: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define INP (a << 50) using namespace std; int main() { int a, b, c, i, j; cin >> a >> b; int s[a + 5], ss[a + 5]; long long int sss[a + 5][a + 5]; for (i = 1; i <= a; i++) { cin >> s[i] >> ss[i]; } memset(sss, 0, sizeof(sss)); for (i = 1; i <= a; i++) { for (j = 1; j <=...
#include <bits/stdc++.h> #define INP (a << 50) using namespace std; int main() { int a, b, c, i, j; cin >> a >> b; int s[a + 5], ss[b + 5]; long long int sss[a + 5][b + 5]; for (i = 1; i <= a; i++) { cin >> s[i] >> ss[i]; } memset(sss, 0, sizeof(sss)); for (i = 1; i <= a; i++) { for (j = 1; j <=...
replace
6
8
6
8
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long ll a[201], b[201]; ll n, w; ll dp[201][201]; ll rec(ll idx, ll weight) { if (weight > w) return -1e9; if (weight == w) return 0; if (idx == n) return 0; if (dp[idx][weight] != -1) return dp[idx][weight]; ll op1 = rec(idx + 1, w...
#include <bits/stdc++.h> using namespace std; #define ll long long ll a[201], b[201]; ll n, w; ll dp[201][200001]; ll rec(ll idx, ll weight) { if (weight > w) return -1e9; if (weight == w) return 0; if (idx == n) return 0; if (dp[idx][weight] != -1) return dp[idx][weight]; ll op1 = rec(idx + 1...
replace
5
6
5
6
0
p03163
C++
Runtime Error
/* in the name of allah */ #include <bits/stdc++.h> using namespace std; const int N = 100, W = 1e5 + 5; long long n, w, a[N], v[N], dp[N][W]; void readInput() { cin >> n >> w; for (int i = 1; i <= n; i++) cin >> a[i] >> v[i]; } void solve() { for (int i = 1; i <= n; i++) for (int j = 0; j <= w; j++) {...
/* in the name of allah */ #include <bits/stdc++.h> using namespace std; const int N = 100 + 5, W = 1e5 + 5; long long n, w, a[N], v[N], dp[N][W]; void readInput() { cin >> n >> w; for (int i = 1; i <= n; i++) cin >> a[i] >> v[i]; } void solve() { for (int i = 1; i <= n; i++) for (int j = 0; j <= w; j+...
replace
4
5
4
5
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define REP(x, y, z) for (int x = y; x <= z; x++) #define MSET(x, y) memset(x, y, sizeof(x)) #define M 105 using namespace std; int n, m, w[M], v[M]; long long dp[10005]; int main() { while (~scanf("%d %d", &n, &m)) { REP(i, 1, n) scanf("%d %d", &w[i], &v[i]); MSET(dp, -1); dp[0] ...
#include <bits/stdc++.h> #define REP(x, y, z) for (int x = y; x <= z; x++) #define MSET(x, y) memset(x, y, sizeof(x)) #define M 105 using namespace std; int n, m, w[M], v[M]; long long dp[100005]; int main() { while (~scanf("%d %d", &n, &m)) { REP(i, 1, n) scanf("%d %d", &w[i], &v[i]); MSET(dp, -1); dp[0]...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; int main() { int N, W; cin >> N >> W; vector<int> w(N + 1, 0), v(...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; int main() { int N, W; cin >> N >> W; vector<int> w(N + 1, 0), v(...
replace
17
19
17
19
0
p03163
C++
Runtime Error
#include <climits> #include <cstring> #include <iostream> #define ll long long using namespace std; ll n, w; ll weight[105], value[105]; ll dp[105][105]; ll solve(ll i, ll j) { if (i == n + 1) return 0; if (j == 0) return 0; if (dp[i][j] != -1) return dp[i][j]; if (j - weight[i] < 0) return dp[i...
#include <climits> #include <cstring> #include <iostream> #define ll long long using namespace std; ll n, w; ll weight[100005], value[100005]; ll dp[105][100005]; ll solve(ll i, ll j) { if (i == n + 1) return 0; if (j == 0) return 0; if (dp[i][j] != -1) return dp[i][j]; if (j - weight[i] < 0) re...
replace
6
8
6
8
0
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long int ll; #define all(x) x.begin(), x.end() const ll mod = 1e9 + 7; const ll INF = 1e9; const ll MAXN...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long int ll; #define all(x) x.begin(), x.end() const ll mod = 1e9 + 7; const ll INF = 1e9; const ll MAXN...
replace
31
32
31
32
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define int long long #define double long double #define endl "\n" const int INF = (int)1e9 + 9; const int maxn = (int)1e6 + 6; // const mod = (int) 1e9 + 7; using namespace std; signed main() { int N, W; cin >> N >> W; vector<int> v(N), w(N); vector<vector<int>> dp(N + 1, vector<int...
#include <bits/stdc++.h> #define int long long #define double long double #define endl "\n" const int INF = (int)1e9 + 9; const int maxn = (int)1e6 + 6; // const mod = (int) 1e9 + 7; using namespace std; signed main() { int N, W; cin >> N >> W; vector<int> v(N), w(N); vector<vector<int>> dp(N + 1, vector<int...
replace
22
23
22
23
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int N, W, w[100], v[100]; long long dp[109][10009]; int main() { cin >> N >> W; for (int i = 0; i < N; ++i) cin >> w[i] >> v[i]; for (int j = 0; j <= W; ++j) dp[0][j] = 0; for (int i = 0; i < N; ++i) { for (int j = 0; j <= W; ++j) { if (j + w[...
#include <bits/stdc++.h> using namespace std; int N, W, w[100], v[100]; long long dp[109][100009]; int main() { cin >> N >> W; for (int i = 0; i < N; ++i) cin >> w[i] >> v[i]; for (int j = 0; j <= W; ++j) dp[0][j] = 0; for (int i = 0; i < N; ++i) { for (int j = 0; j <= W; ++j) { if (j + w...
replace
5
6
5
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int maxn = 1e2 + 10; const int maxm = 1e5 + 10; typedef long long ll; int w[maxn], c[maxn]; ll dp[maxn]; void solve(int n, int m) { for (int i = 1; i <= n; i++) for (int j = m; j >= w[i]; j--) dp[j] = max(dp[j], dp[j - w[i]] + (ll)c[i]); } int main(v...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e2 + 10; const int maxm = 1e5 + 10; typedef long long ll; int w[maxn], c[maxn]; ll dp[maxm]; void solve(int n, int m) { for (int i = 1; i <= n; i++) for (int j = m; j >= w[i]; j--) dp[j] = max(dp[j], dp[j - w[i]] + (ll)c[i]); } int main(v...
replace
10
11
10
11
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define frst first #define sec second #define fast cin.tie(0), ios_base ::sync_with_stdio(0) #define db double #define mod 1000000007 void online_judge() { #ifndef ONLINE_JUDGE freopen("Input.txt", "r", stdin); freopen("Output.t...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define frst first #define sec second #define fast cin.tie(0), ios_base ::sync_with_stdio(0) #define db double #define mod 1000000007 void online_judge() { #ifndef ONLINE_JUDGE freopen("Input.txt", "r", stdin); freopen("Output.t...
replace
46
47
46
47
-11
p03163
C++
Runtime Error
#include <iostream> using namespace std; int main(int argc, const char *argv[]) { long long n, m; cin >> n >> m; long long arr[n][2]; for (long long i = 0; i < n; i++) { cin >> arr[i][0] >> arr[i][1]; } long long dp[n + 1][m + 1]; for (long long j = 0; j < m + 1; j++) { for (long long i = 0; i <...
#include <iostream> using namespace std; int main(int argc, const char *argv[]) { long long n, m; cin >> n >> m; long long arr[n][2]; for (long long i = 0; i < n; i++) { cin >> arr[i][0] >> arr[i][1]; } long long dp[n + 1][m + 1]; for (long long j = 0; j < m + 1; j++) { for (long long i = 0; i <...
replace
29
30
29
30
0
p03163
C++
Time Limit Exceeded
#ifndef bhartiya // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") // #pragma GCC target // ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #endif #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; // not that imp typedef pair<pll, ll> plll...
#ifndef bhartiya // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") // #pragma GCC target // ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #endif #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; // not that imp typedef pair<pll, ll> plll...
insert
70
70
70
71
TLE
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long int n, W1, w[100001] = {0}, j, temp, temp2, max1; cin >> n >> W1; for (int i = 0; i < W1; i++) { cin >> temp >> temp2; j = W1; while (j - temp >= 0) { if (w[j - temp]) { w[j] = max(w[j], w[j - temp] + temp2); } ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, W1, w[100001] = {0}, j, temp, temp2, max1; cin >> n >> W1; for (int i = 0; i < n; i++) { cin >> temp >> temp2; j = W1; while (j - temp >= 0) { if (w[j - temp]) { w[j] = max(w[j], w[j - temp] + temp2); } ...
replace
6
7
6
7
TLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long int res[103], i, j, a, b, n, x; int main() { cin >> n >> x; for (i = 0; i < n; i++) { scanf("%lld%lld", &a, &b); for (j = x - a; j >= 0; j--) res[j + a] = max(res[j + a], res[j] + b); } cout << res[x]; }
#include <bits/stdc++.h> using namespace std; long long int res[100001], i, j, a, b, n, x; int main() { cin >> n >> x; for (i = 0; i < n; i++) { scanf("%lld%lld", &a, &b); for (j = x - a; j >= 0; j--) res[j + a] = max(res[j + a], res[j] + b); } cout << res[x]; }
replace
2
3
2
3
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define int long long #define w(t) \ int t; \ cin >> t; \ while (t--) #define pb push_...
#include <bits/stdc++.h> #define int long long #define w(t) \ int t; \ cin >> t; \ while (t--) #define pb push_...
replace
30
31
30
31
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << '[' << #x << " is: " << x << "] " \ << "\n"; #define sor(v) sort(v.begin(), v.end()) #define rsor(v) sort(v.rbegin(), v.rend()) #define rev(v...
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << '[' << #x << " is: " << x << "] " \ << "\n"; #define sor(v) sort(v.begin(), v.end()) #define rsor(v) sort(v.rbegin(), v.rend()) #define rev(v...
replace
16
17
16
17
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << '[' << #x << " is: " << x << "] " \ << "\n"; #define sor(v) sort(v.begin(), v.end()) #define rsor(v) sort(v.rbegin(), v.rend()) #define rev(v...
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << '[' << #x << " is: " << x << "] " \ << "\n"; #define sor(v) sort(v.begin(), v.end()) #define rsor(v) sort(v.rbegin(), v.rend()) #define rev(v...
replace
16
17
16
17
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e2 + 5; const int MAXNN = 1e5 + 7; const int INF = 1e9 + 7; #define ll long long #define pb push_back #define endl '\n' #define fast_io \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e2 + 5; const int MAXNN = 1e5 + 7; const int INF = 1e9 + 7; #define ll long long #define pb push_back #define endl '\n' #define fast_io \ ios_base::sync_with_stdio(false); ...
replace
25
26
25
26
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-ffloat-store") #pragma GCC optimize("-fno-defer-pop") #define ll long long int #define ps push_back #define fs first #define sc second #define mkp make_pair #define mod 1000000007 ll a...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-ffloat-store") #pragma GCC optimize("-fno-defer-pop") #define ll long long int #define ps push_back #define fs first #define sc second #define mkp make_pair #define mod 1000000007 ll a...
delete
27
31
27
27
-11
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl; int n, W; ll w[100005], v[100005], memo[105][100005]; using namespace std; ll dp(int i, int free_weight) { if (memo[i][free_weight] != -1) { return memo[i][free_weight]; } if (i == n) { return 0; ...
#include <bits/stdc++.h> #define ll long long #define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl; int n, W; ll w[100005], v[100005], memo[105][100005]; using namespace std; ll dp(int i, int free_weight) { if (memo[i][free_weight] != -1) { return memo[i][free_weight]; } if (i == n) { return 0; ...
replace
17
18
17
18
TLE