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> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; const ll inf = 1LL << 60; const double eps = 1e-9; 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) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; const ll inf = 1LL << 60; const double eps = 1e-9; 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) { ...
replace
23
24
23
24
0
p03163
C++
Runtime Error
// This code is written by Shammi Anand #include <bits/stdc++.h> using namespace std; #define ll long long #define Max(a, b, c) max((a),max((b),(c)) #define Min(a, b, c) min(a, min(b, c)) #define pb push_back #define mp make_pair #define f first #define s second #define mod 1000000007 #define nl "\n" #define w(x)...
// This code is written by Shammi Anand #include <bits/stdc++.h> using namespace std; #define ll long long #define Max(a, b, c) max((a),max((b),(c)) #define Min(a, b, c) min(a, min(b, c)) #define pb push_back #define mp make_pair #define f first #define s second #define mod 1000000007 #define nl "\n" #define w(x)...
replace
18
21
18
21
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define pii pair<int, int> #define fi first #define se second #define int long long #define pb push_back #define mod 1000000007 #define pll pair<long long, long long> using namespace std; long long power(long long a, long long b) { long long ans = 1; while (b > 0) { if (b & 1) { a...
#include <bits/stdc++.h> #define pii pair<int, int> #define fi first #define se second #define int long long #define pb push_back #define mod 1000000007 #define pll pair<long long, long long> using namespace std; long long power(long long a, long long b) { long long ans = 1; while (b > 0) { if (b & 1) { a...
replace
27
28
27
28
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long knapsack(long long n, long long *w, long long *v, long long W) { long long dp[100][100]; memset(dp, 0, sizeof(dp)); for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= W; j++) { if (j - w[i - 1] >= 0) { dp[i][j] = max(v[i - 1] +...
#include <bits/stdc++.h> using namespace std; long long knapsack(long long n, long long *w, long long *v, long long W) { long long dp[n + 1][W + 1]; memset(dp, 0, sizeof(dp)); for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= W; j++) { if (j - w[i - 1] >= 0) { dp[i][j] = max(v[i - ...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; const double PI = 3.1415926535897932384626433832795; const int dx[] = {0, 1, 0, -1}; const int dy[] = {-1, 0, 1, 0}; int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); } ll gcd(ll x, ll y) { return y ? gcd(y, x % y)...
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; const double PI = 3.1415926535897932384626433832795; const int dx[] = {0, 1, 0, -1}; const int dy[] = {-1, 0, 1, 0}; int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); } ll gcd(ll x, ll y) { return y ? gcd(y, x % y)...
replace
21
23
21
23
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1000000000000000 template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } temp...
#include <bits/stdc++.h> #define REP(i, n) for (ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1000000000000000 template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } temp...
replace
37
38
37
38
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 101; const int maxw = 1e5 + 1; ll w[maxn], v[maxn], dp[4][9]; int main() { #ifdef LOCAL freopen("data.txt", "r", stdin); #endif ll n, W; scanf("%lld%lld", &n, &W); for (int i = 1; i <= n; ++i) scanf("%lld%lld", &w[i], &v[...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 101; const int maxw = 1e5 + 1; ll w[maxn], v[maxn], dp[maxn][maxw]; int main() { #ifdef LOCAL freopen("data.txt", "r", stdin); #endif ll n, W; scanf("%lld%lld", &n, &W); for (int i = 1; i <= n; ++i) scanf("%lld%lld", &w[i...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using Field = vector<vector<int>>; using Graph = vector<vector<int>>; using VI = vector<int>; using VC = vector<char>; using PI = pair<int, int>; #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(x) x.begin(), x.end() const long long INF ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Field = vector<vector<int>>; using Graph = vector<vector<int>>; using VI = vector<int>; using VC = vector<char>; using PI = pair<int, int>; #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(x) x.begin(), x.end() const long long INF ...
replace
36
37
36
37
0
p03163
C++
Memory Limit Exceeded
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #defin...
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #defin...
replace
34
35
34
35
MLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int using namespace std; #define mod 1000000007 #define pb push_back #define fi first #define si second #define mp make_pair #define f(n) for (ll i = 0; i < n; i++) #define ff(m) for (ll j = 0; j < m; j++) #define fr(i, p, n) for (ll i = p; i < n; i++) #define in insert ll ...
#include <bits/stdc++.h> #define ll long long int using namespace std; #define mod 1000000007 #define pb push_back #define fi first #define si second #define mp make_pair #define f(n) for (ll i = 0; i < n; i++) #define ff(m) for (ll j = 0; j < m; j++) #define fr(i, p, n) for (ll i = p; i < n; i++) #define in insert ll ...
replace
25
26
25
26
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MM 1000000000 #define MOD MM + 7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int, int> #define lPair pair<ll, ll> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) int dx[4] = {-1,...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MM 1000000000 #define MOD MM + 7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int, int> #define lPair pair<ll, ll> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) int dx[4] = {-1,...
replace
23
24
23
24
-11
p03163
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; /**** Type Define ****/ typedef long long ll; type...
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; /**** Type Define ****/ typedef long long ll; type...
replace
208
209
208
209
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define ub upper_bound #define lb lower_bound #define vi vector<int> #define sz(s) (int)s.size() #define pii pair<int, int> #define piii pair<int, pair<int, int>> #define tiii tuple<int, int, int> #define ff first #define ss s...
#include <bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define ub upper_bound #define lb lower_bound #define vi vector<int> #define sz(s) (int)s.size() #define pii pair<int, int> #define piii pair<int, pair<int, int>> #define tiii tuple<int, int, int> #define ff first #define ss s...
replace
35
38
35
38
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int int n, capc; int dp[102][10005]; int fill_knapsack(int i, int w, int val[], int wt[]) { if (i < 0) return 0; if (dp[i][w] != -1) return dp[i][w]; if (wt[i] > w) { dp[i][w] = fill_knapsack(i - 1, w, val, wt); } else { dp[i...
#include <bits/stdc++.h> using namespace std; #define int long long int int n, capc; int dp[102][100005]; int fill_knapsack(int i, int w, int val[], int wt[]) { if (i < 0) return 0; if (dp[i][w] != -1) return dp[i][w]; if (wt[i] > w) { dp[i][w] = fill_knapsack(i - 1, w, val, wt); } else { dp[...
replace
5
6
5
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll weights[105]; ll values[105]; ll knap[205][205]; bool isPrime(ll n) { // Corner cases if (n <= 1) return false; if (n <= 3) return true; // This is checked so that we can skip // middle five numbers in below loop if (n %...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll weights[105]; ll values[105]; ll knap[205][100005]; bool isPrime(ll n) { // Corner cases if (n <= 1) return false; if (n <= 3) return true; // This is checked so that we can skip // middle five numbers in below loop if (...
replace
8
9
8
9
0
p03163
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; long long wt[110]; long long val[110]; long long dp[110][110]; long long n, w; long long knapsack(long long wt[], long long val[], long long n, long long w) { if (n == 0 || w == 0) return 0; if (dp[n][w] != -1) return dp[n][w]; if (wt[n - 1] <= w...
#include <cstring> #include <iostream> using namespace std; long long wt[110]; long long val[110]; long long dp[101][100005]; long long n, w; long long knapsack(long long wt[], long long val[], long long n, long long w) { if (n == 0 || w == 0) return 0; if (dp[n][w] != -1) return dp[n][w]; if (wt[n - 1] <...
replace
5
6
5
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair bool comp(pair<int, int> a, pair<int, int> b) { return (a.first < b.first); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE // for getting input from input.txt freopen("...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair bool comp(pair<int, int> a, pair<int, int> b) { return (a.first < b.first); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); /*#ifndef ONLINE_JUDGE // for getting input from input.txt freopen("...
replace
13
19
13
19
-6
terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size()
p03163
C++
Runtime Error
/*author : Yashvardhan Saturday, January 12, 2019 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define pb push_back #define vi vector<int> #define pi pair<int, int> #define vpi vector<pi> #define ff first #define ss second #pragma comment(linker, "/stack:200000000") #pragma G...
/*author : Yashvardhan Saturday, January 12, 2019 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define pb push_back #define vi vector<int> #define pi pair<int, int> #define vpi vector<pi> #define ff first #define ss second #pragma comment(linker, "/stack:200000000") #pragma G...
replace
77
78
77
78
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, a) for (int i = 0; i < (a); i++) #define ALL(a) (a).begin(), (a).end() typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1e9 + 7; #define MAX_N 100 #define MAX_W 100000 ll dp[MAX_N][MAX_W]; signed main() { int N, W; c...
#include <bits/stdc++.h> using namespace std; #define REP(i, a) for (int i = 0; i < (a); i++) #define ALL(a) (a).begin(), (a).end() typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1e9 + 7; #define MAX_N 100 #define MAX_W 100000 ll dp[MAX_N + 1][MAX_W + 1]; signed main() { int N...
replace
12
13
12
13
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define in(a) \ ll a; \ cin >> a; #define in2(a, b) ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define in(a) \ ll a; \ cin >> a; #define in2(a, b) ...
replace
88
89
88
89
0
p03163
C++
Runtime Error
#include <iostream> using namespace std; using ll = long long; int N, Weight; ll w[101], v[101]; ll dp[101][10001]; int main() { cin >> N >> Weight; for (int i = 1; i <= N; ++i) cin >> w[i] >> v[i]; for (int i = 1; i <= N; ++i) for (int j = 1; j <= Weight; ++j) if (j >= w[i]) dp[i][j] = m...
#include <iostream> using namespace std; using ll = long long; int N, Weight; ll w[101], v[101]; ll dp[101][100001]; int main() { cin >> N >> Weight; for (int i = 1; i <= N; ++i) cin >> w[i] >> v[i]; for (int i = 1; i <= N; ++i) for (int j = 1; j <= Weight; ++j) if (j >= w[i]) dp[i][j] = ...
replace
7
8
7
8
0
p03163
C++
Runtime Error
#include <iostream> using namespace std; typedef long long ll; int n, t, wt[100 + 9]; ll ps[100 + 9]; ll dp[100 + 9][100 + 9]; int main() { scanf("%d%d", &n, &t); for (int i = 0; i < n; i++) scanf("%d%lld", &wt[i], &ps[i]); for (int i = wt[n - 1]; i <= t; i++) dp[n - 1][i] = ps[n - 1]; for (int i = n...
#include <iostream> using namespace std; typedef long long ll; int n, t, wt[100 + 9]; ll ps[100 + 9]; ll dp[100 + 9][100000 + 9]; int main() { scanf("%d%d", &n, &t); for (int i = 0; i < n; i++) scanf("%d%lld", &wt[i], &ps[i]); for (int i = wt[n - 1]; i <= t; i++) dp[n - 1][i] = ps[n - 1]; for (int i ...
replace
6
7
6
7
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; typedef pair<int, int> P; const int MAX_N = 105; const int MAX_W = 10005; ll w[MAX_N], v[MAX_N]; ll dp[MAX_N][MAX_W]; int main() { int N, W; cin >> N >> W; rep(i, N) { cin >> w[i] >> v[i]; } rep(i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const int MAX_N = 105; const int MAX_W = 100005; ll w[MAX_N], v[MAX_N]; ll dp[MAX_N][MAX_W]; int main() { int N, W; cin >> N >> W; rep(i, N) { cin >> w[i] >> v[i]; } rep(...
replace
6
7
6
7
0
p03163
C++
Runtime Error
// I SELL YOU...! #include <algorithm> #include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll dp[100][110000] = {}; signed main() { ll n, W, ans = 0; cin >> n >> W; ll w[n], v[n]; for (int i = 0; i < n; i++) { cin >>...
// I SELL YOU...! #include <algorithm> #include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll dp[110][110000] = {}; signed main() { ll n, W, ans = 0; cin >> n >> W; ll w[n], v[n]; for (int i = 0; i < n; i++) { cin >>...
replace
9
10
9
10
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++) #define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(), (a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<i...
#include <bits/stdc++.h> using namespace std; #define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++) #define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(), (a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<i...
replace
22
23
22
23
-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 <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define ll long long int #define skip cin >> ws; #define vll vector<ll> #define vb vector<bool> #define vpll vector<pair<ll, ll>> #defin...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define ll long long int #define skip cin >> ws; #define vll vector<ll> #define vb vector<bool> #define vpll vector<pair<ll, ll>> #defin...
replace
84
85
84
85
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define itf ios_base::sync_with_stdio(false) #define ll long long int #define ct cin.tie(NULL) ll Z[102][10007]; ll step(ll a[], ll v[], ll w, ll n) { if (n == 0) return 0; if (Z[n][w] != -1) return Z[n][w]; if (w >= a[n - 1]) return (Z[n][w] = max(v[...
#include <bits/stdc++.h> using namespace std; #define itf ios_base::sync_with_stdio(false) #define ll long long int #define ct cin.tie(NULL) ll Z[102][1000007]; ll step(ll a[], ll v[], ll w, ll n) { if (n == 0) return 0; if (Z[n][w] != -1) return Z[n][w]; if (w >= a[n - 1]) return (Z[n][w] = max(...
replace
7
8
7
8
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define MAXN 20000 using namespace std; long long n, W, w[MAXN], v[MAXN], dp[MAXN]; int main() { scanf("%lld%lld", &n, &W); for (int i = 0; i < n; i++) { scanf("%lld%lld", w + i, v + i); } for (int i = 0; i < n; i++) { for (int j = W; j >= w[i]; j--) { dp[j] = max(dp[j], d...
#include <bits/stdc++.h> #define MAXN 200000 using namespace std; long long n, W, w[MAXN], v[MAXN], dp[MAXN]; int main() { scanf("%lld%lld", &n, &W); for (int i = 0; i < n; i++) { scanf("%lld%lld", w + i, v + i); } for (int i = 0; i < n; i++) { for (int j = W; j >= w[i]; j--) { dp[j] = max(dp[j], ...
replace
1
2
1
2
0
p03163
C++
Runtime Error
#include <algorithm> #include <ctype.h> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <vector> #define ll long long using namespace std; void sol...
#include <algorithm> #include <ctype.h> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <vector> #define ll long long using namespace std; void sol...
replace
23
24
23
24
0
p03163
C++
Runtime Error
///"Bismillahir Rahmanir Raheem"/// #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<int, ll> pil; typedef vector<pii> vii; typedef vector<pil> vil; typedef vector<pli> vli; #d...
///"Bismillahir Rahmanir Raheem"/// #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<int, ll> pil; typedef vector<pii> vii; typedef vector<pil> vil; typedef vector<pli> vli; #d...
replace
41
43
41
43
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int main() { ll N, W; cin >> N >> W; ll wt[N]; ll val[N]; for (ll i = 0; i < N; i++) { cin >> wt[i] >> val[i]; } ll dp[W + 1][N + 1]; for (ll w = 0; w <= W; w++) { for (ll i = 0; i <= N; i++) { if (...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int main() { ll N, W; cin >> N >> W; ll wt[N]; ll val[N]; for (ll i = 0; i < N; i++) { cin >> wt[i] >> val[i]; } ll dp[W + 1][N + 1]; for (ll w = 0; w <= W; w++) { for (ll i = 0; i <= N; i++) { if (...
replace
27
28
27
28
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define MAX 10000000 using namespace std; int main() { ll n, W, w, v; cin >> n >> W; vector<pair<ll, ll>> knap; for (int i = 0; i < n; i++) { cin >> w >> v; knap.push_back({w, v}); } ll k[n + 1][W + 1]; for (int i = 0; i <= ...
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define MAX 10000000 using namespace std; int main() { ll n, W, w, v; cin >> n >> W; vector<pair<ll, ll>> knap; for (int i = 0; i < n; i++) { cin >> w >> v; knap.push_back({w, v}); } ll k[n + 1][W + 1]; for (int i = 0; i <= ...
replace
20
22
20
22
0
p03163
C++
Runtime Error
// #include <iostream> #include <queue> #include <stdio.h> #include <vector> // #include <algorithm> #define pb push_back #define boost \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
// #include <iostream> #include <queue> #include <stdio.h> #include <vector> // #include <algorithm> #define pb push_back #define boost \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
21
22
21
22
0
p03163
C++
Runtime Error
#include <iostream> #define min(a, b) ((a < b) ? a : b) #define max(a, b) ((a > b) ? a : b) #define ll long long int #define BIG 1e9 using namespace std; int main() { ll dp[200][200000] = {}, v[200], w[200], W, N, ans; cin >> N >> W; for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i ...
#include <iostream> #define min(a, b) ((a < b) ? a : b) #define max(a, b) ((a > b) ? a : b) #define ll long long int #define BIG 1e9 using namespace std; int main() { ll dp[101][100001] = {}, v[200], w[200], W, N, ans; cin >> N >> W; for (int i = 0; i < N; i++) { cin >> w[i] >> v[i]; } for (int i = 0; i ...
replace
8
9
8
9
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define pes first #define val second #define ll long long using namespace std; int const MMM = 105; int n, m; pair<ll, ll> arr[MMM]; ll dp[MMM]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 1; i <= n; i++) cin >> arr[i].first ...
#include <bits/stdc++.h> #define pes first #define val second #define ll long long using namespace std; int const MMM = 105; int n, m; pair<ll, ll> arr[MMM]; ll dp[100099]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 1; i <= n; i++) cin >> arr[i].fir...
replace
10
11
10
11
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, w, value[105] = {}, weight[105] = {}; long long dp[101][100002]; long long findSolution(int pos, int W) { if (pos < 0 || W < 0) { return 0; } if (weight[pos] > W) { long long x = findSolution(pos - 1, W); // cout << "phase 1: "<<x <<" "<< pos << " "...
#include <bits/stdc++.h> using namespace std; int n, w, value[105] = {}, weight[105] = {}; long long dp[101][100002]; long long findSolution(int pos, int W) { if (pos < 0 || W < 0) { return 0; } if (dp[pos][W] != 0) { return dp[pos][W]; } if (weight[pos] > W) { long long x = findSolution(pos - 1, ...
insert
7
7
7
10
TLE
p03163
C++
Runtime Error
// in progress #include <bits/stdc++.h> using namespace std; #define ll long long int #define fr(i, a, b) for (int i = (int)(a); i <= (int)(b); i++) #define forn(i, n) for (int i = 0; i < (int)(n); i++) #define rfr(i, a, b) for (int i = (int)(a); i >= (int)(b); i--) #define PI 3.14159265 ll n, w; ll a[1005][2], rec[105...
// in progress #include <bits/stdc++.h> using namespace std; #define ll long long int #define fr(i, a, b) for (int i = (int)(a); i <= (int)(b); i++) #define forn(i, n) for (int i = 0; i < (int)(n); i++) #define rfr(i, a, b) for (int i = (int)(a); i >= (int)(b); i--) #define PI 3.14159265 ll n, w; ll a[1005][2], rec[105...
replace
15
16
15
16
0
p03163
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n, lim; long long w[105], v[105], dp[105][1005]; cin >> n >> lim; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int i = 1; i <= lim; i++) { if (i < w[1]) dp[1][i] = 0; else dp[1][i] = v[1]; } for (int i = 2; i...
#include <iostream> using namespace std; int main() { int n, lim; long long w[105], v[105], dp[105][100005]; cin >> n >> lim; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int i = 1; i <= lim; i++) { if (i < w[1]) dp[1][i] = 0; else dp[1][i] = v[1]; } for (int i = 2;...
replace
4
5
4
5
0
p03163
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; struct item { long val; long weight; }; int compare(item left_item, item right_item) { return left_item.weight <= right_item.weight; } int main() { int N, W; cin >> N >> W; vector<vector<long long...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; struct item { long val; long weight; }; int compare(item left_item, item right_item) { return left_item.weight <= right_item.weight; } int main() { int N, W; cin >> N >> W; vector<vector<long long...
replace
36
37
36
37
0
p03163
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; typedef long long int ll; static const int MAX_N = 100; static const int MAX_W = 10000; int N, W; int w[MAX_N], v[MAX_N]; ll memo[MAX_N + 1][MAX_W + 1]; int main() { scanf("%d %d", &N, &W); for (int i = 0; i < N; i++) scanf("%d %d", &w[i], &v[i]); ...
#include <algorithm> #include <cstdio> using namespace std; typedef long long int ll; static const int MAX_N = 100; static const int MAX_W = 100000; int N, W; int w[MAX_N], v[MAX_N]; ll memo[MAX_N + 1][MAX_W + 1]; int main() { scanf("%d %d", &N, &W); for (int i = 0; i < N; i++) scanf("%d %d", &w[i], &v[i]); ...
replace
5
6
5
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define F first #define S second #define pb emplace_back #define pi pair<int, int> using namespace std; const int maxn = 1e2 + 4; int n, w; int W[maxn], V[maxn]; ll dp[maxn][10004]; int main() { cin >> n >> w; for (int i = 0; i < n; ++i) { ...
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define F first #define S second #define pb emplace_back #define pi pair<int, int> using namespace std; const int maxn = 1e2 + 4; int n, w; int W[maxn], V[maxn]; ll dp[maxn][100004]; int main() { cin >> n >> w; for (int i = 0; i < n; ++i) { ...
replace
12
13
12
13
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
62
63
62
63
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define pb push_b...
#include <bits/stdc++.h> using namespace std; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define pb push_b...
replace
59
60
59
60
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long struct node { ll val, wt; }; int cmp(node a, node b) { return a.wt < b.wt; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // ONL...
#include <bits/stdc++.h> using namespace std; #define ll long long struct node { ll val, wt; }; int cmp(node a, node b) { return a.wt < b.wt; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n, w; cin >> n >> w; node arr[n + 1]; for (int i = 1; i <= n; i++) cin >> arr[i].wt >> arr[i...
replace
10
14
10
11
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int dp[123][123]; 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 = 1; i <= N; i++) { for (int j = 1; j <= W; j++) { if (wt[i - 1] <= j) { ...
#include <bits/stdc++.h> using namespace std; #define int long long int dp[123][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 = 1; i <= N; i++) { for (int j = 1; j <= W; j++) { if (wt[i - 1] <= j) { ...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; using ll = long long; const int INF = 1e9 + 5; void max_self(ll &a, ll b) { a = max(a, b); } int main() { ll N, W; cin >> N >> W; vector<ll> dp(W + 1); ...
#include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; using ll = long long; const int INF = 1e9 + 5; void max_self(ll &a, ll b) { a = max(a, b); } int main() { ll N, W; cin >> N >> W; vector<ll> dp(W + 1); ...
replace
22
23
22
24
0
p03163
C++
Runtime Error
/* tarun360 IIT Indore */ #include <bits/stdc++.h> using namespace std; #define ll long long #define ll_s long #define mod 1000000007 #define forn(i, start, lim) for (ll i = start; i < lim; i++) #define forn_d(i, start, lim) for (ll i = start; i >= lim; i--) #define forn_s(i, start, lim) for (ll_s i = start; i < lim; i...
/* tarun360 IIT Indore */ #include <bits/stdc++.h> using namespace std; #define ll long long #define ll_s long #define mod 1000000007 #define forn(i, start, lim) for (ll i = start; i < lim; i++) #define forn_d(i, start, lim) for (ll i = start; i >= lim; i--) #define forn_s(i, start, lim) for (ll_s i = start; i < lim; i...
replace
22
23
22
23
0
p03163
C++
Runtime Error
// Program.cpp // Author : Aaryan Srivastava #include <bits/stdc++.h> #include <chrono> #include <random> #define pb push_back #define popb pop_back #define ull unsigned long long #define beg begin #define mp make_pair #define pii pair<int, int> #define piii pair<pii, int> #define rep(i, n) for (int(i) = 0; i < (n); i+...
// Program.cpp // Author : Aaryan Srivastava #include <bits/stdc++.h> #include <chrono> #include <random> #define pb push_back #define popb pop_back #define ull unsigned long long #define beg begin #define mp make_pair #define pii pair<int, int> #define piii pair<pii, int> #define rep(i, n) for (int(i) = 0; i < (n); i+...
replace
50
51
50
51
0
p03163
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cstdlib> #include <ext/pb_ds/assoc_container.hpp> #include <iostream> #include <map> #include <math.h> #include <random> #include <set> #include <stdio.h> #include <vector> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less_equal<int>, r...
#include <algorithm> #include <bitset> #include <cstdlib> #include <ext/pb_ds/assoc_container.hpp> #include <iostream> #include <map> #include <math.h> #include <random> #include <set> #include <stdio.h> #include <vector> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less_equal<int>, r...
replace
26
27
26
27
0
p03163
C++
Time Limit Exceeded
// By Zank100 #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define mod 1000000007 #define din(t) \ long long t; \ cin >> t; #define in(...
// By Zank100 #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define mod 1000000007 #define din(t) \ long long t; \ cin >> t; #define in(...
replace
29
30
29
42
TLE
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define fly \ ios::sync_with_stdio(false); \ cin.tie(nullptr); \ cout.tie(nullptr) #define ll long long const ll mo...
#include <bits/stdc++.h> #define fly \ ios::sync_with_stdio(false); \ cin.tie(nullptr); \ cout.tie(nullptr) #define ll long long const ll mo...
replace
14
16
14
16
-6
free(): invalid pointer
p03163
C++
Time Limit Exceeded
/* ALLAH is Almighty.... */ #include <bits/stdc++.h> #define ll long long using namespace std; const ll mx = 10e5 + 9; ll n, k, weight; ll w[mx], v[mx]; ll dp[101][mx]; ll calculation(ll item, ll need) { if (dp[item][weight] != -1) return dp[item][weight]; if (item == n) return 0; ll t1, t2; t1 = ...
/* ALLAH is Almighty.... */ #include <bits/stdc++.h> #define ll long long using namespace std; const ll mx = 10e5 + 9; ll n, k, weight; ll w[mx], v[mx]; ll dp[101][mx]; ll calculation(ll item, ll need) { if (dp[item][need] != -1) return dp[item][need]; if (item == n) return 0; ll t1, t2; t1 = t2 =...
replace
14
16
14
16
TLE
p03163
C++
Runtime Error
#include <algorithm> #include <iostream> int n, w; long long arr[10005]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(NULL); std::cin >> n >> w; for (int i = 0; i < n; i++) { long long a, b; std::cin >> a >> b; for (int j = w; j > a - 1; j--) arr[j] = std::max(arr[j], arr[j ...
#include <algorithm> #include <iostream> int n, w; long long arr[100005]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(NULL); std::cin >> n >> w; for (int i = 0; i < n; i++) { long long a, b; std::cin >> a >> b; for (int j = w; j > a - 1; j--) arr[j] = std::max(arr[j], arr[j...
replace
5
6
5
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; int n, w; long long ans[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); // freopen("in.in" , "r" , stdin) ; cin >> n >> w; for (int i = 1; i < N; i++) { ans[i] = -1e9; } for (int i = 0; i < n; i++) { int a, b; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; int n, w; long long ans[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); // freopen("in.in" , "r" , stdin) ; cin >> n >> w; for (int i = 1; i < N; i++) { ans[i] = -1e9; } for (int i = 0; i < n; i++) { int a, b; ...
replace
24
25
24
25
0
p03163
C++
Runtime Error
#include <cstdio> #define ll long long #define max(a, b) (a > b ? a : b) #define maxn 10050 using namespace std; ll dp[maxn]; int main() { int n, W; scanf("%d%d", &n, &W); for (int i = 1; i <= n; i++) { int a, b; scanf("%d%d", &a, &b); for (int j = W; j >= a; j--) dp[j] = max(dp[j - a] + b, dp[j...
#include <cstdio> #define ll long long #define max(a, b) (a > b ? a : b) #define maxn 100050 using namespace std; ll dp[maxn]; int main() { int n, W; scanf("%d%d", &n, &W); for (int i = 1; i <= n; i++) { int a, b; scanf("%d%d", &a, &b); for (int j = W; j >= a; j--) dp[j] = max(dp[j - a] + b, dp[...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; int v[101], w[101]; ll dp[102][10002]; int main() { int N, W; cin >> N >> W; for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; for (int i = 0; i < N; ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; int v[101], w[101]; ll dp[102][100002]; int main() { int N, W; cin >> N >> W; for (int i = 0; i < N; i++) cin >> w[i] >> v[i]; for (int i = 0; i < N;...
replace
11
12
11
12
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <fstream> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define ll long long int N; vector<int> v(101), w(101); vector<vector<ll>> dp(101, vector<ll>(101, -1)); // i番目以降の品物から...
#include <bits/stdc++.h> #include <fstream> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define ll long long int N; vector<int> v(101), w(101); vector<vector<ll>> dp(101, vector<ll>(1000001, -1)); // i番目以降の...
replace
10
11
10
11
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define lli long long int #define fr(i, j, p) for (int i = j; i < p; i++) #define frr(i, j, p) for (int i = j; i >= p; i--) #define PI 3.14159265358979323846 #define pb push_back #define pbk pop_back() #define mkp make_pair #define print(m) std::cout << std::fixed << std::s...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define fr(i, j, p) for (int i = j; i < p; i++) #define frr(i, j, p) for (int i = j; i >= p; i--) #define PI 3.14159265358979323846 #define pb push_back #define pbk pop_back() #define mkp make_pair #define print(m) std::cout << std::fixed << std::s...
replace
16
23
16
28
TLE
p03163
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; signed main() { int n, w; cin >> n >> w; vector<int> x(n, 0), v(n, 0); for (int i = 1; i <= n; i++) cin >> x[i] >> v[i]; vector<vector<long long>> f(n + 1, vector<long long>(w * 2 + 5, 0)); for (int i = 1; i <= n; i++) { for (int j = 0; j <...
#include <iostream> #include <vector> using namespace std; signed main() { int n, w; cin >> n >> w; vector<int> x(n + 1, 0), v(n + 1, 0); for (int i = 1; i <= n; i++) cin >> x[i] >> v[i]; vector<vector<long long>> f(n + 1, vector<long long>(w * 2 + 5, 0)); for (int i = 1; i <= n; i++) { for (int j ...
replace
7
8
7
8
0
p03163
C++
Runtime Error
#include <fstream> #include <iostream> long long n, S, w[1000], v[1000], F[100][100000]; using namespace std; int main() { // freopen("KNAPSACK1.INP","r",stdin); cin >> n >> S; for (long long i = 1; i <= n; i++) cin >> w[i] >> v[i]; for (long long i = 1; i <= n; i++) for (long long j = 1; j <= S; j++) ...
#include <fstream> #include <iostream> long long n, S, w[1000], v[1000], F[101][100001]; using namespace std; int main() { // freopen("KNAPSACK1.INP","r",stdin); cin >> n >> S; for (long long i = 1; i <= n; i++) cin >> w[i] >> v[i]; for (long long i = 1; i <= n; i++) for (long long j = 1; j <= S; j++) ...
replace
2
3
2
3
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; int N, W, weight[104]; long long value[104]; long long dp[104][10005]; long long solve(int i, int w) { if (i >= N) { return 0; } if (dp[i][w] != -1) { return dp[i][w]; } long long X = solve(i + 1, w); int nw = w - weight[i]; if ...
#include <bits/stdc++.h> #include <iostream> using namespace std; int N, W, weight[104]; long long value[104]; long long dp[104][100005]; long long solve(int i, int w) { if (i >= N) { return 0; } if (dp[i][w] != -1) { return dp[i][w]; } long long X = solve(i + 1, w); int nw = w - weight[i]; if...
replace
6
7
6
7
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define ff first #define ss second #define P pair<int, int> #define pb push_back #define mod 1000000007 #define inf 1e18 #define endl '\n' const int N = 105; // change it when needed const int W = 1e5; int a[N], b[N]; int dp[...
#include <bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define ff first #define ss second #define P pair<int, int> #define pb push_back #define mod 1000000007 #define inf 1e18 #define endl '\n' const int N = 105; // change it when needed const int W = 1e5; int a[N], b[N]; int dp[...
replace
14
15
14
15
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; int v[105], w[100005]; long long dp[105] = {0}; long long knapsack(int n, int W) { int i, j; for (i = 0; i < n; i++) { for (j = W; j >= w[i]; j--) dp[j] = max(dp[j], dp[j - w[i]] + v[i]); } return dp[W]; } int main() { int i, n, W; ...
#include <bits/stdc++.h> #include <iostream> using namespace std; int v[105], w[100005]; long long dp[100005] = {0}; long long knapsack(int n, int W) { int i, j; for (i = 0; i < n; i++) { for (j = W; j >= w[i]; j--) dp[j] = max(dp[j], dp[j - w[i]] + v[i]); } return dp[W]; } int main() { int i, n, W;...
replace
4
5
4
5
0
p03163
C++
Runtime Error
// author: Harsh Nema #include <bits/stdc++.h> #define ll long long int #define F first #define S second const ll mod = 1e9 + 7; const ll INF = 10000000000000; #define pb push_back #define deb(x) cout << '>' << #x << ':' << x << endl; #define fastio \ i...
// author: Harsh Nema #include <bits/stdc++.h> #define ll long long int #define F first #define S second const ll mod = 1e9 + 7; const ll INF = 10000000000000; #define pb push_back #define deb(x) cout << '>' << #x << ':' << x << endl; #define fastio \ i...
replace
15
19
15
19
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define int long long typedef long double ld;...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define int long long typedef long double ld;...
replace
34
41
34
41
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, we; ll w[101], v[101]; ll memo[101][100001]; ll findans(ll i, ll n, ll sum) { if (i == n) { if (sum <= we) { return 0; } else { return -1000000000000000; } } /*if(i==n-1) { if(sum+w[i]<=we) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, we; ll w[101], v[101]; ll memo[101][100001]; ll findans(ll i, ll n, ll sum) { if (i == n) { if (sum <= we) { return 0; } else { return -1000000000000000; } } /*if(i==n-1) { if(sum+w[i]<=we) { ...
replace
29
30
29
33
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int mxN = 100; int wt[mxN], v[mxN], n, W; long long dp[mxN + 1][mxN + 1]; array<int, 3> s[mxN]; int main() { cin >> n >> W; for (int i = 0; i < n; ++i) { cin >> wt[i] >> v[i]; } for (int i = 0; i < n + 1; i++) { for (int w = 0; w <= W; ++w) { ...
#include <bits/stdc++.h> using namespace std; const int mxN = 100, mxW = 1e5; long long wt[mxN], v[mxN], n, W; long long dp[mxN + 1][mxW + 1]; int main() { cin >> n >> W; for (int i = 0; i < n; ++i) { cin >> wt[i] >> v[i]; } for (int i = 0; i < n + 1; i++) { for (int w = 0; w <= W; ++w) { if (i...
replace
3
7
3
6
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) FOR(i, 0, b) #define INF mugen #define dump(x) cerr << #x << "=" << x << endl #define all(a) (a).begin(), (a).end() typedef vector<int> vi; typedef vector<vi> vii; typedef vector<vii> viii; typedef pair<int,...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) FOR(i, 0, b) #define INF mugen #define dump(x) cerr << #x << "=" << x << endl #define all(a) (a).begin(), (a).end() typedef vector<int> vi; typedef vector<vi> vii; typedef vector<vii> viii; typedef pair<int,...
replace
38
39
38
39
TLE
p03163
C++
Runtime Error
/* """Bismillahir Rahmanur Rahim""" */ #include <bits/stdc++.h> using namespace std; #define pi 2 * acos(0.0) #define ll long long int #define pb push_back #define pf push_front const ll sz = 1000001; #define ek(x) __builtin_popcount(x) #define ses '\n' #define stm istringstream #define sob(x) x.beg...
/* """Bismillahir Rahmanur Rahim""" */ #include <bits/stdc++.h> using namespace std; #define pi 2 * acos(0.0) #define ll long long int #define pb push_back #define pf push_front const ll sz = 1000001; #define ek(x) __builtin_popcount(x) #define ses '\n' #define stm istringstream #define sob(x) x.beg...
replace
29
30
29
30
0
p03163
C++
Runtime Error
#include <cmath> #include <cstring> #include <iostream> #include <string> #include <vector> #define ll long long using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
#include <cmath> #include <cstring> #include <iostream> #include <string> #include <vector> #define ll long long using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
replace
39
40
39
41
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll knapsack(vector<ll> &val, vector<ll> &wt, ll W, ll n, vector<vector<ll>> &dp) { if (n == 0 || W == 0) return dp[n][W] = 0; if (dp[n][W] != -1) return dp[n][W]; if (wt[n - 1] <= W) return dp[n][W] = max(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll knapsack(vector<ll> &val, vector<ll> &wt, ll W, ll n, vector<vector<ll>> &dp) { if (n == 0 || W == 0) return dp[n][W] = 0; if (dp[n][W] != -1) return dp[n][W]; if (wt[n - 1] <= W) return dp[n][W] = max(...
replace
26
27
26
27
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define N 102 #define M 100005 #define ll long long #define ld long double #define pb push_back #define ff first #define ss second ll dp[N][M]; ll v[N], w[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #ifndef ONLINE_...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define N 102 #define M 100005 #define ll long long #define ld long double #define pb push_back #define ff first #define ss second ll dp[N][M]; ll v[N], w[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, W; ci...
delete
20
24
20
20
TLE
p03163
C++
Runtime Error
/** WARNING This Code Sucks Just Like My Life :( **/ #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // #pragma comment(linker, "/STACK:1024000000,1024000000") #include <bits/stdc++.h> #...
/** WARNING This Code Sucks Just Like My Life :( **/ #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // #pragma comment(linker, "/STACK:1024000000,1024000000") #include <bits/stdc++.h> #...
replace
24
26
24
26
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long int n, w; cin >> n >> w; long long int a[n + 1][2]; for (int i = 1; i <= n; i++) cin >> a[i][0] >> a[i][1]; vector<long long int> dp; for (int i = 1; i <= n; i++) { for (int j = w - a[i][0]; j > 0; j -= 1) { dp[j + a[i][0]] =...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, w; cin >> n >> w; long long int wi, va; vector<long long int> dp(w + 1); for (long long int i = 1; i <= n; i++) { cin >> wi >> va; for (long long int j = w - wi; j >= 0; j -= 1) { dp[j + wi] = max(dp[j + wi], va + dp[j])...
replace
5
12
5
11
-11
p03163
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; const int N = 105; long long dp[N][N]; int main() { long long n, W, v[N], w[N]; cin >> n >> W; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= W; ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; const int N = 105; long long dp[N][100005]; int main() { long long n, W, v[N], w[N]; cin >> n >> W; for (int i = 1; i <= n; i++) { cin >> w[i] >> v[i]; } for (int i = 1; i <= n; i++) { for (int j = 1; j <...
replace
6
7
6
7
0
p03163
C++
Runtime Error
/* Author - linpaws07 */ #include <bits/stdc++.h> using namespace std; using namespace std::chrono; #define mod 1000000007 #define mp make_pair #define pb push_back #define inf (int)1e9 #define f first #define s second #define eps 1e-9 #define PI 3.1415926535897932384626433832795 #define scd(t) scanf("%d", &t) #def...
/* Author - linpaws07 */ #include <bits/stdc++.h> using namespace std; using namespace std::chrono; #define mod 1000000007 #define mp make_pair #define pb push_back #define inf (int)1e9 #define f first #define s second #define eps 1e-9 #define PI 3.1415926535897932384626433832795 #define scd(t) scanf("%d", &t) #def...
replace
58
59
58
59
0
p03163
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; #define PI 3.14159265358979 typedef long long int ll; int main() { int dp[101][10000000] = {}; ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; #define PI 3.14159265358979 typedef long long int ll; int main() { long long int dp[110][100010] ...
replace
16
17
16
17
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define Ull unsigned long long #define pb push_back #define INF 2e16 #define PI acos(-1.0) #define mk make_pair #define pii pair<int, int> #define pll pair<ll, ll> #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) #define ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define Ull unsigned long long #define pb push_back #define INF 2e16 #define PI acos(-1.0) #define mk make_pair #define pii pair<int, int> #define pll pair<ll, ll> #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) #define ...
replace
47
48
47
48
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { ll n, W; cin >> n >> W; ll w[n], v[n]; for (ll i = 0; i < n; i++) cin >> w[i] >> v[i]; ll dp[n + 1][n + 1]; for (ll i = 0; i <= n; i++) for (ll j = 0; j <= W; j++) { if (i == 0 || j == 0)...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 int main() { ll n, W; cin >> n >> W; ll w[n], v[n]; for (ll i = 0; i < n; i++) cin >> w[i] >> v[i]; ll dp[n + 1][W + 1]; for (ll i = 0; i <= n; i++) for (ll j = 0; j <= W; j++) { if (i == 0 || j == 0)...
replace
12
13
12
13
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vec; #define vecc vector<vector<ll>> #define LM LLONG_MAX #define int long long int #define P pair<ll, ll> #define ff first #define ss second #define FAST ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vec; #define vecc vector<vector<ll>> #define LM LLONG_MAX #define int long long int #define P pair<ll, ll> #define ff first #define ss second #define FAST ...
replace
28
29
28
29
-11
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long int ull; #define endl "\n" #define pb push_back #define sq(a) (a) * (a) #define debug(x) cerr << #x << '=' << (x) << endl; #define debugv(v) \ cerr << #v << " : ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long int ull; #define endl "\n" #define pb push_back #define sq(a) (a) * (a) #define debug(x) cerr << #x << '=' << (x) << endl; #define debugv(v) \ cerr << #v << " : ...
replace
61
62
61
62
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.14159265359 #define INF 1000100100 #define all(x) (x).begin(), (x).end() typedef long long ll; using namespace std; int main() { int n, w; cin >> n >> w; int wv[n][2]; rep(i, n) cin >> wv[i][0] >> wv[i][1]; ll dp[w + 1]; re...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.14159265359 #define INF 1000100100 #define all(x) (x).begin(), (x).end() typedef long long ll; using namespace std; int main() { int n, w; cin >> n >> w; ll wv[n][2]; rep(i, n) cin >> wv[i][0] >> wv[i][1]; ll dp[w + 1]; rep...
replace
11
12
11
12
-11
p03163
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define bogo_sort std::sort #define bozo_sort std::stable_sort #define alles(obj) ...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define bogo_sort std::sort #define bozo_sort std::stable_sort #define alles(obj) ...
replace
83
84
83
85
TLE
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define bogo_sort std::sort #define bozo_sort std::stable_sort #d...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define bogo_sort std::sort #define bozo_sort std::stable_sort #d...
insert
79
79
79
81
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define clr(i, j) memset(i, j, sizeof(i)) #define pb push_back #define PI acos(-1) #define MOD ((int)1e9 + 7) typedef long long ll; const int mx = 1e9 + 5; ll dp[100][100009]; // dp[i][w] aktr value ttgab b awl i elements w el weight bt3ha w int main() { ll n, w; cin >...
#include <bits/stdc++.h> using namespace std; #define clr(i, j) memset(i, j, sizeof(i)) #define pb push_back #define PI acos(-1) #define MOD ((int)1e9 + 7) typedef long long ll; const int mx = 1e9 + 5; ll dp[107][100009]; // dp[i][w] aktr value ttgab b awl i elements w el weight bt3ha w int main() { ll n, w; cin >...
replace
9
10
9
10
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll N, W, w[1000], v[1000], dp[100][100005]; ll fun(ll i, ll tw) { if (tw > W || i > N + 1) return -1000000000000000000; if (i == N + 1) return 0; if (dp[i][tw] != -1) return dp[i][tw]; else dp[i][tw] = max(fun(i + 1, tw), v[...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll N, W, w[1000], v[1000], dp[105][100005]; ll fun(ll i, ll tw) { if (tw > W || i > N + 1) return -1000000000000000000; if (i == N + 1) return 0; if (dp[i][tw] != -1) return dp[i][tw]; else dp[i][tw] = max(fun(i + 1, tw), v[...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; long long dp[100][100000]; int main() { int n, w; scanf("%d%d", &n, &w); for (int i = 1, wi, vi; i <= n; ++i) { scanf("%d%d", &wi, &vi); for (int j = 1; j <= w; ++j) if (wi <= j) dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - wi] + vi)...
#include <algorithm> #include <cstdio> using namespace std; long long dp[101][100001]; int main() { int n, w; scanf("%d%d", &n, &w); for (int i = 1, wi, vi; i <= n; ++i) { scanf("%d%d", &wi, &vi); for (int j = 1; j <= w; ++j) if (wi <= j) dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - wi] + vi)...
replace
4
5
4
5
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int number, w; long long dp[100100]; int main() { cin >> number >> w; for (int i = 1; i <= number; i++) { int weight, value; cin >> weight >> value; for (int j = w - weight; j >= 0; j--) dp[j + w] = max(dp[j + w], dp[j] + value); } cout << dp[w] <<...
#include <bits/stdc++.h> using namespace std; int number, w; long long dp[100100]; int main() { cin >> number >> w; for (int i = 1; i <= number; i++) { int weight, value; cin >> weight >> value; for (int j = w - weight; j >= 0; j--) dp[j + weight] = max(dp[j + weight], dp[j] + value); } cout <...
replace
10
11
10
11
0
p03163
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) const ll mod = 1e9 + 7; c...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) const ll mod = 1e9 + 7; c...
replace
19
21
19
21
TLE
p03163
C++
Runtime Error
// #define DEB1 //input from input.txt // #define NDEBUG #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <mutex> #include <queue> #include <set> #include <stack> #include <s...
// #define DEB1 //input from input.txt // #define NDEBUG #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <mutex> #include <queue> #include <set> #include <stack> #include <s...
insert
101
101
101
105
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vvi = vector<vector<int>>; using vvl = vector<vector<ll>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int INF = 1001001001; int main() { int n, W; cin >> n >> W; vector<int> w(n); vector<ll> v(n)...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vvi = vector<vector<int>>; using vvl = vector<vector<ll>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int INF = 1001001001; int main() { int n, W; cin >> n >> W; vector<int> w(n); vector<ll> v(n)...
replace
16
17
16
17
0
p03163
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <string> #include <vector> using namespace std; #define p(s) std::cout << s << endl; #define printIf(j, s1, s2) cout << (j ? s1 : s2) << endl; #define YES(j) cout << (j ? "YES" : "NO") << endl; #def...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <string> #include <vector> using namespace std; #define p(s) std::cout << s << endl; #define printIf(j, s1, s2) cout << (j ? s1 : s2) << endl; #define YES(j) cout << (j ? "YES" : "NO") << endl; #def...
replace
17
18
17
18
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; ll dp[100][(uint)1e5 + 1]; int main() { int n, W; cin >> n >> W; int w[100]; ll v[100]; for (int i = 0; i < n; i++) cin >> w[i] >> v[i]; for (int i = 0; i < n; i++) { for (int j = 1; j <= W; j++) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; ll dp[101][(uint)1e5 + 1]; int main() { int n, W; cin >> n >> W; int w[100]; ll v[100]; for (int i = 0; i < n; i++) cin >> w[i] >> v[i]; for (int i = 0; i < n; i++) { for (int j = 1; j <= W; j++) { ...
replace
5
6
5
6
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define vi vector<int> #define vvi vector<vi> #define forr(i, k, n) for (int i = k; i < n; i++) #define iforr(i, k, n) for (int i = n - 1; i >= k; i--) #define rep(i, n) forr(i, 0, n) #define irep(i, n) iforr(i, 0, n) #define aut(i, arr) for (auto &i : arr) #define all(arr) arr.begin(), arr.end...
#include <bits/stdc++.h> #define vi vector<int> #define vvi vector<vi> #define forr(i, k, n) for (int i = k; i < n; i++) #define iforr(i, k, n) for (int i = n - 1; i >= k; i--) #define rep(i, n) forr(i, 0, n) #define irep(i, n) iforr(i, 0, n) #define aut(i, arr) for (auto &i : arr) #define all(arr) arr.begin(), arr.end...
replace
37
38
37
38
-6
terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size()
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 100005 using namespace std; typedef long long ll; ll n, k, v[N], w[N], dp[105][N]; ll f(ll kal, ll x) { ll &r = dp[kal][x]; if (r != -1) return r; if (x == n + 1) return 0; r = f(kal, x + 1);...
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 100005 using namespace std; typedef long long ll; ll n, k, v[N], w[N], dp[N][105]; ll f(ll kal, ll x) { ll &r = dp[kal][x]; if (r != -1) return r; if (x == n + 1) return 0; r = f(kal, x + 1);...
replace
8
9
8
9
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n, W; cin >> n >> W; int *dp = new int[W + 1]; for (int i = 1; i <= n; i++) { int weight, value; cin >> weight >> value; for (int j = W; j >= 0; j--) { dp[j + weight] = max(dp[j] + value, dp[j + weight]); ...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n, W; cin >> n >> W; int *dp = new int[W + 1]; for (int i = 1; i <= n; i++) { int weight, value; cin >> weight >> value; for (int j = W; j >= weight; j--) { dp[j] = max(dp[j - weight] + value, dp[j]); ...
replace
10
12
10
12
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int ll dp[101][10005] = {0}; ll knapsack(ll a[][2], ll i, ll w, ll n) { if (w <= 0) return 0; if (i == n) return 0; if (dp[i][w] != 0) return dp[i][w]; ll op1 = INT_MIN; if (w - a[i][0] >= 0) op1 = a[i][1] + knapsack(a, i + 1,...
#include <bits/stdc++.h> using namespace std; #define ll long long int ll dp[101][100005] = {0}; ll knapsack(ll a[][2], ll i, ll w, ll n) { if (w <= 0) return 0; if (i == n) return 0; if (dp[i][w] != 0) return dp[i][w]; ll op1 = INT_MIN; if (w - a[i][0] >= 0) op1 = a[i][1] + knapsack(a, i + 1...
replace
3
4
3
4
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define DEBUG(x) cout << #x << " = " << (x) << endl; #define SORT(x) sort(ALL(x)); #define RSORT(x) sort(RALL(x)); #define SUM(x) accumulate(ALL(x), 0); using namespace...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define DEBUG(x) cout << #x << " = " << (x) << endl; #define SORT(x) sort(ALL(x)); #define RSORT(x) sort(RALL(x)); #define SUM(x) accumulate(ALL(x), 0); using namespace...
replace
24
25
24
25
0
p03163
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; using namespace std; ll dp[101][101010]; int main() { int N, W; cin >> N >> W; vector<ll> w(N), v(N); rep(i, N) cin >> w[i + 1] >> v[i + 1]; for (int i = 1; i <= N; ++i) { fo...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; using namespace std; ll dp[101][101010]; int main() { int N, W; cin >> N >> W; vector<ll> w(N + 1), v(N + 1); rep(i, N) cin >> w[i + 1] >> v[i + 1]; for (int i = 1; i <= N; ++i) ...
replace
11
12
11
12
-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> using namespace std; typedef long long ll; const int N = 100, W = 1e5 + 1; ll dp[N][W]; ll v[N], w[N]; ll n, cap; ll rec(int i, ll rem) { if (i > n) { return 0; } ll &ret = dp[i][rem]; if (ret != -1) { return ret; } ret = max(ret, rec(i + 1, rem)); if (w[i] <= rem) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 101, W = 1e5 + 1; ll dp[N][W]; ll v[N], w[N]; ll n, cap; ll rec(int i, ll rem) { if (i > n) { return 0; } ll &ret = dp[i][rem]; if (ret != -1) { return ret; } ret = max(ret, rec(i + 1, rem)); if (w[i] <= rem) { ...
replace
4
5
4
5
0