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 <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
int n, W;
int w[100], v[100];
ll dp[101][100001];
int main() {
cin >> n >> W;
for (int i = 0; i < n; i++)
cin >> w[i] >> v[i];
memset(dp, 0, sizeof(dp));
for (int i = 0; i <= n; i++) {
for (int j = 0; ... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
int n, W;
int w[100], v[100];
ll dp[101][100001];
int main() {
cin >> n >> W;
for (int i = 0; i < n; i++)
cin >> w[i] >> v[i];
memset(dp, 0, sizeof(dp));
for (int i = 0; i < n; i++) {
for (int j = 0; j... | replace | 13 | 14 | 13 | 14 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, m) for (long long i = 0; i < m; i++)
#define per(i, m) for (long long i = m - 1; i >= 0; i--)
#define FOR(i, n, m) for (long long i = n; i < m; i++)
#define ROF(i, n, m) for (long long i = m - 1; i >= n; i--)
#define SORT(v, n) ... | #include <bits/stdc++.h>
#define rep(i, m) for (long long i = 0; i < m; i++)
#define per(i, m) for (long long i = m - 1; i >= 0; i--)
#define FOR(i, n, m) for (long long i = n; i < m; i++)
#define ROF(i, n, m) for (long long i = m - 1; i >= n; i--)
#define SORT(v, n) ... | replace | 195 | 196 | 195 | 196 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define int long long
#define fori(j, n) for (int i = j; i < n; i++)
#define forb(n, j) for (int i = n - 1; i >= 0; i--)
#define IOS \
ios::sync_wit... | #include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define int long long
#define fori(j, n) for (int i = j; i < n; i++)
#define forb(n, j) for (int i = n - 1; i >= 0; i--)
#define IOS \
ios::sync_wit... | replace | 32 | 33 | 32 | 33 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
struct Fast {
Fast() {
std::cin.tie(0);
ios::sync_with_stdio(false);
}
} fast;
/* short */
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define ALL(v) begin(v), end(v)
/* REPmacro */
#define FOR(i, s, n)... | #include <bits/stdc++.h>
using namespace std;
#define int long long
struct Fast {
Fast() {
std::cin.tie(0);
ios::sync_with_stdio(false);
}
} fast;
/* short */
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define ALL(v) begin(v), end(v)
/* REPmacro */
#define FOR(i, s, n)... | replace | 123 | 124 | 123 | 124 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;
int main() {
ios_base::sync_with_stdio(f... | #include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;
int main() {
ios_base::sync_with_stdio(f... | replace | 15 | 19 | 15 | 16 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef double db;
#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n", (ll)i)
#define mp make_pair
#define ff first
#define ss s... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef double db;
#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n", (ll)i)
#define mp make_pair
#define ff first
#define ss s... | insert | 57 | 57 | 57 | 59 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#inclu... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#inclu... | replace | 24 | 25 | 24 | 25 | 0 | |
p03163 | C++ | Runtime Error | #include <climits>
#include <iostream>
using namespace std;
long long int dp[1000][1000] = {};
long long int knapsack(long long int wt[], long long int val[], long long int w,
long long int i) {
if (w < 0) {
return INT_MIN;
} else if (i == -1) {
return 0;
} else if (dp[w][i] != 0... | #include <climits>
#include <iostream>
using namespace std;
long long int dp[100001][101] = {};
long long int knapsack(long long int wt[], long long int val[], long long int w,
long long int i) {
if (w < 0) {
return INT_MIN;
} else if (i == -1) {
return 0;
} else if (dp[w][i] != ... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Runtime Error |
// Problem : C. Chocolate Bunny
// Contest : Codeforces - Codeforces Round #669 (Div. 2)
// URL : https://codeforces.com/contest/1407/problem/C
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)
#include <bits/stdc++.h>
using namespace std;
#define int lon... |
// Problem : C. Chocolate Bunny
// Contest : Codeforces - Codeforces Round #669 (Div. 2)
// URL : https://codeforces.com/contest/1407/problem/C
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)
#include <bits/stdc++.h>
using namespace std;
#define int lon... | replace | 56 | 57 | 56 | 57 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm> // sort
#include <iostream>
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(), (x).end()
#define print... | #include <algorithm> // sort
#include <iostream>
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(), (x).end()
#define print... | replace | 53 | 54 | 53 | 54 | -11 | |
p03163 | C++ | Runtime Error | #include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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... | #include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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... | replace | 33 | 34 | 33 | 34 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long int dp[100][100001] = {0};
int main() {
int N, W;
cin >> N >> W;
long long int w[2][100];
for (int i = 0; i < N; i++)
cin >> w[0][i] >> w[1][i];
for (int i = 0; i < N; i++) {
for (int sum = 0; sum <= W; sum++) {
if (sum - w[0][i] >= 0)
... | #include <bits/stdc++.h>
using namespace std;
long long int dp[101][100001] = {0};
int main() {
int N, W;
cin >> N >> W;
long long int w[2][100];
for (int i = 0; i < N; i++)
cin >> w[0][i] >> w[1][i];
for (int i = 0; i < N; i++) {
for (int sum = 0; sum <= W; sum++) {
if (sum - w[0][i] >= 0)
... | replace | 2 | 3 | 2 | 3 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 100000000000
int n;
ll we, k;
ll dp[102][100003], w[100003], v[100003];
ll solve(int i, ll j) {
if (i < 0) {
return 0;
}
if (j - w[i] < 0)
return dp[i][j] = max(dp[i][j], solve(i - 1, j));
return dp[i][j] = max(solve(i - 1... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 100000000000
int n;
ll we, k;
ll dp[102][100003], w[100003], v[100003];
ll solve(int i, ll j) {
if (i < 0) {
return 0;
}
if (dp[i][j] != -1)
return dp[i][j];
if (j - w[i] < 0)
return dp[i][j] = max(dp[i][j], solve(i - ... | insert | 14 | 14 | 14 | 16 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, W;
cin >> N >> W;
vector<vector<int>> dp(100000 + 10, vector<int>(100 + 10, 0));
int w[N], v[N];
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++) {
... | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, W;
cin >> N >> W;
vector<vector<int>> dp(100 + 10, vector<int>(100000 + 100, 0));
int w[N], v[N];
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++) {
... | replace | 7 | 8 | 7 | 8 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
long long int n, x, dp[1001][101], c, d, d1;
int main() {
cin >> n >> x;
int val[n + 1], wei[n + 1];
for (int i = 0; i < n; i++)
cin >> wei[i] >> val[i];
for (int i = 1; i <= n; i++)
dp[i][0] = 0;
for (i... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
long long int n, x, dp[101][100001], c, d, d1;
int main() {
cin >> n >> x;
int val[n + 1], wei[n + 1];
for (int i = 0; i < n; i++)
cin >> wei[i] >> val[i];
for (int i = 1; i <= n; i++)
dp[i][0] = 0;
for ... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int x = 101, y = 10001;
long long dp[x][y];
long long c[x], w[x], n, mx_w;
long long solve(int idx, int acc_w) {
if (idx == n)
return 0;
if (dp[idx][acc_w] != -1)
return dp[idx][acc_w];
if (w[idx] + acc_w <= mx_w)
return dp[idx][acc_w] = max(solve... | #include <bits/stdc++.h>
using namespace std;
const int x = 101, y = 100001;
long long dp[x][y];
long long c[x], w[x], n, mx_w;
long long solve(int idx, int acc_w) {
if (idx == n)
return 0;
if (dp[idx][acc_w] != -1)
return dp[idx][acc_w];
if (w[idx] + acc_w <= mx_w)
return dp[idx][acc_w] = max(solv... | replace | 3 | 4 | 3 | 4 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
#define x first
#define y second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define szz(x) (int)(x).si... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
#define x first
#define y second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define szz(x) (int)(x).si... | replace | 32 | 37 | 32 | 35 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int abs(int a, int b) {
if (a >= b)
return a - b;
else
return b - a;
}
ll dp[2][10005];
int main() {
int n, w;
cin >> n >> w;
rep(i, w + 1) dp[0][i] == 0;
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int abs(int a, int b) {
if (a >= b)
return a - b;
else
return b - a;
}
ll dp[2][100005];
int main() {
int n, w;
cin >> n >> w;
rep(i, w + 1) dp[0][i] == 0;
... | replace | 13 | 14 | 13 | 14 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int n, w;
int arr[100][2];
long long dp[100][100000];
long long inf;
long long go(int i, int sum) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= w; j++) {
if (arr[i - 1][0] <= j)
dp[i][j] =
max(arr[i - 1][1] + dp[i - 1][j - arr[i - 1]... | #include <bits/stdc++.h>
using namespace std;
int n, w;
int arr[100][2];
long long dp[105][100010];
long long inf;
long long go(int i, int sum) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= w; j++) {
if (arr[i - 1][0] <= j)
dp[i][j] =
max(arr[i - 1][1] + dp[i - 1][j - arr[i - 1]... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define rep(i, n) for (int i = 0; i < n; ++i)
#define MOD 1000000007
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class ... | #include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define rep(i, n) for (int i = 0; i < n; ++i)
#define MOD 1000000007
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class ... | replace | 21 | 23 | 21 | 23 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T> void _dump(const char *s, T &&head) {
cerr << s << "=" << head << endl;
}
template <typename T, typename... Args>
void _dump(const char *s, T &&head, Args &&...tail) {
while (*s != ',')
cerr << *s++;
cerr << "=" << h... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T> void _dump(const char *s, T &&head) {
cerr << s << "=" << head << endl;
}
template <typename T, typename... Args>
void _dump(const char *s, T &&head, Args &&...tail) {
while (*s != ',')
cerr << *s++;
cerr << "=" << h... | replace | 39 | 40 | 39 | 40 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;
// hamko utils
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) \
for (long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define... | #include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;
// hamko utils
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) \
for (long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define... | replace | 199 | 200 | 199 | 200 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define vi vector<ll>
typedef long long ll;
void read() { freopen("in.txt", "r", stdin); }
ll ks(ll num_items, ll cap, const vector<ll> &w, const vector<ll> &v) {
ll dp[num_items + 1][cap + 1];
for (ll i = 0; i <= num_items; i++) {
dp[i][0] = 0;
}
for (ll i ... | #include <bits/stdc++.h>
using namespace std;
#define vi vector<ll>
typedef long long ll;
void read() { freopen("in.txt", "r", stdin); }
ll ks(ll num_items, ll cap, const vector<ll> &w, const vector<ll> &v) {
ll dp[num_items + 1][cap + 1];
for (ll i = 0; i <= num_items; i++) {
dp[i][0] = 0;
}
for (ll i ... | replace | 33 | 34 | 33 | 34 | -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:satwik_bhv1
#include <bits/stdc++.h>
// datatypes
#define ll long long
#define ld long double
// loops
#define fr(i, z, n) for (ll i = z; i < n; i++)
#define br(i, z, n) for (ll i = z; i > n; i--)
// operations
#define mp make_pair
#define ff first
#define ss second
#define pub push_back
#define all(v) v.begi... | // author:satwik_bhv1
#include <bits/stdc++.h>
// datatypes
#define ll long long
#define ld long double
// loops
#define fr(i, z, n) for (ll i = z; i < n; i++)
#define br(i, z, n) for (ll i = z; i > n; i--)
// operations
#define mp make_pair
#define ff first
#define ss second
#define pub push_back
#define all(v) v.begi... | replace | 71 | 73 | 71 | 73 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<pair<int, int>> A;
ll relaxed(int i, ll cap) {
ll result = 0;
while (i < A.size()) {
if (A[i].first <= cap) {
cap -= A[i].first;
result += A[i].second;
i++;
} else {
// result += (A[i].second * cap + A[i].f... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<pair<int, int>> A;
ll relaxed(int i, ll cap) {
ll result = 0;
while (i < A.size()) {
if (A[i].first <= cap) {
cap -= A[i].first;
result += A[i].second;
i++;
} else {
result += (A[i].second * cap + A[i].firs... | replace | 16 | 18 | 16 | 18 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
u... | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
u... | replace | 315 | 318 | 315 | 318 | 127 | /tmp/8188185e-41f8-44a3-86cc-3c237dc478cb.out: error while loading shared libraries: libc.so.6: failed to map segment from shared object
|
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using lli = long long int;
vector<lli> input(int N) {
vector<lli> r(N);
for (int i = 0; i < N; i++)
cin >> r[i];
return r;
}
int main() {
lli N, W;
cin >> N >> W;
lli dp[100][100000];
for (int i = 0; i... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using lli = long long int;
vector<lli> input(int N) {
vector<lli> r(N);
for (int i = 0; i < N; i++)
cin >> r[i];
return r;
}
int main() {
lli N, W;
cin >> N >> W;
lli dp[110][100010];
for (int i = 0; i... | replace | 18 | 19 | 18 | 19 | -11 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ini(a, i) memset(a, i, sizeof(a))
#define forf(i, a,... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ini(a, i) memset(a, i, sizeof(a))
#define forf(i, a,... | replace | 83 | 87 | 83 | 87 | -11 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n... | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n... | replace | 15 | 20 | 15 | 21 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef ve... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef ve... | replace | 51 | 52 | 51 | 52 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main() {
int n, w;
cin >> n >> w;
pair<long long, long long> arr[n];
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
arr[i] = make_pair(a, b);
}
long long dp[n + 1][w + 1];
for (int i = 0; i <= n; ++i) {
... | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main() {
int n, w;
cin >> n >> w;
pair<long long, long long> arr[n];
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
arr[i] = make_pair(a, b);
}
long long dp[n + 1][w + 1];
for (int i = 0; i <= n; ++i) {
... | replace | 42 | 43 | 42 | 43 | 1 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
long long dp[2][(unsigned int)(1e5 + 1)];
int main() {
int n, w;
cin >> n >> w;
pair<long long, long long> arr[n];
for (int i = 0; i < n; ++i) {
long long a, b;
cin >> a >> b;
arr[i] = make_pair(a, b);
}
for (int i = 0... | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
long long dp[2][(unsigned int)(1e5 + 1)];
int main() {
int n, w;
cin >> n >> w;
pair<long long, long long> arr[n];
for (int i = 0; i < n; ++i) {
long long a, b;
cin >> a >> b;
arr[i] = make_pair(a, b);
}
for (int i = 0... | replace | 44 | 45 | 44 | 45 | 1 | |
p03163 | Python | Time Limit Exceeded | #!/usr/bin/env python3
def main():
import numpy as np
N, W = map(int, input().split())
products = [list(map(int, input().split())) for _ in range(N)]
dp = np.zeros((N * 2, (W + 1)), dtype=np.int64)
for n in range(N):
for w in range(W + 1):
can_w, can_v = products[n]
... | #!/usr/bin/env python3
def main():
import numpy as np
N, W = map(int, input().split())
products = [list(map(int, input().split())) for _ in range(N)]
dp = np.zeros(W + 1, dtype=np.int64)
for can_w, can_v in products:
dp[can_w:] = np.maximum(dp[can_w:], dp[:-can_w] + can_v)
print(np.ma... | replace | 7 | 14 | 7 | 11 | TLE | |
p03163 | Python | Runtime Error | N, W = map(int, input().split())
wv = []
for _ in range(N):
wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 110 for _ in range(100100)]
for i in range(N):
for sum_w in range(W + 1):
if wv[i][0] <= sum_w:
dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + ... | N, W = map(int, input().split())
wv = []
for _ in range(N):
wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 100100 for _ in range(110)]
for i in range(N):
for sum_w in range(W + 1):
if wv[i][0] <= sum_w:
dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + ... | replace | 5 | 6 | 5 | 6 | 1 | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03163/Python/s607479372.py", line 6, in <module>
dp = [[0] * 110 for _ in range(100100)]
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03163/Python/s607479372.py", line 6, in <listcomp>... |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
template <class T> inline bool chmax(T &... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
template <class T> inline bool chmax(T &... | replace | 42 | 43 | 42 | 43 | 0 | |
p03163 | C++ | Runtime Error | /*
Written by Nitrogens
Desire for getting accepted!!
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
ty... | /*
Written by Nitrogens
Desire for getting accepted!!
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
ty... | replace | 46 | 47 | 46 | 47 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = lo... | #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = lo... | replace | 42 | 43 | 42 | 43 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define ll long long
#define faltu \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define ll long long
#define faltu \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | replace | 50 | 51 | 50 | 51 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k;
int a[N];
int b[N];
long long dp[105][N];
long long f(int idx, int weight) {
if (weight > k)
return -1e9;
if (idx >= n)
return 0;
long long &ret = dp[idx][weight];
ret = max(f(idx + 1, weight + a[idx]) + b[idx], f(idx + 1, w... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k;
int a[N];
int b[N];
long long dp[105][N];
long long f(int idx, int weight) {
if (weight > k)
return -1e9;
if (idx >= n)
return 0;
long long &ret = dp[idx][weight];
if (ret != -1)
return ret;
ret = max(f(idx + 1, weight... | insert | 14 | 14 | 14 | 16 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define endl '\n'
#define N 100005
using namespace std;
ll w[N], v[N], n, have;
ll dp[105][N];
ll rec(int can, int i) {
if (i == n)
return 0;
if (dp[can][i] != -1)
return dp[can][i];
ll ans =... | #include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define endl '\n'
#define N 100005
using namespace std;
ll w[N], v[N], n, have;
ll dp[N][105];
ll rec(int can, int i) {
if (i == n)
return 0;
if (dp[can][i] != -1)
return dp[can][i];
ll ans =... | replace | 9 | 10 | 9 | 10 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9;
int main() {
int N, W, w[100], v[100];
cin >> N >> W;
for (int i(0); i < N; i++)
cin >> w[i] >> v[i];
ll dp[101][10001] = {
0}; // i番目までを使って重さw以下になるように選んだ時の価値の最大値
for (int i(0); i < N; i++) {
for (int j(0); j <= W... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9;
int main() {
int N, W, w[100], v[100];
cin >> N >> W;
for (int i(0); i < N; i++)
cin >> w[i] >> v[i];
ll dp[101][100001] = {
0}; // i番目までを使って重さw以下になるように選んだ時の価値の最大値
for (int i(0); i < N; i++) {
for (int j(0); j <= ... | replace | 10 | 11 | 10 | 11 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
int w[101], v[101];
ll dp[101][100001] = {0};
int main() {
int N, W;
cin >> N >> W;
for (int i(1); i <= N; i++)
cin >> w[i] >> v[i];
for (int ni(1); ni <= N; ni++) {
for (int wi(0); wi <= W; wi++) {
if (wi - w[n... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
int w[101], v[101];
ll dp[101][100001] = {0};
int main() {
int N, W;
cin >> N >> W;
for (int i(1); i <= N; i++)
cin >> w[i] >> v[i];
for (int ni(1); ni <= N; ni++) {
for (int wi(0); wi <= W; wi++) {
if (wi - w[n... | delete | 21 | 27 | 21 | 21 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a); i <= (b); i++)
#define PER(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S ... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a); i <= (b); i++)
#define PER(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S ... | replace | 18 | 19 | 18 | 19 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define mod 1000000007
#define vll vector<ll>
ll val[105], wt[105], ti[105][105];
ll func(ll len, ll w) {
if (len <= 0 || w <= 0)
return 0;
if (ti[len][w] != -1)
re... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define mod 1000000007
#define vll vector<ll>
ll val[105], wt[105], ti[105][100005];
ll func(ll len, ll w) {
if (len <= 0 || w <= 0)
return 0;
if (ti[len][w] != -1)
... | replace | 9 | 10 | 9 | 10 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf printf
#define NL pf("\n")
#define ms(a, b) memset(a, b, sizeof(a))
#define pb(a) push_bac... | #include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf printf
#define NL pf("\n")
#define ms(a, b) memset(a, b, sizeof(a))
#define pb(a) push_bac... | replace | 101 | 102 | 101 | 102 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
ll w[100], v[100], dp[101][100001];
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; ++i) {
for (int wi = 0; wi <= W; ++wi) {
dp[i + 1][wi] = max(dp... | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
ll w[100], v[100], dp[101][100001];
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; ++i) {
for (int wi = 0; wi <= W; ++wi) {
dp[i + 1][wi] = max(dp... | replace | 18 | 19 | 18 | 20 | 0 | |
p03163 | C++ | Runtime Error | #include <iostream>
using namespace std;
typedef long long ll;
ll dp[100][100005];
int main(int argc, char *argv[]) {
int N, W, w[100005], v[100005];
cin >> N >> W;
for (int i = 0; i < N; i++) {
cin >> w[i] >> v[i];
}
for (int i = 0; i <= W; i++) {
dp[0][i] = 0;
}
for (int i = 0; i < N; i++)... | #include <iostream>
using namespace std;
typedef long long ll;
ll dp[105][100005];
int main(int argc, char *argv[]) {
int N, W, w[100005], v[100005];
cin >> N >> W;
for (int i = 0; i < N; i++) {
cin >> w[i] >> v[i];
}
for (int i = 0; i <= W; i++) {
dp[0][i] = 0;
}
for (int i = 0; i < N; i++)... | replace | 6 | 7 | 6 | 7 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, w;
cin >> n >> w;
ll dp[n + 1][w + 1];
ll a[n + 1], b[n + 1];
for (ll i = 1; i <= n; i++)
cin >> a[i] >> b[i];
for (ll i = 0; i <= w; i++)
dp[0][i] = 0;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, w;
cin >> n >> w;
ll dp[n + 1][w + 1];
ll a[n + 1], b[n + 1];
for (ll i = 1; i <= n; i++)
cin >> a[i] >> b[i];
for (ll i = 0; i <= w; i++)
dp[0][i] = 0;
... | replace | 17 | 19 | 17 | 21 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9 + 5;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n;
cin >> n;
int W;
cin >> W;
vector<int> w(n + 1);
vector<int> v(n + 1);
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9 + 5;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n;
cin >> n;
int W;
cin >> W;
vector<int> w(n + 1);
vector<int> v(n +... | replace | 5 | 7 | 5 | 7 | -11 | |
p03163 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
// int h[100001];
unsigned long long dp[100001] = {};
/*
int solve(int i){
if(i == 0) return 0;
if(i == 1) return 0;
if(memo[i] != -1) return memo[i];
int m = INT_MAX;
for(int d = 1; d <= k; d++){
if(i - d < 0) break... | #include "bits/stdc++.h"
using namespace std;
// int h[100001];
unsigned long long dp[100001] = {};
/*
int solve(int i){
if(i == 0) return 0;
if(i == 1) return 0;
if(memo[i] != -1) return memo[i];
int m = INT_MAX;
for(int d = 1; d <= k; d++){
if(i - d < 0) break... | replace | 28 | 29 | 28 | 29 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N, W;
cin >> N >> W;
vector<long> w(N + 1), v(N + 1);
for (int i = 1; i <= N; ++i)
cin >> w[i] >> v[i];
// dp[i][j]: i 番目までの品物から重さの和が j 以下になるように
// 選んだときの価値の最大値
long dp[101][10001];
for (int ... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N, W;
cin >> N >> W;
vector<long> w(N + 1), v(N + 1);
for (int i = 1; i <= N; ++i)
cin >> w[i] >> v[i];
// dp[i][j]: i 番目までの品物から重さの和が j 以下になるように
// 選んだときの価値の最大値
long dp[101][100001];
for (int... | replace | 14 | 15 | 14 | 15 | 0 | |
p03163 | Python | Time Limit Exceeded | N, M = map(int, input().split())
W, V = [], []
for n in range(N):
w, v = map(int, input().split())
W.append(w)
V.append(v)
def f(n, m):
if n == 0 or m <= 0:
return 0
elif m < W[n - 1]:
return f(n - 1, m)
else:
return max(f(n - 1, m), f(n - 1, m - W[n - 1]) + V[n - 1])
... | N, M = map(int, input().split())
W, V = [], []
for n in range(N):
w, v = map(int, input().split())
W.append(w)
V.append(v)
f = [[0 for m in range(M + 1)] for n in range(N + 1)]
for n in range(N):
for m in range(M + 1):
if m < W[n]:
f[n + 1][m] = f[n][m]
else:
f[n ... | replace | 6 | 18 | 6 | 14 | TLE | |
p03163 | Python | Time Limit Exceeded | import numpy as np
n, W = map(int, input().split())
wv = np.array([list(map(int, input().split())) for i in range(n)])
dp = np.zeros((n + 1, W + 1), dtype=np.int)
def chmax(a, b):
if a > b:
return a
else:
return b
for i in range(n):
for sum_w in range(W + 1):
if sum_w >= wv[i, ... | import numpy as np
n, W = map(int, input().split())
wv = np.array([list(map(int, input().split())) for i in range(n)])
dp = np.zeros((n + 1, W + 1), dtype=np.int)
def chmax(a, b):
if a > b:
return a
else:
return b
# # 遅い
# for i in range(n):
# for sum_w in range(W + 1):
# if su... | replace | 15 | 22 | 15 | 26 | TLE | |
p03163 | Python | Time Limit Exceeded | def main():
N, W = map(int, input().split())
wi, vi = map(int, input().split())
dp = [0] * wi + [vi] * (W + 1 - wi)
for _ in range(1, N):
wi, vi = map(int, input().split())
dp[wi:] = [max(i + vi, j) for i, j in zip(dp, dp[wi:])]
print(dp[-1])
if __name__ == "__main__":
main()
| def main():
N, W = map(int, input().split())
wi, vi = map(int, input().split())
dp = [0] * wi + [vi] * (W + 1 - wi)
for _ in range(1, N):
wi, vi = map(int, input().split())
for i in range(W, wi - 1, -1):
t = dp[i - wi] + vi
if t > dp[i]:
dp[i] = t
... | replace | 6 | 7 | 6 | 10 | TLE | |
p03163 | Python | Time Limit Exceeded | N, W = [int(_) for _ in input().split()]
WV = sorted([[int(_) for _ in input().split()] for _ in range(N)], reverse=True)
dp = {}
dp[0] = 0
for w, v in WV:
dp_o = dp.copy()
for k in dp_o:
if k + w <= W:
dp[k + w] = max(dp_o.get(k + w, 0), dp_o[k] + v)
print(max([v for k, v in dp.items()]))
| N, W = [int(_) for _ in input().split()]
WV = [[int(_) for _ in input().split()] for _ in range(N)]
dp = {}
dp[0] = 0
for w, v in WV:
dp_o = dp.copy()
for k in dp_o:
if k + w <= W:
dp[k + w] = max(dp_o.get(k + w, 0), dp_o[k] + v)
print(max([v for k, v in dp.items()]))
| replace | 1 | 2 | 1 | 2 | TLE | |
p03163 | Python | Runtime Error | # using dp with memoization, TLE
from sys import stdin
N, W = map(int, input().split())
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]
dp = [0] * (W + 1)
next_dp = [0] * (W + 1)
for n in range(1, N + 1):
for w in range(0, W + 1):
if w >= s[n - 1][0]:
next_dp[w... | # using dp with memoization, TLE
from sys import stdin
N, W = map(int, input().split())
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]
dp = [0] * (W + 1)
next_dp = [0] * (W + 1)
for n in range(1, N + 1):
for w in range(0, W + 1):
if w >= s[n - 1][0]:
next_dp[w... | replace | 12 | 14 | 12 | 14 | 0 | |
p03163 | Python | Time Limit Exceeded | def knapsack1(weight_value, w):
cur = [0] * (w + 1)
nxt = cur.copy()
for weight, value in weight_value:
for i in range(1, weight):
nxt[i] = cur[i]
for i in range(weight, w + 1):
nxt[i] = max(cur[i], cur[i - weight] + value)
cur, nxt = nxt, cur
return cur[... | def knapsack1(weight_value, w):
cur = [0] * (w + 1)
nxt = [0] * (w + 1)
for weight, value in weight_value:
for i in range(1, weight):
nxt[i] = cur[i]
for i in range(weight, w + 1):
nxt[i] = max(cur[i], cur[i - weight] + value)
cur, nxt = nxt, cur
return c... | replace | 2 | 3 | 2 | 3 | TLE | |
p03163 | Python | Time Limit Exceeded | def main():
item_count, capacity = [int(x) for x in input().split()]
weights, values = [], []
for _ in range(item_count):
w, v = [int(x) for x in input().split()]
weights.append(w)
values.append(v)
# dp[i][j]
# = (i番目までの品物を、重さがj以下になるように選んだときの価値の最大値)
dp = [[0] * (capacity ... | def main():
item_count, capacity = [int(x) for x in input().split()]
weights, values = [], []
for _ in range(item_count):
w, v = [int(x) for x in input().split()]
weights.append(w)
values.append(v)
# dp[i][j]
# = (i番目までの品物を、重さがj以下になるように選んだときの価値の最大値)
dp = [[0] * (capacity ... | replace | 12 | 13 | 12 | 14 | TLE | |
p03163 | Python | Time Limit Exceeded | import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N, W = map(int, input().split())
item = []
for _ in range(N):
w, v = map(int, input().split())
item.append((w, v))
dp = [0] * (W + 1)
for ... | import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N, W = map(int, input().split())
item = []
for _ in range(N):
w, v = map(int, input().split())
item.append((w, v))
dp = [0] * (W + 1)
for ... | replace | 20 | 25 | 20 | 24 | TLE | |
p03163 | Python | Time Limit Exceeded | import sys
def main():
input = sys.stdin.readline
N, W = map(int, input().split())
dp = [0] * (W + 1)
WV = (map(int, input().split()) for _ in range(N))
for w, v in WV:
for j in range(W, w - 1, -1):
dp[j] = max(dp[j], dp[j - w] + v)
print(dp[-1])
main()
| import sys
def main():
input = sys.stdin.readline
N, W = map(int, input().split())
dp = [0] * (W + 1)
WV = (map(int, input().split()) for _ in range(N))
for w, v in WV:
for j in range(W, w - 1, -1):
tmp = dp[j - w] + v
if tmp > dp[j]:
dp[j] = tmp
... | replace | 13 | 14 | 13 | 16 | TLE | |
p03163 | Python | Runtime Error | import sys
sys.setrecursionlimit(10**8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, W = map(int, readline().split())
things = []
for i in range(N):
weight, value = map(int, readline().split())
things.append((weight, value))
def solve():
dp ... | import sys
sys.setrecursionlimit(10**8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, W = map(int, readline().split())
things = []
for i in range(N):
weight, value = map(int, readline().split())
things.append((weight, value))
def solve():
dp ... | replace | 20 | 21 | 20 | 21 | 0 | |
p03163 | Python | Time Limit Exceeded | #!/usr/bin/env python3
# vim: set fileencoding=utf-8
# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation
"""Module docstring
"""
import sys
EMPTY = (0, 0, frozenset())
def solve(values, _nb, max_capacity):
dp = [0] * (max_capacity + 1)
for w, v in values:
for j in r... | #!/usr/bin/env python3
# vim: set fileencoding=utf-8
# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation
"""Module docstring
"""
import sys
EMPTY = (0, 0, frozenset())
def solve(values, _nb, max_capacity):
dp = [0] * (max_capacity + 1)
for w, v in values:
for j in r... | replace | 18 | 20 | 18 | 21 | TLE | |
p03163 | C++ | Runtime Error | //
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <set>
#include <vector>
//
using ll = long long;
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"... | //
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <set>
#include <vector>
//
using ll = long long;
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"... | replace | 48 | 49 | 48 | 49 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, w;
cin >> n >> w;
int v[n], wt[n];
for (int i = 0; i < n; i++) {
cin >> wt[i];
cin >> v[i];
}
vector<long long> dp(w + 1, 0);
for (int i = 0; i < n; i++) {
for (int j = w - i; j >= 0; j--) {
dp[j + wt[i]] = max(dp[j + wt... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, w;
cin >> n >> w;
int v[n], wt[n];
for (int i = 0; i < n; i++) {
cin >> wt[i];
cin >> v[i];
}
vector<long long> dp(w + 1, 0);
for (int i = 0; i < n; i++) {
for (long long j = w - wt[i]; j >= 0; j--) {
dp[j + wt[i]] = max... | replace | 13 | 14 | 13 | 14 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define ford(i, n) for (int i = n; i > 0; i--)
#define forin(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define all(a) a... | #include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define ford(i, n) for (int i = n; i > 0; i--)
#define forin(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define all(a) a... | replace | 30 | 31 | 30 | 31 | 0 | |
p03163 | C++ | Runtime Error | /*
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| |
| author : thanos1399 Language : C ++ |
| college : MSIT |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _... | /*
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| |
| author : thanos1399 Language : C ++ |
| college : MSIT |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _... | replace | 146 | 147 | 146 | 147 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fastIO \
ios::sync_with_stdio(NULL); \
cin.tie(NULL);
using namespace std;
const int N = 1E5 + 7;
long long f[100][N];
int n, W;
long long w[N], c[N];
int main() {
f... | #include <bits/stdc++.h>
#define fastIO \
ios::sync_with_stdio(NULL); \
cin.tie(NULL);
using namespace std;
const int N = 1E5 + 7;
long long f[107][N];
int n, W;
long long w[N], c[N];
int main() {
f... | replace | 8 | 9 | 8 | 9 | 0 | |
p03163 | C++ | Runtime Error |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
/*
||||||||||||||||||||||||||||||||||||||||||||||||
| ||| | |||| |||| | |
| | | | | | | | | | |
| | | | | | | | | | |
... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
/*
||||||||||||||||||||||||||||||||||||||||||||||||
| ||| | |||| |||| | |
| | | | | | | | | | |
| | | | | | | | | | |
... | replace | 108 | 111 | 108 | 109 | -11 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define vi vector<float>
#define vl ... | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define vi vector<float>
#define vl ... | replace | 34 | 38 | 34 | 38 | -11 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inli... | #include <bits/stdc++.h>
using namespace std;
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inli... | replace | 24 | 26 | 24 | 26 | 0 | |
p03163 | C++ | Runtime Error | #include <iostream>
using namespace std;
const int NMAX = 100;
const int WMAX = 100001;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int N, W;
int w[NMAX], v[NMAX];
long long DP[NMAX][WMAX] = {};
int main() {
cin >> N >> W;
for (int i = 0; i < ... | #include <iostream>
using namespace std;
const int NMAX = 101;
const int WMAX = 100001;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int N, W;
int w[NMAX], v[NMAX];
long long DP[NMAX][WMAX] = {};
int main() {
cin >> N >> W;
for (int i = 0; i < ... | replace | 2 | 3 | 2 | 3 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long int N, v[50], w[50], W;
long long m[100002][102];
long long int resi(long long int W, long long int N) {
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= W; j++) {
if (i == 0 || j == 0)
m[j][i] = 0;
else {
if (j < w[i - 1]) ... | #include <bits/stdc++.h>
using namespace std;
long long int N, v[102], w[102], W;
long long m[100002][102];
long long int resi(long long int W, long long int N) {
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= W; j++) {
if (i == 0 || j == 0)
m[j][i] = 0;
else {
if (j < w[i - 1]... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error | // It doesn't matter how slow you go, Unless you don't stop.
#include <algorithm>
#include <bitset>
#include <iostream>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <... | // It doesn't matter how slow you go, Unless you don't stop.
#include <algorithm>
#include <bitset>
#include <iostream>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <... | replace | 39 | 40 | 39 | 40 | -6 | corrupted size vs. prev_size
|
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define mp make_pair
#define eb emplace_back
#define pb push_back
#define ss second
#define ff first
#define IOS \
ios::sync_with_stdio(0); ... | #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define mp make_pair
#define eb emplace_back
#define pb push_back
#define ss second
#define ff first
#define IOS \
ios::sync_with_stdio(0); ... | replace | 56 | 60 | 56 | 60 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll aw[105], av[105], dp[105][105] = {0}, n;
ll fun(ll i, ll w) {
if (dp[i][w] != -1)
return dp[i][w];
if (i == n + 1)
return 0;
ll ans1, ans2;
ans1 = fun(i + 1, w);
if (w - aw[i] >= 0)
ans2 = av[i] + fun(i + 1, w - aw[i]);
else
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll aw[105], av[105], dp[105][100007] = {0}, n;
ll fun(ll i, ll w) {
if (dp[i][w] != -1)
return dp[i][w];
if (i == n + 1)
return 0;
ll ans1, ans2;
ans1 = fun(i + 1, w);
if (w - aw[i] >= 0)
ans2 = av[i] + fun(i + 1, w - aw[i]);
els... | replace | 3 | 4 | 3 | 4 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define int lo... | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define int lo... | 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 < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int N,... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int N,... | replace | 15 | 16 | 15 | 16 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r1 101
#define c1 10001
ll int knapsack(ll int *w, ll int *val, ll int sum, ll int n, ll int dp[][c1]) {
if (sum <= 0 || n <= 0)
return 0;
if (dp[n][sum] != -1)
return dp[n][sum];
if (w[n - 1] <= sum)
return dp[n][sum] =
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r1 101
#define c1 100001
ll int knapsack(ll int *w, ll int *val, ll int sum, ll int n, ll int dp[][c1]) {
if (sum <= 0 || n <= 0)
return 0;
if (dp[n][sum] != -1)
return dp[n][sum];
if (w[n - 1] <= sum)
return dp[n][sum] =
... | replace | 4 | 5 | 4 | 5 | 0 | |
p03163 | C++ | Runtime Error |
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 100;
const int MAXW = 100000;
unsigned long long dp[MAXN + 1][MAXW + 1];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, W;
cin >> n >> W;
int v[n], w[n];
for (int i = 0; i < n; i++) {
cin >> w[i] ... |
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 100;
const int MAXW = 100000;
unsigned long long dp[MAXN + 1][MAXW + 1];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, W;
cin >> n >> W;
int v[n + 1], w[n + 1];
for (int i = 1; i <= n; i++) {
cin... | replace | 15 | 17 | 15 | 17 | 0 | |
p03163 | C++ | Runtime Error | #define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
struct edge {
int t, f, w;
bool operator<(const edge &e) const { return w > e.w; }
edge(int from, int to, int weight) {
t = to;... | #define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
struct edge {
int t, f, w;
bool operator<(const edge &e) const { return w > e.w; }
edge(int from, int to, int weight) {
t = to;... | replace | 55 | 56 | 55 | 56 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false), cin.tie(NULL);
#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountl... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false), cin.tie(NULL);
#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountl... | replace | 38 | 39 | 38 | 39 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define watch(x) cout << (#x) << " = " << x << endl;
#define mkp make_pair
#define mkt make_tuple
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
int n, W;
ll dp[110][10010];
int w[110], v[110];
int main() {
scanf("%d%d", &n, &W);
for (int i = 1; i... | #include <bits/stdc++.h>
#define watch(x) cout << (#x) << " = " << x << endl;
#define mkp make_pair
#define mkt make_tuple
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
int n, W;
ll dp[110][100010];
int w[110], v[110];
int main() {
scanf("%d%d", &n, &W);
for (int i = 1; ... | replace | 12 | 13 | 12 | 13 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
using namespace std;
int wt[105];
int val[105];
int ans[105][10005];
int N, w;
int ks(int n, int c) {
if (ans[n][c] != -1)
return ans[n][c];
if (n == 0 or c == 0)
return 0;
if (wt[n - 1] > c)
return ks(n - 1, c);
int a = ks(n - 1, c);
int b = val[n - ... | #include <bits/stdc++.h>
#define int long long
using namespace std;
int wt[105];
int val[105];
int ans[105][100005];
int N, w;
int ks(int n, int c) {
if (ans[n][c] != -1)
return ans[n][c];
if (n == 0 or c == 0)
return 0;
if (wt[n - 1] > c)
return ks(n - 1, c);
int a = ks(n - 1, c);
int b = val[n -... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long recurse(int n, int w, vector<int> weights, vector<long long> values,
vector<vector<long long>> dp) {
if (w <= 0 || n <= 0)
return 0;
else {
if (dp[w][n] != -1)
return dp[w][n];
else {
if (w - weights[n - 1] >= 0)
... | #include <bits/stdc++.h>
using namespace std;
long long recurse(int n, int w, vector<int> &weights, vector<long long> &values,
vector<vector<long long>> &dp) {
if (w <= 0 || n <= 0)
return 0;
else {
if (dp[w][n] != -1)
return dp[w][n];
else {
if (w - weights[n - 1] >= 0)
... | replace | 4 | 6 | 4 | 6 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define INF (1 << 30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;
ll dp[110][100100];
int main() {
ll n, wc;
cin >> n >> wc;
vector<ll> w(n, 0);
vector<ll> v(n, 0);
for (int i = 0; i < n; ++i) {
cin >> w[i + 1] >> v[i + 1];
}
for (l... | #include <bits/stdc++.h>
#define INF (1 << 30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;
ll dp[110][100100];
int main() {
ll n, wc;
cin >> n >> wc;
vector<ll> w(n + 10, 0);
vector<ll> v(n + 10, 0);
for (int i = 0; i < n; ++i) {
cin >> w[i + 1] >> v[i + 1];
... | replace | 12 | 14 | 12 | 14 | -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 <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <utility>
#include <vector>
#define fir first
#define sec second
#define sz(s) (s).size();
#define pb push_back
#define get(n) scanf("%d", &n);
#define gets(s) ... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <utility>
#include <vector>
#define fir first
#define sec second
#define sz(s) (s).size();
#define pb push_back
#define get(n) scanf("%d", &n);
#define gets(s) ... | replace | 135 | 136 | 135 | 136 | 0 | |
p03163 | C++ | Runtime Error | /*Function Template*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define Rep(i, n) for (ll i = 1; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define IOS ... | /*Function Template*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define Rep(i, n) for (ll i = 1; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define IOS ... | replace | 145 | 146 | 145 | 146 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
int main() {
ll N, W;
cin >> N >> W;
vector<ll> weight(N), value(N);
rep(i, N) cin >> weight[i] >> value[i];
ll dp[110][100010];
rep(i, N + 1) dp[0][i] = 0;
rep(i, N) {
rep(j, W + 1) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
int main() {
ll N, W;
cin >> N >> W;
vector<ll> weight(N), value(N);
rep(i, N) cin >> weight[i] >> value[i];
ll dp[110][100010];
rep(i, N + 1) dp[0][i] = 0;
rep(i, N) {
rep(j, W + 1) ... | replace | 13 | 14 | 13 | 14 | -11 | |
p03163 | C++ | Runtime Error | /*
@author : srinathbalaji_99
*/
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for (long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define P... | /*
@author : srinathbalaji_99
*/
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for (long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define P... | replace | 55 | 59 | 55 | 59 | TLE | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long w[1010];
long long v[1010];
int N;
long long dp[110][100010];
long long mo(int pos, long long W) {
if (W < 0)
return -1e9;
if (pos == N) {
return 0;
}
long long re = dp[pos][W];
if (re != -1)
return re;
re = max(mo(pos + 1, W), mo(pos + 1,... | #include <bits/stdc++.h>
using namespace std;
long long w[1010];
long long v[1010];
int N;
long long dp[110][100010];
long long mo(int pos, long long W) {
if (W < 0)
return -1e9;
if (pos == N) {
return 0;
}
long long &re = dp[pos][W];
if (re != -1)
return re;
re = max(mo(pos + 1, W), mo(pos + 1... | replace | 12 | 13 | 12 | 13 | TLE | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i ... | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i ... | replace | 41 | 42 | 41 | 42 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define endl "\n"
#define sd(val) scanf("%d", &val)
#define ss(val) scanf("%s", &val)
#define sl(val) scanf("%lld", &val)
#define debug(val) printf("check%d\n", val)
#define all(v) v.begin(), v.end()
#define PB push_back
... | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define endl "\n"
#define sd(val) scanf("%d", &val)
#define ss(val) scanf("%s", &val)
#define sl(val) scanf("%lld", &val)
#define debug(val) printf("check%d\n", val)
#define all(v) v.begin(), v.end()
#define PB push_back
... | replace | 31 | 32 | 31 | 32 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c... | replace | 30 | 31 | 30 | 31 | 0 | |
p03163 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
long long int n, w;
cin >> n >> w;
long long int weight[n + 1], value[n + 1];
for (ll int i = 1; i <= n; i++) {
cin >> weight[i] >> value[i];
}
ll int dp[n + 1][w + 1];
for (ll int i = 0; i <= n; i++) {
dp[i][0] = 0;
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
long long int n, w;
cin >> n >> w;
long long int weight[n + 1], value[n + 1];
for (ll int i = 1; i <= n; i++) {
cin >> weight[i] >> value[i];
}
ll int dp[n + 1][w + 1];
for (ll int i = 0; i <= n; i++) {
dp[i][0] = 0;
... | replace | 21 | 27 | 21 | 23 | TLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define pb push_back
#define rep(a, b, c) for (int a = (int)b; a < (int)c; a++)
#define repk(a, b, c, k) for (int a = (int)b; a < (int)c; a += (int)k)
#define comeback \
std::ios_base::sync_with_stdio(false); ... | #include <bits/stdc++.h>
#define pb push_back
#define rep(a, b, c) for (int a = (int)b; a < (int)c; a++)
#define repk(a, b, c, k) for (int a = (int)b; a < (int)c; a += (int)k)
#define comeback \
std::ios_base::sync_with_stdio(false); ... | replace | 27 | 32 | 27 | 33 | -11 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, w;
int value[100], weight[100];
long int bag[100][10005] = {0};
cin >> n;
cin >> w;
for (int i = 0; i < n; i++) {
cin >> weight[i] >> value[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= w; j++) {
if (weight[i]... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, w;
int value[100], weight[100];
long int bag[101][100005] = {0};
cin >> n;
cin >> w;
for (int i = 0; i < n; i++) {
cin >> weight[i] >> value[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= w; j++) {
if (weight[i... | replace | 5 | 6 | 5 | 6 | 0 | |
p03163 | C++ | Memory Limit Exceeded | #include <bits/stdc++.h>
#define int long long
using namespace std;
int n, w;
int dp[100001][1001];
int v[100001][1001];
int w1[100001];
int v1[100001];
int s1(int wr, int i) {
if (wr < 0) {
return INT_MIN;
}
if (i == n + 1) {
return 0;
}
if (v[wr][i]) {
return dp[wr][i];
}
v[wr][i] = 1;
... | #include <bits/stdc++.h>
#define int long long
using namespace std;
int n, w;
int dp[100001][101];
int v[100001][101];
int w1[101];
int v1[101];
int s1(int wr, int i) {
if (wr < 0) {
return INT_MIN;
}
if (i == n + 1) {
return 0;
}
if (v[wr][i]) {
return dp[wr][i];
}
v[wr][i] = 1;
dp[wr][i... | replace | 5 | 9 | 5 | 9 | MLE | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define mod 1000000007
#define inf (1LL << 60)
#define f(i, a, b) for (int i = a; i < b; ++i)
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, w;
cin >> n >> w;
pair<int, int> p[n];
for (i... | #include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define mod 1000000007
#define inf (1LL << 60)
#define f(i, a, b) for (int i = a; i < b; ++i)
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, w;
cin >> n >> w;
pair<int, int> p[n];
for (i... | replace | 22 | 24 | 22 | 25 | 0 | |
p03163 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fastii \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define endl "\n"... | #include <bits/stdc++.h>
using namespace std;
#define fastii \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define endl "\n"... | replace | 22 | 23 | 22 | 23 | 0 | |
p03163 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <queue>
#include <stack>
#include <vector>
typedef long long ll;
using namespace std;
#define rep(x, y) for (ll i = x; i <= y; i++)
#define repi(x, y) for (ll i = x; i >= y; i--)
priority_queue<l... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <queue>
#include <stack>
#include <vector>
typedef long long ll;
using namespace std;
#define rep(x, y) for (ll i = x; i <= y; i++)
#define repi(x, y) for (ll i = x; i >= y; i--)
priority_queue<l... | replace | 22 | 23 | 22 | 23 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.