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 int ll;
ll wt[102], val[102];
ll dp[100][100001];
ll func(ll n, ll w) {
if (dp[n][w] != -1)
return dp[n][w];
if (w >= wt[n])
dp[n][w] = max(func(n - 1, w), func(n - 1, w - wt[n]) + val[n]);
else
dp[n][w] = func(n - 1, w);
return dp[n... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll wt[102], val[102];
ll dp[102][100001];
ll func(ll n, ll w) {
if (dp[n][w] != -1)
return dp[n][w];
if (w >= wt[n])
dp[n][w] = max(func(n - 1, w), func(n - 1, w - wt[n]) + val[n]);
else
dp[n][w] = func(n - 1, w);
return dp[n... | replace | 6 | 7 | 6 | 7 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
int w[10500], v[105];
long long dp[105][10500];
using namespace std;
int main() {
int N, W;
scanf("%d%d", &N, &W);
for (int i = 0; i < N; i++)
scanf("%d%d", &w[i], &v[i]);
for (int i = N - 1; i >= 0; i--) {
for (int j = 0; j <= W; j++) {
if (j < w[i]) {
dp[i][j] =... | #include <bits/stdc++.h>
int w[105], v[105];
long long dp[105][105000];
using namespace std;
int main() {
int N, W;
scanf("%d%d", &N, &W);
for (int i = 0; i < N; i++)
scanf("%d%d", &w[i], &v[i]);
for (int i = N - 1; i >= 0; i--) {
for (int j = 0; j <= W; j++) {
if (j < w[i]) {
dp[i][j] = ... | replace | 2 | 4 | 2 | 4 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int64_t dp[101][10001];
int main() {
int N, W, w[100], v[100];
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 = 0; j <= W; j++) {
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
if (j + w[i]... | #include <bits/stdc++.h>
using namespace std;
int64_t dp[101][100001];
int main() {
int N, W, w[100], v[100];
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 = 0; j <= W; j++) {
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
if (j + w[i... | replace | 3 | 4 | 3 | 4 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int ll
#define D(x) cout << "D: " << #x << '=' << x << endl;
#define R(x, l) \
cout << "R: Array " << #x << endl; \
for (int i = 0; i < l; i++) ... | #include <bits/stdc++.h>
#define int ll
#define D(x) cout << "D: " << #x << '=' << x << endl;
#define R(x, l) \
cout << "R: Array " << #x << endl; \
for (int i = 0; i < l; i++) ... | replace | 14 | 15 | 14 | 15 | 0 | |
p03163 | C++ | Runtime Error | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using ll = long long;
using namespace std;
const long long MOD = 1000000007;
co... | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using ll = long long;
using namespace std;
const long long MOD = 1000000007;
co... | replace | 33 | 34 | 33 | 34 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#if !ONLINE_JUDGE
#define debug
#endif
using namespace std;
/******* All Required define Pre-Processors and typedef Constants *******/... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#if !ONLINE_JUDGE
#define debug
#endif
using namespace std;
/******* All Required define Pre-Processors and typedef Constants *******/... | replace | 128 | 129 | 128 | 129 | TLE | |
p03163 | C++ | Runtime Error | // --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <bits/stdc++.h>
#define ll long long
using namespace std;
// #include <ext/pb_ds/asso... | // --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <bits/stdc++.h>
#define ll long long
using namespace std;
// #include <ext/pb_ds/asso... | replace | 42 | 43 | 42 | 43 | 0 | 0.000 sec, Copyright 2019 PyThor.
|
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <utility>
using namespace std;
#define maxW 100010
#define maxN 102
typedef long long ll;
int n;
ll s;
ll cache[maxN][maxW], v[maxN], w[maxN];
ll rec(int i, ll W) {
if (i < 0 || W < 0)
return 0;
if (cache[i][W] != -1)
return cache[i][W];
if (w[i] > W)... | #include <algorithm>
#include <iostream>
#include <utility>
using namespace std;
#define maxW 100010
#define maxN 102
typedef long long ll;
int n;
ll s;
ll cache[maxN][maxW], v[maxN], w[maxN];
ll rec(int i, ll W) {
if (i < 0 || W < 0)
return 0;
if (cache[i][W] != -1)
return cache[i][W];
if (w[i] > W)... | replace | 21 | 22 | 21 | 22 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define D(a) cerr << #a << " = " << a << endl
#else
#define D(a)
#define cerr false && cerr
#endif
#define fastio \
ios_base::sync_with_stdio(0); \... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define D(a) cerr << #a << " = " << a << endl
#else
#define D(a)
#define cerr false && cerr
#endif
#define fastio \
ios_base::sync_with_stdio(0); \... | replace | 36 | 39 | 36 | 40 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_WEIGHTS = 1000005;
ll w[105], v[105], dp[MAX_WEIGHTS];
int N, W;
// ll weights[MAX_WEIGHTS];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> N >> W;
for (int i = 0; i < N; i++) {
cin >> w[i] >> v[i];
// dp[w[i]... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_WEIGHTS = 10000005;
ll w[105], v[105], dp[MAX_WEIGHTS];
int N, W;
// ll weights[MAX_WEIGHTS];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> N >> W;
for (int i = 0; i < N; i++) {
cin >> w[i] >> v[i];
// dp[w[i... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
unsigned long long int dp[100][100000];
unsigned long long int knapsack(unsigned long long int *wt,
unsigned long long int *val,
unsigned long long int w,
unsigned long long int ... | #include <bits/stdc++.h>
using namespace std;
unsigned long long int dp[105][100005];
unsigned long long int knapsack(unsigned long long int *wt,
unsigned long long int *val,
unsigned long long int w,
unsigned long long int ... | replace | 2 | 3 | 2 | 3 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <class T, class U> void ckmin(T &a, U b) {
if (a > b)
a = b;
}
template <class T, class U> void ckmax(T &a, U b) {
if (a < b)
a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se... | #include <bits/stdc++.h>
using namespace std;
template <class T, class U> void ckmin(T &a, U b) {
if (a > b)
a = b;
}
template <class T, class U> void ckmax(T &a, U b) {
if (a < b)
a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se... | replace | 25 | 26 | 25 | 26 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
long long weights[101];
long long values[101];
long long dp[100][100001];
int main() {
int n;
long long W;
cin >> n >> W;
for (int i = 0; i < n; i++) {
cin >> weights[i] >> values[i];
}
for (int i = 0; i < n; i++) {
f... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
long long weights[101];
long long values[101];
long long dp[101][100001];
int main() {
int n;
long long W;
cin >> n >> W;
for (int i = 0; i < n; i++) {
cin >> weights[i] >> values[i];
}
for (int i = 0; i < n; i++) {
f... | replace | 7 | 8 | 7 | 8 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
// #define ll long long int;
vector<pair<long long int, long long int>> v;
long long int dp[105][10005];
long long int maxi(long long int w, long long int i, long long int n) {
if (i == n)
return 0;
if (w - v[i].first >= 0) {
if (dp[i][w] == -1)
return dp... | #include <bits/stdc++.h>
using namespace std;
// #define ll long long int;
vector<pair<long long int, long long int>> v;
long long int dp[105][100005];
long long int maxi(long long int w, long long int i, long long int n) {
if (i == n)
return 0;
if (w - v[i].first >= 0) {
if (dp[i][w] == -1)
return d... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Runtime Error | #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;
type... | #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;
type... | replace | 50 | 51 | 50 | 55 | -11 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define FI freopen("inp.txt", "r", stdin)
#define FO freopen("out.txt", "w", stdout)
#define FOR(v) \
for (int i : v) { \
printf("%d ", i); ... | #include <bits/stdc++.h>
using namespace std;
#define FI freopen("inp.txt", "r", stdin)
#define FO freopen("out.txt", "w", stdout)
#define FOR(v) \
for (int i : v) { \
printf("%d ", i); ... | insert | 37 | 37 | 37 | 40 | TLE | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ll long long
int n, w;
pii arr[101];
ll dp[101][100005];
ll knap(int i, int n, int sm) {
if (i == n)
return 0;
if (dp[i][sm] != -1)
return dp[i][sm];
ll ans = 0;
if (sm + arr[i].first <= w) {
ans = max(ans, arr[i].sec... | #include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ll long long
int n, w;
pii arr[101];
ll dp[101][100005];
ll knap(int i, int n, int sm) {
if (i == n)
return 0;
if (dp[i][sm] != -1)
return dp[i][sm];
ll ans = 0;
if (sm + arr[i].first <= w) {
ans = max(ans, arr[i].sec... | replace | 21 | 22 | 21 | 22 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long dp[100][100010], v[110], w[110];
int main() {
long long n, W;
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 curw = 0; curw <= W; curw++)
dp[i][curw] =
max(dp[i + 1][curw]... | #include <bits/stdc++.h>
using namespace std;
long long dp[110][100010], v[110], w[110];
int main() {
long long n, W;
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 curw = 0; curw <= W; curw++)
dp[i][curw] =
max(dp[i + 1][curw]... | replace | 3 | 4 | 3 | 4 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
// using INF = INT_MAX / 2;
#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif
// dp[w][i] := w の重さの時 i 個の荷物を入れた時の価値の総和
long long dp[100][100005];
int main() {
int N, W;
cin... | #include <bits/stdc++.h>
using namespace std;
// using INF = INT_MAX / 2;
#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif
// dp[w][i] := w の重さの時 i 個の荷物を入れた時の価値の総和
long long dp[105][100005];
int main() {
int N, W;
cin... | replace | 15 | 16 | 15 | 16 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void setIO() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#ifdef DEBUG
// freopen("solution.out", "w", stdout);
freopen("1.in", "r", stdin);
#endif
}
const int maxn = 100, maxw = 1e5 + 1;
const long long inf = 1e18;
long long dp[maxn][maxw];
int main() ... | #include <bits/stdc++.h>
using namespace std;
void setIO() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#ifdef DEBUG
// freopen("solution.out", "w", stdout);
freopen("1.in", "r", stdin);
#endif
}
const int maxn = 101, maxw = 1e5 + 1;
const long long inf = 1e18;
long long dp[maxn][maxw];
int main() ... | replace | 13 | 14 | 13 | 14 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define vin vector<int>
#define vcn vector<char>
#define ver pair<int, int>
#define pb push_back
#define ld long double
#define x first
#define y second
#define blush \
fflush(stdout); ... | #include <bits/stdc++.h>
#define int long long
#define vin vector<int>
#define vcn vector<char>
#define ver pair<int, int>
#define pb push_back
#define ld long double
#define x first
#define y second
#define blush \
fflush(stdout); ... | replace | 32 | 33 | 32 | 33 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
long long N, W;
long long w[105], u[105];
long long dp[105][105];
long long ans = 0;
int main() {
scanf("%d%d", &N, &W);
for (int i = ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
long long N, W;
long long w[105], u[105];
long long dp[100005][105];
long long ans = 0;
int main() {
scanf("%d%d", &N, &W);
for (int i... | replace | 12 | 13 | 12 | 13 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long int
#define ri register int
#define endl "\n"
using namespace std;
ll dp[102][(int)1e5 + 2] = {};
int main() {
ios_base::sync_with_stdio(false);
ll n, w;
cin >> n >> w;
vector<pair<ll, ll>> items(n + 1);
for (ri i = 1; i <= n; i++)
cin >> items[i].first >... | #include <bits/stdc++.h>
#define ll long long int
#define ri register int
#define endl "\n"
using namespace std;
ll dp[102][(int)1e5 + 2] = {};
int main() {
ios_base::sync_with_stdio(false);
ll n, w;
cin >> n >> w;
vector<pair<ll, ll>> items(n + 1);
for (ri i = 1; i <= n; i++)
cin >> items[i].first >... | replace | 19 | 20 | 19 | 20 | -11 | |
p03163 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <iostream>
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
const int MAXN = 105;
const int MAXW = 1e5 + 7;
template <typename T> inline T read() {
T res = 0,... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <iostream>
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
const int MAXN = 105;
const int MAXW = 1e5 + 7;
template <typename T> inline T read() {
T res = 0,... | delete | 66 | 70 | 66 | 66 | TLE | |
p03163 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
const long long inf = 1e18;
#define ll long long
#define fr(i, a, n) for (int i = a; i < n; i++)
#define rfr(i, n, a) for (int i = n; i >= a; i--)
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define endl "\n"
typedef vecto... | #include "bits/stdc++.h"
using namespace std;
const long long inf = 1e18;
#define ll long long
#define fr(i, a, n) for (int i = a; i < n; i++)
#define rfr(i, n, a) for (int i = n; i >= a; i--)
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define endl "\n"
typedef vecto... | replace | 27 | 29 | 27 | 30 | TLE | |
p03163 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define nl '\n'
#define repd(i, a, b) for (int i = a; i >= b; --i)
#define pb push_back
#define all(a) a.begin(), a.end()
#define F first
#define S second
const ll N = 1e6 + 9;
const ll mod = 1e9 + ... | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define nl '\n'
#define repd(i, a, b) for (int i = a; i >= b; --i)
#define pb push_back
#define all(a) a.begin(), a.end()
#define F first
#define S second
const ll N = 1e6 + 9;
const ll mod = 1e9 + ... | replace | 14 | 15 | 14 | 15 | -11 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 10;
long long n, W;
vector<long long> v, w;
long long dp[110][MAXN];
long long dfs(long long x, long long curr) {
if (x == n) {
return 0;
}
// if ( dp[x][curr] != -1 ) return dp[x][curr] ;
long long choice1 = 0 + dfs(x + 1, curr);
... | #include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 10;
long long n, W;
vector<long long> v, w;
long long dp[110][MAXN];
long long dfs(long long x, long long curr) {
if (x == n) {
return 0;
}
if (dp[x][curr] != -1)
return dp[x][curr];
long long choice1 = 0 + dfs(x + 1, curr);
lo... | replace | 10 | 11 | 10 | 12 | TLE | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long int l;
l knapsack(l w[], l v[], l W, l n) {
if (n == 0 || W == 0)
return 0;
if (w[n - 1] <= W) {
return max(v[n - 1] + knapsack(w, v, W - w[n - 1], n - 1),
knapsack(w, v, W, n - 1));
} else
return knapsa... | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long int l;
l knapsack(l wt[], l v[], l W, l n) {
l dp[n + 1][W + 1];
for (l i = 0; i <= n; i++) {
for (l w = 0; w <= W; w++) {
if (i == 0 || w == 0)
dp[i][w] = 0;
else if (wt[i - 1] <= w) {
dp[i][w] = ma... | replace | 4 | 12 | 4 | 18 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | #include <bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | replace | 15 | 21 | 15 | 21 | -11 | |
p03163 | C++ | Memory Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<ll>> dp(200, vector<ll>(1000000, -1));
ll ans(ll a[][2], ll w, ll i) {
if (dp[i][w] != -1)
return dp[i][w];
if (i == 0 || w == 0) {
dp[i][w] = 0;
return dp[i][w];
}
if (w - a[i - 1][0] >= 0) {
dp[i][w] =
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<ll>> dp(108, vector<ll>(100009, -1));
ll ans(ll a[][2], ll w, ll i) {
if (dp[i][w] != -1)
return dp[i][w];
if (i == 0 || w == 0) {
dp[i][w] = 0;
return dp[i][w];
}
if (w - a[i - 1][0] >= 0) {
dp[i][w] =
m... | replace | 4 | 5 | 4 | 5 | MLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
long long n, W;
cin >> n >> W;
long long weight[n], values[n];
long long dp[n][W + 1];
for (int i = 0; i < n; ++i) {
cin >> weight[i] >> values[i];
}
for (int i = 0; i <= n; i++) {
for (int w = 0; w <= W; w++) {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
long long n, W;
cin >> n >> W;
long long weight[n], values[n];
long long dp[n + 1][W + 1];
for (int i = 0; i < n; ++i) {
cin >> weight[i] >> values[i];
}
for (int i = 0; i <= n; i++) {
for (int w = 0; w <= W; w++)... | replace | 8 | 9 | 8 | 9 | 0 | |
p03163 | C++ | Runtime Error | #include <iostream>
#define ll long long int
using namespace std;
int main() {
ll n, W;
cin >> n >> W;
ll i, j;
ll v[200];
ll w[200];
ll dp[200] = {0};
for (i = 0; i < n; i++) {
cin >> w[i];
cin >> v[i];
}
for (i = 0; i < n; i++) {
for (j = W; j >= w[i]; j--)
dp[j] = max(dp[j], dp... | #include <iostream>
#define ll long long int
using namespace std;
int main() {
ll n, W;
cin >> n >> W;
ll i, j;
ll v[200];
ll w[200];
ll dp[100005] = {0};
for (i = 0; i < n; i++) {
cin >> w[i];
cin >> v[i];
}
for (i = 0; i < n; i++) {
for (j = W; j >= w[i]; j--)
dp[j] = max(dp[j],... | replace | 10 | 11 | 10 | 11 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define lli l... | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define lli l... | replace | 79 | 84 | 79 | 83 | -11 | |
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;
ll dp[101][10001] = {0};
ll helper(vector<int> &w, vector<int> &v, int index, int capacity) {
if (dp[index][capacity] != 0)
return dp[index][capacity];
if (index == w.size())
return 0;
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
ll dp[101][100001] = {0};
ll helper(vector<int> &w, vector<int> &v, int index, int capacity) {
if (dp[index][capacity] != 0)
return dp[index][capacity];
if (index == w.size())
return 0;... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
const ll ARR = 1e5 + 2;
const ll MOD = 1e9 + 7;
const ll INF = MOD;
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define gof for (long long int i = 0; i < n; i++)
#define for1(i, s, e) for (long long int i = s; i < e; ++i)
#define we... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
const ll ARR = 1e5 + 2;
const ll MOD = 1e9 + 7;
const ll INF = MOD;
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define gof for (long long int i = 0; i < n; i++)
#define for1(i, s, e) for (long long int i = s; i < e; ++i)
#define we... | delete | 92 | 96 | 92 | 92 | -11 | |
p03163 | C++ | Runtime Error | #include <iostream>
using namespace std;
typedef long long ll;
int main() {
int n, w;
cin >> n >> w;
ll weight[n], value[n];
for (int i = 0; i < n; i++) {
cin >> weight[i] >> value[i];
}
ll dp[n + 1][w + 1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= w; j++) {
if (i == 0 || j =... | #include <iostream>
using namespace std;
typedef long long ll;
int main() {
int n, w;
cin >> n >> w;
ll weight[n], value[n];
for (int i = 0; i < n; i++) {
cin >> weight[i] >> value[i];
}
ll dp[n + 1][w + 1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= w; j++) {
if (i == 0 || j =... | replace | 20 | 21 | 20 | 21 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll w_max = 10005;
const ll n_max = 105;
ll dp[w_max][n_max];
int main() {
ll N, W;
cin >> N >> W;
vector<ll> v(N + 1);
vector<ll> w(N + 1);
for (ll i = 1; i <= N; i++)
cin >> w[i] >> v[i];
for (ll i = 0; i <= W; i++)
dp[... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll w_max = 100005;
const ll n_max = 105;
ll dp[w_max][n_max];
int main() {
ll N, W;
cin >> N >> W;
vector<ll> v(N + 1);
vector<ll> w(N + 1);
for (ll i = 1; i <= N; i++)
cin >> w[i] >> v[i];
for (ll i = 0; i <= W; i++)
dp... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
ll power(ll x, ll y) {
ll res = 1;
while (y > 0) {
if (y % 2 == 1)
res = (res * x);
x = (x * x);
y = y / 2;
}
return res;
}
int main() {
ll n, W;
cin >> n >> W;
ll val[n + 1], w... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
ll power(ll x, ll y) {
ll res = 1;
while (y > 0) {
if (y % 2 == 1)
res = (res * x);
x = (x * x);
y = y / 2;
}
return res;
}
int main() {
ll n, W;
cin >> n >> W;
ll val[n + 1], w... | replace | 34 | 35 | 34 | 35 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
ll power(ll x, ll y) {
ll res = 1;
while (y > 0) {
if (y % 2 == 1)
res = (res * x);
x = (x * x);
y = y / 2;
}
return res;
}
int main() {
ll n, W;
cin >> n >> W;
ll val[n + 1], w... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
ll power(ll x, ll y) {
ll res = 1;
while (y > 0) {
if (y % 2 == 1)
res = (res * x);
x = (x * x);
y = y / 2;
}
return res;
}
int main() {
ll n, W;
cin >> n >> W;
ll val[n + 1], w... | replace | 34 | 35 | 34 | 35 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, W;
cin >> n >> W;
long w[n], v[n];
for (int i = 0; i < n; i++) {
cin >> w[i] >> v[i];
}
long dp[n][W];
for (int i = 0; i <= W; i++) {
dp[0][i] = 0;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= W; j++) {
if (j... | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, W;
cin >> n >> W;
long w[n], v[n];
for (int i = 0; i < n; i++) {
cin >> w[i] >> v[i];
}
long dp[n + 1][W + 1];
for (int i = 0; i <= W; i++) {
dp[0][i] = 0;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= W; j++) {
... | replace | 10 | 11 | 10 | 11 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 105;
const int MAX_W = 1e3 + 5;
int n_test;
int n, W, w, v;
long long solve() {
scanf("%d %d", &n, &W);
long long res[MAX_N][MAX_W] = {{0L}};
for (int i = 1; i <= n; ++i) {
scanf("%d %d", &w, &v);
for (int j = 0; j <= W; ++j)
res[i]... | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 105;
const int MAX_W = 1e5 + 5;
int n_test;
int n, W, w, v;
long long solve() {
scanf("%d %d", &n, &W);
long long res[MAX_N][MAX_W] = {{0L}};
for (int i = 1; i <= n; ++i) {
scanf("%d %d", &w, &v);
for (int j = 0; j <= W; ++j)
res[i]... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long memo[1001][100001];
long long knapsack(long long value[], long long weight[], int index, int n,
long long w) {
if (index >= n || w <= 0)
return 0;
if (weight[index] > w)
return knapsack(value, weight, index, n, w);
if (memo[index][... | #include <bits/stdc++.h>
using namespace std;
long long memo[1001][100001];
long long knapsack(long long value[], long long weight[], int index, int n,
long long w) {
if (index >= n || w <= 0)
return 0;
if (weight[index] > w) {
if (memo[index][w] != -1)
return memo[index][w];
r... | replace | 7 | 9 | 7 | 13 | TLE | |
p03163 | C++ | Runtime Error | //*******Abhijit Burman***********//
// Jalpaiguri Government Engineering College//
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000 + 7)
#define fio \
... | //*******Abhijit Burman***********//
// Jalpaiguri Government Engineering College//
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000 + 7)
#define fio \
... | replace | 15 | 16 | 15 | 16 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll wt[101], v[101];
ll fun(int n, int W, ll **dp) {
if (W == 0 || n < 0)
return 0;
if (W - wt[n] >= 0) {
dp[n][W] = max(dp[n][W], fun(n - 1, W - wt[n], dp) + v[n]);
}
dp[n][W] = max(dp[n][W], fun(n - 1, W, dp));
return dp[n][W];... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll wt[101], v[101];
ll fun(int n, int W, ll **dp) {
if (W == 0 || n < 0)
return 0;
if (dp[n][W] != -1)
return dp[n][W];
if (W - wt[n] >= 0) {
dp[n][W] = max(dp[n][W], fun(n - 1, W - wt[n], dp) + v[n]);
}
dp[n][W] = max(dp[n][... | replace | 8 | 9 | 8 | 10 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long dp[100][100000];
int main() {
long long n, W, i, x, y, tw, j;
cin >> n >> W;
vector<long long> a, w;
for (i = 1; i <= n; i++) {
cin >> y >> x;
a.push_back(x);
w.push_back(y);
}
for (i = 0; i <= n; i++) {
for (j = 0; j <= W; j++) {
... | #include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
int main() {
long long n, W, i, x, y, tw, j;
cin >> n >> W;
vector<long long> a, w;
for (i = 1; i <= n; i++) {
cin >> y >> x;
a.push_back(x);
w.push_back(y);
}
for (i = 0; i <= n; i++) {
for (j = 0; j <= W; j++) {
... | replace | 2 | 3 | 2 | 3 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
const int MAX = 1e5 + 10;
ll N, W, w, v;
ll dp[111];
ll ans;
int main() {
cin >> N >> W;
dp[0] = 1;
REP(i, N) {
cin >> w >> v;
... | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
const int MAX = 1e5 + 10;
ll N, W, w, v;
ll dp[MAX];
ll ans;
int main() {
cin >> N >> W;
dp[0] = 1;
REP(i, N) {
cin >> w >> v;
... | replace | 11 | 12 | 11 | 12 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
const int MAXN = 1e5 + 5;
long long DP[MAXN];
int main(int argc, char *argv[]) {
int N, W, w, v;
long long answer = 0;
scanf("%d%d", &N, &W);
for (int i = 0; i < W; i++) {
scanf("%d%d", &w, &v);
for (int j = W; 0 <= j; j--)
if ((DP[j] or j == 0) a... | #include "bits/stdc++.h"
using namespace std;
const int MAXN = 1e5 + 5;
long long DP[MAXN];
int main(int argc, char *argv[]) {
int N, W, w, v;
long long answer = 0;
scanf("%d%d", &N, &W);
for (int i = 0; i < N; i++) {
scanf("%d%d", &w, &v);
for (int j = W; 0 <= j; j--)
if ((DP[j] or j == 0) a... | replace | 12 | 13 | 12 | 13 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, w;
cin >> n >> w;
vector<ll> weight(n), value(n);
for (ll i = 1; i <= n; ++i) {
cin >> weight[i] >> value[i];
}
ll arr[n + 1][w + 1];
for (ll i = 0; i < n + 1; ++i) {
for (ll j = 0; j < w + 1; ++j)
arr... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, w;
cin >> n >> w;
vector<ll> weight(101), value(101);
for (ll i = 1; i <= n; ++i) {
cin >> weight[i] >> value[i];
}
ll arr[n + 1][w + 1];
for (ll i = 0; i < n + 1; ++i) {
for (ll j = 0; j < w + 1; ++j)
... | replace | 10 | 11 | 10 | 11 | -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;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef map<string, int> msi;
typedef set<ll> sl;
t... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef map<string, int> msi;
typedef set<ll> sl;
t... | replace | 33 | 34 | 33 | 34 | -11 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define debug(x) cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typede... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define debug(x) cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typede... | replace | 26 | 27 | 26 | 27 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF 1000000007
using namespace std;
using P = pair<int, int>;
using ll = long long;
int ma... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF 1000000007
using namespace std;
using P = pair<int, int>;
using ll = long long;
int ma... | replace | 23 | 24 | 23 | 24 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef lo... | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef lo... | replace | 38 | 39 | 38 | 39 | 0 | |
p03163 | C++ | Runtime Error | /**
* Title: D - Knapsack 1
* Url: https://atcoder.jp/contests/dp/tasks/dp_d
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int N, W;
const int MAX_N = 100;
const int MAX_W = 100000;
int w[MAX_N + 1], v[MAX_N + 1];
ll dp[MAX_N + 1][MAX_W + 1];
ll rec(int i, int j) {
if (dp[i][j] != -1)
... | /**
* Title: D - Knapsack 1
* Url: https://atcoder.jp/contests/dp/tasks/dp_d
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int N, W;
const int MAX_N = 100;
const int MAX_W = 100000;
int w[MAX_N + 1], v[MAX_N + 1];
ll dp[MAX_N + 2][MAX_W + 2];
ll rec(int i, int j) {
if (dp[i][j] != -1)
... | replace | 15 | 16 | 15 | 16 | 0 | |
p03163 | C++ | Runtime Error | // Created by sz
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int maxw = 10005;
int N, W, w[maxn], v[maxn];
long long dp[maxn][maxw];
int main() {
#ifdef LOCAL
freopen("./input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N >> W;
for (int i =... | // Created by sz
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int maxw = 100005;
int N, W, w[maxn], v[maxn];
long long dp[maxn][maxw];
int main() {
#ifdef LOCAL
freopen("./input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N >> W;
for (int i ... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REV(i, a, n) for (int i = a; i >= n; i--)
#define all(a) a.begin(), a.end()
#define UB upper_bou... | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REV(i, a, n) for (int i = a; i >= n; i--)
#define all(a) a.begin(), a.end()
#define UB upper_bou... | replace | 14 | 15 | 14 | 15 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N, W;
cin >> N >> W;
vector<vector<int>> dp(N + 10, vector<int>(W, 0));
int v, w;
for (int i = 0; i < N; i++) {
cin >> w >> v;
for (int j = 0; j <= W; j++) {
if (j - w < 0) {
dp[i + 1][j] = dp[i][j];... | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N, W;
cin >> N >> W;
vector<vector<int>> dp(110, vector<int>(100010, 0));
int v, w;
for (int i = 0; i < N; i++) {
cin >> w >> v;
for (int j = 0; j <= W; j++) {
if (j - w < 0) {
dp[i + 1][j] = dp[i][j... | replace | 7 | 8 | 7 | 8 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> V;
ll n, W, w, v;
ll dp[100][100010];
int main() {
cin >> n >> W;
for (int i = 1; i <= n; i++) {
cin >> w >> v;
for (int j = 1; j <= W; j++) {
dp[i][j] = dp[i - 1][j];
if (j - w >= 0)
dp[i][j] = max(dp[i][j... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> V;
ll n, W, w, v;
ll dp[110][100010];
int main() {
cin >> n >> W;
for (int i = 1; i <= n; i++) {
cin >> w >> v;
for (int j = 1; j <= W; j++) {
dp[i][j] = dp[i - 1][j];
if (j - w >= 0)
dp[i][j] = max(dp[i][j... | replace | 7 | 8 | 7 | 8 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
cons... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
cons... | replace | 70 | 71 | 70 | 71 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define mx 105
int n, W;
int weight[mx], value[mx];
#define ll long long
ll dp[mx][mx];
ll func(int i, int w) {
if (i >= n + 1)
return 0;
if (dp[i][w] != -1)
return dp[i][w];
ll p1 = 0, p2 = 0;
if (w + weight[i] <= W) {
p1 = value[i] + func(i + 1, w +... | #include <bits/stdc++.h>
using namespace std;
#define mx 105
int n, W;
int weight[mx], value[mx];
#define ll long long
ll dp[mx][100000 + mx];
ll func(int i, int w) {
if (i >= n + 1)
return 0;
if (dp[i][w] != -1)
return dp[i][w];
ll p1 = 0, p2 = 0;
if (w + weight[i] <= W) {
p1 = value[i] + func(i... | replace | 8 | 9 | 8 | 9 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define MAXN 110
using namespace std;
long long v[MAXN], dp[MAXN][100010];
int p[MAXN], ct = 1;
map<long long, int> m;
int hsh(long long p) {
if (m[p] == 0)
return m[p] = ct++;
else
return m[p];
}
long long res(int i, int n, int w) {
if (i == n)
return 0;
if (dp[i][hsh(w)... | #include <bits/stdc++.h>
#define MAXN 110
using namespace std;
long long v[MAXN], dp[MAXN][100010];
int p[MAXN], ct = 1;
unordered_map<long long, int> m;
int hsh(long long p) {
if (m[p] == 0)
return m[p] = ct++;
else
return m[p];
}
long long res(int i, int n, int w) {
if (i == n)
return 0;
if (dp... | replace | 6 | 7 | 6 | 7 | TLE | |
p03163 | C++ | Runtime Error | #include <iostream>
using namespace std;
#define MAX_N 100
#define MAX_W 100000
int N, W;
long long dp[MAX_N][MAX_W + 1];
int main() {
cin >> N >> W;
int w[N + 1], v[N + 1];
for (int i = 0; i < N; i++)
cin >> w[i] >> v[i];
for (int i = 0; i < N; i++) {
for (int j = 0; j <= W; j++) {
if (j < w[i]... | #include <iostream>
using namespace std;
#define MAX_N 100
#define MAX_W 100000
int N, W;
long long dp[MAX_N + 1][MAX_W + 1];
int main() {
cin >> N >> W;
int w[N + 1], v[N + 1];
for (int i = 0; i < N; i++)
cin >> w[i] >> v[i];
for (int i = 0; i < N; i++) {
for (int j = 0; j <= W; j++) {
if (j < ... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define SZ(items) (int)items.size()
#define CLR(a) memset(a, 0, sizeof(a))
#define SET(a) memset(a, -1, sizeof(a))
#define nl "\n";
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
template <class T> inline T biton(T n, T pos) { return n |... | #include <bits/stdc++.h>
using namespace std;
#define SZ(items) (int)items.size()
#define CLR(a) memset(a, 0, sizeof(a))
#define SET(a) memset(a, -1, sizeof(a))
#define nl "\n";
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
template <class T> inline T biton(T n, T pos) { return n |... | replace | 49 | 50 | 49 | 50 | 0 | |
p03163 | C++ | Runtime Error | #pragma GCC optimize("O3")
#pragma GCC target("avx")
// #include<bits/stdc++.h>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x... | #pragma GCC optimize("O3")
#pragma GCC target("avx")
// #include<bits/stdc++.h>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x... | replace | 41 | 44 | 41 | 42 | 0 | |
p03163 | C++ | Runtime Error | /*
Author : Simanta Deb Turja
*/
#include <bits/stdc++.h>
using namespace std;
#define Professor
using ll = long long;
using i64 = unsigned long long;
template <typename T> inline T Min(T a, T b, T c) { return min(a, min(b, c)); }
template <typename T> inline T Min(T a, T b, T c, T d) {
return min(a, min(b, mi... | /*
Author : Simanta Deb Turja
*/
#include <bits/stdc++.h>
using namespace std;
#define Professor
using ll = long long;
using i64 = unsigned long long;
template <typename T> inline T Min(T a, T b, T c) { return min(a, min(b, c)); }
template <typename T> inline T Min(T a, T b, T c, T d) {
return min(a, min(b, mi... | replace | 91 | 93 | 91 | 93 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <fstream>
#include <iostream>
#include <math.h>
#include <set>
#include <string>
#include <vector>
using namespace ::std;
#define int long long
vector<int> v;
signed main() {
int n, k;
cin >> n >> k;
v.resize(k + 1, -1);
v[0] = 0;
int f = 0;
int ans = 0;
for (int i = 0; i < ... | #include <algorithm>
#include <fstream>
#include <iostream>
#include <math.h>
#include <set>
#include <string>
#include <vector>
using namespace ::std;
#define int long long
vector<int> v;
signed main() {
int n, k;
cin >> n >> k;
v.resize(k + 1, -1);
v[0] = 0;
int f = 0;
int ans = 0;
for (int i = 0; i < ... | replace | 25 | 26 | 25 | 26 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long int n, W, i, j, weight[1005], val[1005], mat[100][100005];
int main() {
cin >> n >> W;
for (i = 0; i < n; i++) {
cin >> weight[i] >> val[i];
}
for (i = 0; i <= W; i++)
mat[0][i] = 0;
for (i = 0; i <= n; i++)
mat[i][0] = 0;
for (i = 1; i ... | #include <bits/stdc++.h>
using namespace std;
long long int n, W, i, j, weight[1005], val[1005], mat[105][100005];
int main() {
cin >> n >> W;
for (i = 0; i < n; i++) {
cin >> weight[i] >> val[i];
}
for (i = 0; i <= W; i++)
mat[0][i] = 0;
for (i = 0; i <= n; i++)
mat[i][0] = 0;
for (i = 1; i ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
struct wow {
int x, y;
} v[105];
long long din[10005], n, val, maxim, j, i;
int main() {
cin >> n >> val;
for (i = 1; i <= n; i++) {
cin >> v[i].x >> v[i].y;
}
for (i = 1; i <= val; i++) {
din[i] = -1;
}
for (i = 1; i <= n; i++) {
for (j = val; j ... | #include <bits/stdc++.h>
using namespace std;
struct wow {
int x, y;
} v[105];
long long din[100005], n, val, maxim, j, i;
int main() {
cin >> n >> val;
for (i = 1; i <= n; i++) {
cin >> v[i].x >> v[i].y;
}
for (i = 1; i <= val; i++) {
din[i] = -1;
}
for (i = 1; i <= n; i++) {
for (j = val; j... | replace | 6 | 7 | 6 | 7 | 0 | |
p03163 | C++ | Runtime Error | #include <iostream>
using namespace std;
int w[110], v[110];
long long int dp[110][100345];
int N, W;
int main() {
cin >> N >> W;
for (int i = 0; i < N; i++)
for (int j = 0; j <= W; j++)
dp[i][j] = -1;
for (int i = 0; i < N; i++)
cin >> w[i] >> v[i];
for (int i = 0; i < N; i++)
dp[i][0] = 0... | #include <iostream>
using namespace std;
int w[110], v[110];
long long int dp[110][100345];
int N, W;
int main() {
cin >> N >> W;
for (int i = 0; i < N; i++)
for (int j = 0; j <= W; j++)
dp[i][j] = -1;
for (int i = 0; i < N; i++)
cin >> w[i] >> v[i];
for (int i = 0; i < N; i++)
dp[i][0] = 0... | replace | 19 | 20 | 19 | 22 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define f(i, a, n) for (int i = a; i < n; i++)
using name... | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define f(i, a, n) for (int i = a; i < n; i++)
using name... | replace | 24 | 28 | 24 | 28 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <iostream>
using namespace std;
const int maxn = 13010;
typedef long long ll;
ll n, W, w[maxn], v[maxn], f[maxn];
int main() {
cin >> n >> W;
for (int i = 1; i <= n; i++)
cin >> w[i] >> v[i];
for (int i = 1; i <= n; i++)
for (ll l = W; l >= w[i]; l--)
if (f[l - w[i]] + v[i] > f[l])
... | #include <iostream>
using namespace std;
const int maxn = 1e5 + 5;
typedef long long ll;
ll n, W, w[maxn], v[maxn], f[maxn];
int main() {
cin >> n >> W;
for (int i = 1; i <= n; i++)
cin >> w[i] >> v[i];
for (int i = 1; i <= n; i++)
for (ll l = W; l >= w[i]; l--)
if (f[l - w[i]] + v[i] > f[l])
... | replace | 2 | 3 | 2 | 3 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[100][100002];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n, w;
cin >> n >> w;
for (int i = 1; i <= w; i++)
dp[0][i] = -1ll;
dp[0][0] = 0ll;
for (ll i = 1; i <= n; i++) {
ll hz, zh;
cin >>... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[102][100002];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n, w;
cin >> n >> w;
for (int i = 1; i <= w; i++)
dp[0][i] = -1ll;
dp[0][0] = 0ll;
for (ll i = 1; i <= n; i++) {
ll hz, zh;
cin >>... | replace | 3 | 4 | 3 | 4 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
vector<int> weight;
vector<int> value;
long long ans[101][100000];
int main() {
int N, W, w, v;
cin >> N >> W;
weight.resize(N + 1, 0);
value.resize(N + 1, 0);
for (int i = 0; i < N; ++i) {
cin >> w >> v;
weight[i] = w;
valu... | #include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
vector<int> weight;
vector<int> value;
long long ans[101][100001];
int main() {
int N, W, w, v;
cin >> N >> W;
weight.resize(N + 1, 0);
value.resize(N + 1, 0);
for (int i = 0; i < N; ++i) {
cin >> w >> v;
weight[i] = w;
valu... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Memory Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define si set<int>
#define vi vector<int>
#define pii pair<int, int>
#define vpii vector<pii>
#define vpp vector<pair<int, pii>>
#define mii map<i... | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define si set<int>
#define vi vector<int>
#define pii pair<int, int>
#define vpii vector<pii>
#define vpp vector<pair<int, pii>>
#define mii map<i... | replace | 59 | 60 | 59 | 60 | MLE | |
p03163 | C++ | Runtime Error | #include <iostream>
#define endl '\n'
using namespace std;
const int MAXN = 103, MAXW = 1e5 + 3;
long long cost[MAXN], dp[MAXN][MAXN];
int weight[MAXN];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, w;
cin >> n >> w;
for (int i = 1; i <= n; ++i) {
cin >> weight[i] >> cost[i];
}
... | #include <iostream>
#define endl '\n'
using namespace std;
const int MAXN = 103, MAXW = 1e5 + 3;
long long cost[MAXN], dp[MAXN][MAXW];
int weight[MAXN];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, w;
cin >> n >> w;
for (int i = 1; i <= n; ++i) {
cin >> weight[i] >> cost[i];
}
... | replace | 7 | 8 | 7 | 8 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ... | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ... | replace | 41 | 42 | 41 | 42 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define MAX_W 100010
#define MAX 100
long long dp[MAX][MAX_W];
long long weight[MAX], value[MAX];
int main() {
for (int i = 0; i < MAX; i++) {
for (int j = 0; j < MAX_W; j++) {
dp[i][j] = 0;
}
}
int n, w;
cin >> n >> w;
for (int i = 0; i < n; i++)... | #include <bits/stdc++.h>
using namespace std;
#define MAX_W 100010
#define MAX 110
long long dp[MAX][MAX_W];
long long weight[MAX], value[MAX];
int main() {
for (int i = 0; i < MAX; i++) {
for (int j = 0; j < MAX_W; j++) {
dp[i][j] = 0;
}
}
int n, w;
cin >> n >> w;
for (int i = 0; i < n; i++)... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
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) {
a = b;
return true... | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
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) {
a = b;
return true... | replace | 25 | 26 | 25 | 26 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <stack>
using namespace std;
typedef long long ll;
typedef long double lxd;
#define INF 1000000007
#define mem(dp, a) memset(dp, a, sizeof dp)
#define flash \
ios_base::sync_with_stdio(false); ... | #include <bits/stdc++.h>
#include <stack>
using namespace std;
typedef long long ll;
typedef long double lxd;
#define INF 1000000007
#define mem(dp, a) memset(dp, a, sizeof dp)
#define flash \
ios_base::sync_with_stdio(false); ... | replace | 34 | 36 | 34 | 56 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
ll mod = 1e9 + 7;
#define input_from_file freopen("input.txt", "r", stdin);
int main() {
input_from_file;
// int t; cin>>t;
// while(t--){
ll n, sum;
cin >> n >> su... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
ll mod = 1e9 + 7;
#define input_from_file freopen("input.txt", "r", stdin);
int main() {
// input_from_file;
// int t; cin>>t;
// while(t--){
ll n, sum;
cin >> n >>... | replace | 10 | 11 | 10 | 11 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <cstdio>
#include <iostream>
using namespace std;
struct item {
int v;
int w;
} a[101];
long long f[10001];
int main() {
int N, W;
scanf("%d%d", &N, &W);
for (int i = 1; i <= N; ++i)
scanf("%d%d", &a[i].w, &a[i].v);
for (int i = 1; i <= W; ++i) {
if (a[1].w <= i)
f[i] = a[1].v;
}... | #include <cstdio>
#include <iostream>
using namespace std;
struct item {
int v;
int w;
} a[101];
long long f[100001];
int main() {
int N, W;
scanf("%d%d", &N, &W);
for (int i = 1; i <= N; ++i)
scanf("%d%d", &a[i].w, &a[i].v);
for (int i = 1; i <= W; ++i) {
if (a[1].w <= i)
f[i] = a[1].v;
... | replace | 9 | 10 | 9 | 10 | 0 | |
p03163 | C++ | Runtime Error | // define DEBUG for debug
// #define DEBUG
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define MAX 100000
#define MOD 1000000007
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll n, w;
pll arr[100];
ll dp[100]... | // define DEBUG for debug
// #define DEBUG
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define MAX 100000
#define MOD 1000000007
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll n, w;
pll arr[100 + 100];
ll d... | replace | 15 | 17 | 15 | 17 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long w[100], v[100], MaxSum[100][100000];
int N;
long long W;
int main() {
scanf("%d %llu", &N, &W);
for (int i = 1; i <= N; i++) {
scanf("%llu %llu", &w[i], &v[i]);
}
for (int i = 1; i <= N; i++) {
for (int j = 0; j <= W; j++) {
MaxSum[i][j] =... | #include <bits/stdc++.h>
using namespace std;
long long w[200], v[200], MaxSum[200][200000];
int N;
long long W;
int main() {
scanf("%d %llu", &N, &W);
for (int i = 1; i <= N; i++) {
scanf("%llu %llu", &w[i], &v[i]);
}
for (int i = 1; i <= N; i++) {
for (int j = 0; j <= W; j++) {
MaxSum[i][j] =... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
freopen("test.inp", "r", stdin);
long long int n, i, j;
long long int w;
cin >> n >> w;
long long int m[n + 10], v[n + 10];
long long int f[n + 10][w + 10];
for (i = 1; i <= n; i++) {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("test.inp","r",stdin);
long long int n, i, j;
long long int w;
cin >> n >> w;
long long int m[n + 10], v[n + 10];
long long int f[n + 10][w + 10];
for (i = 1; i <= n; i++) {... | replace | 8 | 9 | 8 | 9 | -11 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long KnapSack(int W, vector<int> wt, vector<int> val, int n) {
if (n == 0 || W == 0)
return 0;
if (wt[n - 1] > W)
return KnapSack(W, wt, val, n - 1);
return max(val[n - 1] + KnapSack(W - wt[n - 1], wt, val, n - 1),
KnapSack(W, wt, val, n - 1... | #include <bits/stdc++.h>
using namespace std;
long long KnapSack(int W, vector<int> wt, vector<int> val, int n) {
vector<vector<long>> dp(n + 1, vector<long>(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)
... | replace | 4 | 10 | 4 | 16 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;
const int W = 200007;
const int N = 207;
LL w[N], v[N];
LL dp[N];
LL czy[N];
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(0);
int n, WW;
cin... | #include <bits/stdc++.h>
using namespace std;
using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;
const int W = 200007;
const int N = 207;
LL w[N], v[N];
LL dp[W];
LL czy[W];
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(0);
int n, WW;
cin... | replace | 12 | 14 | 12 | 14 | 0 | |
p03163 | C++ | Runtime Error |
#include <bits/stdc++.h>
#include <dirent.h>
#include <stdlib.h>
using namespace std;
#define sp << " " <<
typedef vector<int> vi;
typedef vector<long int> vli;
typedef vector<long long int> vlli;
typedef long int li;
typedef long long int lli;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<lli, lli>> vplli;
... |
#include <bits/stdc++.h>
#include <dirent.h>
#include <stdlib.h>
using namespace std;
#define sp << " " <<
typedef vector<int> vi;
typedef vector<long int> vli;
typedef vector<long long int> vlli;
typedef long int li;
typedef long long int lli;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<lli, lli>> vplli;
... | replace | 66 | 67 | 66 | 67 | 90 | |
p03163 | C++ | Runtime Error | // nani?
#include <bits/stdc++.h>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i, a, b) for (int i = a; i < b; i++)
#define sor(a) sort(a.begin(), a.end())
#define rsor(a) sort(a.rbegin(), a.rend())
#define fastio ... | // nani?
#include <bits/stdc++.h>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i, a, b) for (int i = a; i < b; i++)
#define sor(a) sort(a.begin(), a.end())
#define rsor(a) sort(a.rbegin(), a.rend())
#define fastio ... | replace | 39 | 40 | 39 | 40 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define show(x) c... | #include <bits/stdc++.h>
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define show(x) c... | delete | 47 | 51 | 47 | 47 | 0 | |
p03163 | C++ | Time Limit Exceeded | /*
_ __ _ _ _ ____ _____
| |/ / / \ | | | / ___|_ _|
| ' / / _ \| | | \___ \ | |
| . \ / ___ \ |_| |___) || |
|_|\_\/_/ \_\___/|____/ |_|
*/
#include <bits/stdc++.h>
#include <fstream>
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a, b) for (long long i = (a); i > (b); i--)... | /*
_ __ _ _ _ ____ _____
| |/ / / \ | | | / ___|_ _|
| ' / / _ \| | | \___ \ | |
| . \ / ___ \ |_| |___) || |
|_|\_\/_/ \_\___/|____/ |_|
*/
#include <bits/stdc++.h>
#include <fstream>
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a, b) for (long long i = (a); i > (b); i--)... | replace | 64 | 67 | 64 | 66 | TLE | |
p03163 | C++ | Runtime Error | // Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
// If you are not doing well now just stick to it and learn new things one day
// you will be... Compete with yourself
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fi first
#de... | // Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
// If you are not doing well now just stick to it and learn new things one day
// you will be... Compete with yourself
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fi first
#de... | replace | 104 | 108 | 104 | 105 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i, a, b) for (i = a; i < b; i++)
#define f2(i, a, b) for (i = a; i >= b; i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod =... | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i, a, b) for (i = a; i < b; i++)
#define f2(i, a, b) for (i = a; i >= b; i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod =... | replace | 20 | 25 | 20 | 24 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int n, W;
vector<long long> w(101), v(101);
long long tb[100][100001];
long long dp(int i, int weight) {
if (weight > W)
return -1000000000000LL;
if (i >= n) {
return 0;
}
if (tb[i][weight] != -1)
return tb[i][weight];
long long total = 0;
for ... | #include <bits/stdc++.h>
using namespace std;
int n, W;
vector<long long> w(101), v(101);
long long tb[100][100001];
long long dp(int i, int weight) {
if (weight > W)
return -1000000000000LL;
if (i >= n) {
return 0;
}
if (tb[i][weight] != -1)
return tb[i][weight];
return tb[i][weight] =
... | replace | 19 | 25 | 19 | 21 | TLE | |
p03164 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
long long n, c, value;
long long f[101][100001];
long long v[101], w[101];
int main() {
scanf("%lld%lld", &n, &c);
for (int i = 1; i <= n; i++) {
scanf("%lld%lld", &w[i], &v[i]);
value += v[i];
}
for (int j = 1; j <= value; j++)
f[0][j] = (long long)10e1... | #include "bits/stdc++.h"
using namespace std;
long long n, c, value;
long long f[101][100001];
long long v[101], w[101];
int main() {
scanf("%lld%lld", &n, &c);
for (int i = 1; i <= n; i++) {
scanf("%lld%lld", &w[i], &v[i]);
value += v[i];
}
for (int j = 1; j <= value; j++)
f[0][j] = (long long)10e1... | replace | 22 | 23 | 22 | 23 | 255 | |
p03164 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define allarr(a) a, a + n
#define ll long long
#define pb push_back
#define fastio \
ios_base::sync_with_stdio(fals... | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define allarr(a) a, a + n
#define ll long long
#define pb push_back
#define fastio \
ios_base::sync_with_stdio(fals... | replace | 22 | 23 | 22 | 23 | 0 | |
p03164 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
#define db(x) // cerr << #x << " == " << x << endl
#define all(container) container.begin(), container.end()
#define mp(i, j) make_pair(i, j)
#define pb push_back
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vec... | #include "bits/stdc++.h"
using namespace std;
#define db(x) // cerr << #x << " == " << x << endl
#define all(container) container.begin(), container.end()
#define mp(i, j) make_pair(i, j)
#define pb push_back
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vec... | replace | 55 | 56 | 55 | 56 | -11 | |
p03164 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
// A utility function that returns maximum of two integers
int max(int a, int b) { return (a > b) ? a : b; }
// Returns the maximum value that can be put in a knapsack of capacity W
long long knapSack1(int W, int weight[], int val[], int n) {
int k, w;
long long **F = ... | #include <bits/stdc++.h>
using namespace std;
// A utility function that returns maximum of two integers
int max(int a, int b) { return (a > b) ? a : b; }
// Returns the maximum value that can be put in a knapsack of capacity W
long long knapSack1(int W, int weight[], int val[], int n) {
int k, w;
long long **F = ... | replace | 87 | 88 | 87 | 88 | 0 | |
p03164 | C++ | Runtime Error | #include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d", &(x))
#define ri2(x, y) scanf("%d %d", &(x), &(y))
#define ri3(x, y, z) scanf("%d %d %d", &(x), &(y), &(z))
#define rll(x) scanf("%lld", &(x))
#define rll2(x, y) scanf(... | #include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d", &(x))
#define ri2(x, y) scanf("%d %d", &(x), &(y))
#define ri3(x, y, z) scanf("%d %d %d", &(x), &(y), &(z))
#define rll(x) scanf("%lld", &(x))
#define rll2(x, y) scanf(... | replace | 90 | 91 | 90 | 91 | 0 | |
p03164 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set \
tree<ll, null_type, less_equal<ll>, rb_tree_tag, \
... | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set \
tree<ll, null_type, less_equal<ll>, rb_tree_tag, \
... | replace | 101 | 102 | 101 | 102 | -6 | *** stack smashing detected ***: terminated
|
p03164 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
int N, W;
cin >> N >> W;
vector<ll> w(N... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
int N, W;
cin >> N >> W;
vector<ll> w(N... | replace | 23 | 32 | 23 | 25 | TLE | |
p03164 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
freopen("caitui.inp", "r", stdin);
long long int n, w;
cin >> n >> w;
long long int m[n + 10], v[n + 10];
long long int tong = 0;
for (int i = 1; i <= n; i++) {
cin >> m[i] >> v[i];
... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("caitui.inp", "r", stdin);
long long int n, w;
cin >> n >> w;
long long int m[n + 10], v[n + 10];
long long int tong = 0;
for (int i = 1; i <= n; i++) {
cin >> m[i] >> v[i]... | replace | 6 | 7 | 6 | 7 | -11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.