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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02787 | C++ | Runtime Error |
#include <bits/stdc++.h>
using namespace std;
int w[300], c[300], f[300010];
int V, n, mx;
int main() {
scanf("%d%d", &V, &n);
for (int i = 1; i <= n; i++) {
scanf("%d%d", &w[i], &c[i]);
mx = max(mx, w[i]);
}
memset(f, 0x3f, sizeof f);
f[0] = 0;
for (int i = 1; i <= n; i++)
for (int j = w[i]; j... |
#include <bits/stdc++.h>
using namespace std;
int w[300010], c[300010], f[300010];
int V, n, mx;
int main() {
scanf("%d%d", &V, &n);
for (int i = 1; i <= n; i++) {
scanf("%d%d", &w[i], &c[i]);
mx = max(mx, w[i]);
}
memset(f, 0x3f, sizeof f);
f[0] = 0;
for (int i = 1; i <= n; i++)
for (int j = w... | replace | 3 | 4 | 3 | 4 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define BIT(n) (1LL << (n))
#define BITF(n, i) (((n) >> (i)) & 1)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define REPI(i, x) for (int i = 1; i <= x; i++)
#define FORI(i, m, n) for (int i = m; i <= n; i++)
#define REPR(i... | #include <bits/stdc++.h>
using namespace std;
#define BIT(n) (1LL << (n))
#define BITF(n, i) (((n) >> (i)) & 1)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define REPI(i, x) for (int i = 1; i <= x; i++)
#define FORI(i, m, n) for (int i = m; i <= n; i++)
#define REPR(i... | replace | 128 | 129 | 128 | 129 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int dp[14010][10010];
int main() {
int H, N;
cin >> H >> N;
int A[1010], B[1010];
for (int i = 1; i <= N; i++) {
cin >> A[i] >> B[i];
}
vector<int> P, Q;
for (int i = 1; i <= N; i++) {
int nowA = A[i];
int nowB = B[i];
P.push_back(nowA);
Q.... | #include <bits/stdc++.h>
using namespace std;
int dp[15010][10010];
int main() {
int H, N;
cin >> H >> N;
int A[1010], B[1010];
for (int i = 1; i <= N; i++) {
cin >> A[i] >> B[i];
}
vector<int> P, Q;
for (int i = 1; i <= N; i++) {
int nowA = A[i];
int nowB = B[i];
P.push_back(nowA);
Q.... | replace | 2 | 3 | 2 | 3 | -11 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
ll h, ... | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
ll h, ... | replace | 28 | 31 | 28 | 31 | 0 | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T... | #include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T... | replace | 48 | 51 | 48 | 49 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int H, N;
cin >> H >> N;
vector<int> A(N);
vector<int> B(N);
int maxA = 0;
for (int i = 0; i < N; i++) {
cin >> A.at(i) >> B.at(i);
if (A.at(i) > maxA) {
maxA = A.at(i);
}
}
cerr << "maxA " << maxA << endl;
int l = H + max... | #include <bits/stdc++.h>
using namespace std;
int main() {
int H, N;
cin >> H >> N;
vector<int> A(N);
vector<int> B(N);
int maxA = 0;
for (int i = 0; i < N; i++) {
cin >> A.at(i) >> B.at(i);
if (A.at(i) > maxA) {
maxA = A.at(i);
}
}
cerr << "maxA " << maxA << endl;
int l = H + max... | replace | 24 | 25 | 24 | 25 | -6 | maxA 8
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)
|
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int)x.size())
#define pb push_back
#define mp make_pai... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int)x.size())
#define pb push_back
#define mp make_pai... | insert | 54 | 54 | 54 | 57 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << (x) << endl
#define INF (int)1e9
#define MOD ((int)1e9 + 7)
using namespace std;
typedef long long llong;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<v... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << (x) << endl
#define INF (int)1e9
#define MOD ((int)1e9 + 7)
using namespace std;
typedef long long llong;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<v... | replace | 38 | 39 | 38 | 39 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
struct P {
int a, b;
};
template <class T> void chmin(T &a, T b) {
if (b < a)
a = b;
}
int main() {
int h, n;
cin >> h >> n;
ve... | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
struct P {
int a, b;
};
template <class T> void chmin(T &a, T b) {
if (b < a)
a = b;
}
int main() {
int h, n;
cin >> h >> n;
ve... | replace | 35 | 36 | 35 | 36 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f;
const ll maxh = 11111;
const ll maxn = 1010;
ll a[maxn], b[maxn];
ll dp[maxh];
int main() {
ios::sync_with_stdio(false);
ll h, n;
while (~scanf("%lld%lld", &h, &n)) {
for (ll i = 0; i < n; i++)
scanf("%lld%lld",... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1000000010;
const ll maxh = 5e4 + 10;
const ll maxn = 1010;
ll a[maxn], b[maxn];
ll dp[maxh];
int main() {
ios::sync_with_stdio(false);
ll h, n;
while (~scanf("%lld%lld", &h, &n)) {
for (ll i = 0; i < n; i++)
scanf("%lld%... | replace | 3 | 5 | 3 | 5 | 0 | |
p02787 | C++ | Time Limit Exceeded | // Created by conan1024hao in 2019.
// Copyright © 2019 conan1024hao. All rights reserved.
// 専用ライブラリです、自由にコピーして構いません。
// 感谢看我的代码!Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize("O3")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#inclu... | // Created by conan1024hao in 2019.
// Copyright © 2019 conan1024hao. All rights reserved.
// 専用ライブラリです、自由にコピーして構いません。
// 感谢看我的代码!Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize("O3")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#inclu... | replace | 94 | 97 | 94 | 97 | TLE | |
p02787 | C++ | Time Limit Exceeded | // Created by conan1024hao in 2019.
// Copyright © 2019 conan1024hao. All rights reserved.
// 専用ライブラリです、自由にコピーして構いません。
// 感谢看我的代码!Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize("O3")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#inclu... | // Created by conan1024hao in 2019.
// Copyright © 2019 conan1024hao. All rights reserved.
// 専用ライブラリです、自由にコピーして構いません。
// 感谢看我的代码!Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize("O3")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#inclu... | replace | 91 | 95 | 91 | 95 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define ll long long
int cut(int x) {
if (x > 0) {
return x;
} else {
return 0;
}
}
int main(void) {
int h, n;
cin >> h >> n;
vector<int> a(n), b(n);
for (int i = ... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define ll long long
int cut(int x) {
if (x > 0) {
return x;
} else {
return 0;
}
}
int main(void) {
int h, n;
cin >> h >> n;
vector<int> a(n), b(n);
for (int i = ... | replace | 36 | 39 | 36 | 37 | TLE | |
p02787 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int H, N;
cin >> H >> N;
int dp[H + 1];
const int INF = 1 << 30;
fill(dp, dp + H, INF);
dp[H] = 0;
while (N--) {
int a, b;
cin >> a >> b;
for (int i = H; i >= a; i--)
dp[i - a] = min(dp[i - a], b + dp[i]);
for (int i = a - 1; i >=... | #include <iostream>
using namespace std;
int main() {
int H, N;
cin >> H >> N;
int dp[H + 1];
const int INF = 1 << 30;
fill(dp, dp + H, INF);
dp[H] = 0;
while (N--) {
int a, b;
cin >> a >> b;
for (int i = H; i >= a; i--)
dp[i - a] = min(dp[i - a], b + dp[i]);
for (int i = min(H, a - ... | replace | 14 | 15 | 14 | 15 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define LL long long
#define maxn 200010
#define inf 0x3f3f3f3f3f3f
using namespace std;
LL dp[10010];
LL a[1010], b[1010];
int main() {
int n, w;
cin >> w >> n;
LL ma = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
ma = max(ma, b[i]);
}
for (int i = 0; i <= w + m... | #include <bits/stdc++.h>
#define LL long long
#define maxn 200010
#define inf 0x3f3f3f3f3f3f
using namespace std;
LL dp[100010];
LL a[1010], b[1010];
int main() {
int n, w;
cin >> w >> n;
LL ma = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
ma = max(ma, b[i]);
}
for (int i = 0; i <= w + ... | replace | 6 | 7 | 6 | 7 | 0 | |
p02787 | C++ | Runtime Error | #include <array>
#include <cstdio>
constexpr int inf = 1e9 + 334 + 810 + 1919;
constexpr int MAX_H = 1000;
std::array<int, MAX_H + 1> DP;
int readInt(void) {
char c;
do {
c = getchar_unlocked();
} while (c < '0');
int res = 0;
do {
res = 10 * res + c - '0';
c = getchar_unlocked();
} while (c >... | #include <array>
#include <cstdio>
constexpr int inf = 1e9 + 334 + 810 + 1919;
constexpr int MAX_H = 1e4;
std::array<int, MAX_H + 1> DP;
int readInt(void) {
char c;
do {
c = getchar_unlocked();
} while (c < '0');
int res = 0;
do {
res = 10 * res + c - '0';
c = getchar_unlocked();
} while (c >=... | replace | 4 | 5 | 4 | 5 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
pll A[105];
ll dp[105][10005];
int main()... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
pll A[1005];
ll dp[1005][10005];
int main... | replace | 14 | 16 | 14 | 16 | 0 | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | #include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | replace | 106 | 108 | 106 | 118 | TLE | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define repr(i, a, b) for (in... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define repr(i, a, b) for (in... | replace | 42 | 43 | 42 | 43 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
int main() {
int h, n;
cin >> h >> n;
vector<int> a(n), b(... | #include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
int main() {
int h, n;
cin >> h >> n;
vector<int> a(n), b(... | replace | 25 | 26 | 25 | 26 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#in... | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#in... | replace | 119 | 120 | 119 | 120 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02787 | C++ | Time Limit Exceeded | #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>;
const int INF = 1001001001;
int main() {
int h, n;
cin >> h >> n;
vector<vector<int>> ab(n, vector<int>(2, 0));
for (auto &v : ab) {
cin >> v[0] >> v[1];
}
ve... | #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>;
const int INF = 1001001001;
int main() {
int h, n;
cin >> h >> n;
vector<vector<int>> ab(n, vector<int>(2, 0));
for (auto &v : ab) {
cin >> v[0] >> v[1];
}
ve... | replace | 22 | 30 | 22 | 27 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, n) for (int i = 1; i <= n; i++)
#define ALL(obj) (obj).begin(), (obj).end()... | #include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, n) for (int i = 1; i <= n; i++)
#define ALL(obj) (obj).begin(), (obj).end()... | replace | 85 | 88 | 85 | 90 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long hxtype;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define pque priority_queue
#define rep(i, l, r) for (i = (l); i <= (r); ++i)
#define per(i, l, r) for (i = (... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long hxtype;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define pque priority_queue
#define rep(i, l, r) for (i = (l); i <= (r); ++i)
#define per(i, l, r) for (i = (... | replace | 34 | 35 | 34 | 35 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
using name... | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
using name... | replace | 29 | 30 | 29 | 30 | 0 | |
p02787 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
struct magic {
int a, b;
};
int main() {
int h, n;
const int h_max = 1e9;
cin >> h >> n;
vector<magic> v(n);
for (auto &vi : v)
cin >> vi.a >> vi.b;
vector<int> mpv(h + 1, h_max);
mpv.at(0) = 0;
for (const auto &vi : v) {
for (int ... | #include <iostream>
#include <vector>
using namespace std;
struct magic {
int a, b;
};
int main() {
int h, n;
const int h_max = 1e9;
cin >> h >> n;
vector<magic> v(n);
for (auto &vi : v)
cin >> vi.a >> vi.b;
vector<int> mpv(h + 1, h_max);
mpv.at(0) = 0;
for (const auto &vi : v) {
for (int ... | replace | 22 | 24 | 22 | 26 | 0 | |
p02787 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int h, n, res = 1e9;
vector<vector<int>> f;
int main() {
cin >> h >> n;
f.resize(2 * h + 1, vector<int>(n + 1, 1e9));
f[0][0] = 0;
for (int i = 1, a, b; i <= n; ++i) {
cin >> a >> b;
for (int j = 0; j <= 2e4; ++j) {
f[j][i] = f[j][i - 1... | #include <iostream>
#include <vector>
using namespace std;
int h, n, res = 1e9;
vector<vector<int>> f;
int main() {
cin >> h >> n;
f.resize(2e4 + 1, vector<int>(n + 1, 1e9));
f[0][0] = 0;
for (int i = 1, a, b; i <= n; ++i) {
cin >> a >> b;
for (int j = 0; j <= 2e4; ++j) {
f[j][i] = f[j][i - 1];... | replace | 10 | 11 | 10 | 11 | -11 | |
p02787 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for (int i ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for (int i ... | replace | 92 | 103 | 92 | 96 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int h, n;
cin >> h >> n;
vector<int> a, b;
rep(i, n) {
int A, B... | #include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int h, n;
cin >> h >> n;
vector<int> a, b;
rep(i, n) {
int A, B... | replace | 20 | 21 | 20 | 21 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int h, n;
cin >> h >> n;
int a[n], b[n];
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
int dp[h + 5];
for (int i = 0; i < h + 5; ++i) {
dp[i] = 200000000;
}
dp[0] = 0;
for (int i = 0; i < n; ++i) {... | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int h, n;
cin >> h >> n;
int a[n], b[n];
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
int dp[100005];
for (int i = 0; i < h + 5; ++i) {
dp[i] = 200000000;
}
dp[0] = 0;
for (int i = 0; i < n; ++i) ... | replace | 10 | 11 | 10 | 11 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define INF 100000000
int main() {
int H, N;
cin >> H >> N;
vector<pair<int, int>> magic(N);
int damage, point;
for (int i = 0; i < N; i++) {
cin >> damage >> point;
magic[i] = make_pair(damage, point);
}
vector<vector<int>> dp(N + 1, vector<int>(2001... | #include <bits/stdc++.h>
using namespace std;
#define INF 100000000
int main() {
int H, N;
cin >> H >> N;
vector<pair<int, int>> magic(N);
int damage, point;
for (int i = 0; i < N; i++) {
cin >> damage >> point;
magic[i] = make_pair(damage, point);
}
vector<vector<int>> dp(N + 1, vector<int>(2000... | replace | 13 | 14 | 13 | 14 | -11 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i, n) for (int i = 0; i < (n); i++)
int dp[10010];
int main() {
int h, n, a[110], b[110];
cin >> h >> n;
REP(i, n) cin >> a[i] >> ... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i, n) for (int i = 0; i < (n); i++)
int dp[10010];
int main() {
int h, n, a[1010], b[1010];
cin >> h >> n;
REP(i, n) cin >> a[i] >... | replace | 14 | 15 | 14 | 15 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, n, ans, i, j;
double cur;
cin >> h >> n;
vector<pair<int, int>> a(n);
vector<int> dp(h + 1, 1000000000);
for (i = 0; i < n; i++) {
cin >> a[i].first >> a[i].second;
}
dp[0] = 0;
for (i = 0; i < n; i++) {
for (j = 1; j <= a[i]... | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, n, ans, i, j;
double cur;
cin >> h >> n;
vector<pair<int, int>> a(n);
vector<int> dp(h + 1, 1000000000);
for (i = 0; i < n; i++) {
cin >> a[i].first >> a[i].second;
a[i].first = min(a[i].first, h);
}
dp[0] = 0;
for (i = 0; i ... | insert | 12 | 12 | 12 | 13 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef pair<ll, ll> pi;
const int MAXN = 1005, INF = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll h, n;
cin >> h >> n;
vector<pi> spells(n);
for (int i = 0; i < n; ++i)
cin >> ... | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef pair<ll, ll> pi;
const int MAXN = 50000005, INF = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll h, n;
cin >> h >> n;
vector<pi> spells(n);
for (int i = 0; i < n; ++i)
cin... | replace | 9 | 10 | 9 | 10 | 0 | |
p02787 | C++ | Time Limit Exceeded | #include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unorder... | #include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unorder... | replace | 66 | 69 | 66 | 67 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll, int> P;
typedef set<int> S;
int h, n;
int main() {
c... | #include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll, int> P;
typedef set<int> S;
int h, n;
int main() {
c... | replace | 15 | 16 | 15 | 16 | -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)
|
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const ll LINF = 1LL << 60;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
int main() {
int H, N;
cin >> H >> N;
vi A(N), B(N)... | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const ll LINF = 1LL << 60;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
int main() {
int H, N;
cin >> H >> N;
vi A(N), B(N)... | replace | 33 | 34 | 33 | 34 | 0 | |
p02787 | C++ | Runtime Error | #include <cstdio>
#include <cstring>
const int Maxn = 1000;
const int Maxm = 10000;
const int Inf = 0x3f3f3f3f;
int a[Maxn + 5], b[Maxn + 5];
int n, h;
int f[Maxm << 1 | 5];
int mn(int a, int b) { return a < b ? a : b; }
int main() {
scanf("%d%d", &h, &n);
for (int i = 1; i <= n; i++) {
scanf("%d%d", &a[i], &b[... | #include <cstdio>
#include <cstring>
const int Maxn = 1000;
const int Maxm = 10000;
const int Inf = 0x3f3f3f3f;
int a[Maxn + 5], b[Maxn + 5];
int n, h;
int f[Maxm << 1 | 5];
int mn(int a, int b) { return a < b ? a : b; }
int main() {
scanf("%d%d", &h, &n);
for (int i = 1; i <= n; i++) {
scanf("%d%d", &a[i], &b[... | replace | 17 | 18 | 17 | 18 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
using namespace std;
int read() {
int ans = 0, f = 1;
char c = getchar();
while (c > '9' || c < '0') {
if (c == '-')
f = -1;
c = getchar()... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
using namespace std;
int read() {
int ans = 0, f = 1;
char c = getchar();
while (c > '9' || c < '0') {
if (c == '-')
f = -1;
c = getchar()... | replace | 28 | 29 | 28 | 29 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep2(i, a, b) for (int(i) ... | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep2(i, a, b) for (int(i) ... | replace | 65 | 66 | 65 | 66 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define pb emplace_back
#define re return
#define fi first
#define se second
#define a... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define pb emplace_back
#define re return
#define fi first
#define se second
#define a... | replace | 31 | 32 | 31 | 32 | 0 | |
p02787 | C++ | Runtime Error | // #define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
// using Graph = vector<vector<int>>;
typedef long long ll;
using Graph = vector<vector<pair<ll, ll>>>;
const int mod = 1e+9 + 7;
const int ... | // #define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
// using Graph = vector<vector<int>>;
typedef long long ll;
using Graph = vector<vector<pair<ll, ll>>>;
const int mod = 1e+9 + 7;
const int ... | replace | 18 | 19 | 18 | 19 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
#defin... | #include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
#defin... | replace | 53 | 55 | 53 | 61 | -11 | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>
#include <time.h>
#define pb push_back
#define IOS \
ios_base::sync_with_stdio(0); ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>
#include <time.h>
#define pb push_back
#define IOS \
ios_base::sync_with_stdio(0); ... | replace | 91 | 96 | 91 | 94 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
typede... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
typede... | replace | 29 | 36 | 29 | 43 | TLE | |
p02787 | C++ | Memory Limit Exceeded | #include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9 + 7)
#define inf (int)(3e18)
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define P std::pair<int, int>
#define PiP std::pair<int, std::pair<int, int>>
#define all(v) v.begin(), v.end()
#define mkp std::m... | #include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9 + 7)
#define inf (int)(3e18)
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define P std::pair<int, int>
#define PiP std::pair<int, std::pair<int, int>>
#define all(v) v.begin(), v.end()
#define mkp std::m... | replace | 308 | 309 | 308 | 309 | MLE | |
p02787 | C++ | Time Limit Exceeded | // #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include ... | // #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include ... | replace | 69 | 70 | 69 | 71 | TLE | |
p02787 | C++ | Runtime Error | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author Kamol Paul
*/
#include <fstream>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define long long long
typedef pair<long, long> pii;
class ECrestedIbisVsMonster {
public:
static bool cmp(pii a, p... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author Kamol Paul
*/
#include <fstream>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define long long long
typedef pair<long, long> pii;
class ECrestedIbisVsMonster {
public:
static bool cmp(pii a, p... | replace | 35 | 36 | 35 | 36 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
// freopen("input.txt","r",stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int h, n, i, j;
cin >> h >> n;
int a[n + 2], b[n + 2];
int dp[10003];
memset(dp, 0x3f, sizeof(dp));
dp[0] = 0;
for (i = 0; i < n; i++) {
cin >> a[i] >> ... | #include <bits/stdc++.h>
using namespace std;
int main() {
// freopen("input.txt","r",stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int h, n, i, j;
cin >> h >> n;
int a[n + 2], b[n + 2];
int dp[10003];
memset(dp, 0x3f, sizeof(dp));
dp[0] = 0;
for (i = 0; i < n; i++) {
cin >> a[i] >> ... | replace | 16 | 17 | 16 | 17 | 0 | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);
using namespace std;
ll dp[10005]; // dp[i] := HPをi減らす時の最小の魔力消費量
int main(void) {
c... | #include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);
using namespace std;
ll dp[10005]; // dp[i] := HPをi減らす時の最小の魔力消費量
int main(void) {
c... | replace | 21 | 22 | 21 | 22 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, n;
cin >> h >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++)
cin >> a.at(i) >> b.at(i);
vector<int> dp(2 * pow(10, 9));
for (int i = 0; i < pow(10, 9); i++) {
if (dp.at(i) >= h) {
cout << i << endl;
break;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, n;
cin >> h >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++)
cin >> a.at(i) >> b.at(i);
vector<int> dp(2 * pow(10, 8));
for (int i = 0; i < 10 + pow(10, 8); i++) {
if (dp.at(i) >= h) {
cout << i << endl;
break;... | replace | 11 | 13 | 11 | 13 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef ... | #include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef ... | replace | 68 | 69 | 68 | 90 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int H, N;
cin >> H >> N;
vector<int> dp(10000 + 1000, 999999999999);
vector<int> A(N);
vector<int> B(N);
dp[0] = 0;
for (int i = 0; i < N; i++)
cin >> A[i] >> B[i];
for (int j = 0; j <= H; j++) {
for (int i = 0;... | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int H, N;
cin >> H >> N;
vector<int> dp(100000 + 1000, 999999999999);
vector<int> A(N);
vector<int> B(N);
dp[0] = 0;
for (int i = 0; i < N; i++)
cin >> A[i] >> B[i];
for (int j = 0; j <= H; j++) {
for (int i = 0... | replace | 7 | 8 | 7 | 8 | 0 | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
// const int MOD=998244353;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, h;
cin >> h >> n;
vector<pair<int, int>> vp(n);
for (auto &p : vp) {
int x, y;
cin >> x >> y;
p = {x, y};
}
vector<int> dist... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
// const int MOD=998244353;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, h;
cin >> h >> n;
vector<pair<int, int>> vp(n);
for (auto &p : vp) {
int x, y;
cin >> x >> y;
p = {x, y};
}
vector<int> dist... | insert | 25 | 25 | 25 | 32 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back
using namespace std;
int A[10100], B[10100], n, dp[10110][1010];
int fun(int a, int b) {
if (a <= 0)
return 0;
if (b == n)
return 1e9;
if (dp[a][b] != -1)
return dp[a][b];
return min(B[b] +... | #include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back
using namespace std;
int A[10100], B[10100], n, dp[10110][1010];
int fun(int a, int b) {
if (a <= 0)
return 0;
if (b == n)
return 1e9;
if (dp[a][b] != -1)
return dp[a][b];
return min(B[b] +... | replace | 23 | 25 | 23 | 34 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
int h, n;
cin >> h >> n;
vector<int> a(n), b(n);
rep(i, n... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
int h, n;
cin >> h >> n;
vector<int> a(n), b(n);
rep(i, n... | insert | 18 | 18 | 18 | 22 | 0 | |
p02787 | C++ | Time Limit Exceeded | #pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setp... | #pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setp... | replace | 148 | 149 | 148 | 150 | TLE | |
p02787 | Python | Runtime Error | import sys
import numpy as np
h, n = list(map(int, input().split()))
INF = 10**18
dp = np.full(h + 10001, INF, dtype=np.int64)
dp[0] = 0
for line in sys.stdin:
a, b = map(int, line.split())
for s in range(0, h, a):
sa = s + a
s2a = s + 2 * a
dp[sa:s2a] = np.minimum(dp[sa:s2a], dp[s:sa] ... | import sys
import numpy as np
h, n = map(int, input().split())
ab = np.array(sys.stdin.read().split(), dtype=np.int64)
aaa = ab[0::2]
bbb = ab[1::2]
dp = np.zeros(10001, dtype=np.int64)
for i in range(1, h + 1):
dp[i] = (dp[i - aaa] + bbb).min()
print(dp[h])
| replace | 3 | 14 | 3 | 12 | TLE | |
p02787 | Python | Time Limit Exceeded | H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]
max_magic = 0
for a, _ in magic:
max_magic = max(max_magic, a)
amount = H + 1
dp = [0] * (amount + max_magic)
dp[0] = 0
ret = float("inf")
for amt in range(1, amount + max_magic):
t = [dp[amt - a] + b if amt - a >=... | H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]
max_magic = 0
for a, _ in magic:
max_magic = max(max_magic, a)
amount = H + 1
dp = [0] * (amount + max_magic)
dp[0] = 0
ret = float("inf")
for amt in range(1, amount + max_magic):
t = [dp[amt - a] + b if amt - a >=... | insert | 16 | 16 | 16 | 17 | TLE | |
p02787 | Python | Time Limit Exceeded | import sys
import functools
def inpl():
return list(map(int, input().split()))
@functools.lru_cache(maxsize=None)
def solve(h):
if h <= 0:
return 0
ret_val = float("inf")
for a, b in AB:
ret_val = min(ret_val, b + solve(h - a))
return ret_val
sys.setrecursionlimit(100000)
H, ... | import sys
import functools
def inpl():
return list(map(int, input().split()))
@functools.lru_cache(maxsize=None)
def solve(h):
if h <= 0:
return 0
ret_val = float("inf")
for a, b in AB:
val = b + solve(h - a)
if val < ret_val:
ret_val = val
else:
... | replace | 15 | 16 | 15 | 20 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(v) (v).begin(), (v).end()
#defin... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(v) (v).begin(), (v).end()
#defin... | replace | 35 | 77 | 35 | 36 | 0 | |
p02787 | C++ | Runtime Error | #define HAVE_STRUCT_TIMESPEC
#include <bits/stdc++.h>
using namespace std;
int a[1007], b[1007], f[1007];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int h, n;
cin >> h >> n;
for (int i = 1; i <= n; ++i)
cin >> a[i] >> b[i];
for (int i = 1; i <= h; ++i)
f[i] = 1e9;
f... | #define HAVE_STRUCT_TIMESPEC
#include <bits/stdc++.h>
using namespace std;
int a[10007], b[10007], f[10007];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int h, n;
cin >> h >> n;
for (int i = 1; i <= n; ++i)
cin >> a[i] >> b[i];
for (int i = 1; i <= h; ++i)
f[i] = 1e9;
... | replace | 3 | 4 | 3 | 4 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define all(n) (n).begin(), (n).end()
typedef long long ll;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
} else {
return 0;
}
}
template <class T> inl... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define all(n) (n).begin(), (n).end()
typedef long long ll;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
} else {
return 0;
}
}
template <class T> inl... | replace | 46 | 47 | 46 | 47 | -11 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
typedef long long ll;
const ll mod = 1000000007;
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
int main() {
ll h, n;
cin >> h >> n;
ll inf = mod;
vector<ll> a(n), b(n);
for (ll i = 0; i < n; ++i)
cin >> a[i] >>... | #include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
typedef long long ll;
const ll mod = 1000000007;
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
int main() {
ll h, n;
cin >> h >> n;
ll inf = mod;
vector<ll> a(n), b(n);
for (ll i = 0; i < n; ++i)
cin >> a[i] >>... | replace | 14 | 24 | 14 | 17 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
const long long INF = 1 << 29;
const int MOD = 1000000007;
long long ruizyou(long long m, long long n) {
if (m == 0)
return 0;
if (m == 1)
return 1;
long long ans = 1;
long long tmp = m;
... | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
const long long INF = 1 << 29;
const int MOD = 1000000007;
long long ruizyou(long long m, long long n) {
if (m == 0)
return 0;
if (m == 1)
return 1;
long long ans = 1;
long long tmp = m;
... | replace | 85 | 86 | 85 | 86 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 10001) >= this->size() (which is 10001)
|
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmin(T &a, T b) { /* {{{ */
if (a > b) {
a = b;
return true;
}
return false;
} /* }}} */
int main() {
int H, N;
cin >> H >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++) {
cin >> A[i] >> B[i];
}
vecto... | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmin(T &a, T b) { /* {{{ */
if (a > b) {
a = b;
return true;
}
return false;
} /* }}} */
int main() {
int H, N;
cin >> H >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++) {
cin >> A[i] >> B[i];
}
vecto... | replace | 22 | 23 | 22 | 25 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x " = " << (x) << '\n';
#define P(x) cout << #x << '\n';
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;
const int maxn = 1e5 + 10;
int a[maxn], b[maxn], dp[maxn];
const int inf = 1e15;
const int till = 3e4;
int32_t ... | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x " = " << (x) << '\n';
#define P(x) cout << #x << '\n';
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;
const int maxn = 1e5 + 10;
int a[maxn], b[maxn], dp[maxn];
const int inf = 1e15;
const int till = 3e4;
int32_t ... | replace | 30 | 31 | 30 | 32 | 0 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <iterator>
#include <queue>
#include <stdio.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define rep(i, s, n) for (ll i = s; i < (n); ++i)
using ll... | #include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <iterator>
#include <queue>
#include <stdio.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define rep(i, s, n) for (ll i = s; i < (n); ++i)
using ll... | replace | 75 | 76 | 75 | 76 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;
// repetition
... | #include <bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;
// repetition
... | replace | 44 | 45 | 44 | 45 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
ll h, n;
cin >> h >> n;
vector<pair<ll, ll>> ab(n);
rep(i, n) cin >> ab[i].first >> ab[i].second;
vector<ll> dp(1e9, 0);
for (ll i = 0; i <= 1e9; i++) {
rep(j, n) {
if... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
ll h, n;
cin >> h >> n;
vector<pair<ll, ll>> ab(n);
rep(i, n) cin >> ab[i].first >> ab[i].second;
vector<ll> dp(1e8, 0);
for (ll i = 0; i <= 1e8; i++) {
rep(j, n) {
if... | replace | 11 | 13 | 11 | 13 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina... | replace | 24 | 30 | 24 | 26 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
typedef long long ll;
int dp[150000000];
int main() {
int H, N;
int A[10000], B[10000];
scanf("%d %d", &H, &N);
for (int i = 0; i < N; i++) {
scanf("%d %d", &A[i], &B[i]);
}
int jC... | #include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
typedef long long ll;
int dp[150000000];
int main() {
int H, N;
int A[10000], B[10000];
scanf("%d %d", &H, &N);
for (int i = 0; i < N; i++) {
scanf("%d %d", &A[i], &B[i]);
}
int jC... | replace | 22 | 23 | 22 | 23 | TLE | |
p02787 | Python | Runtime Error | n, m = map(int, input().split())
dmg = []
cost = []
for i in range(m):
a, b = map(int, input().split())
dmg.append(a)
cost.append(b)
inf = 10**9
dp = [inf] * 10001
dp[0] = 0
for i in range(m):
for j in range(n):
if dp[j] != inf:
dp[j + dmg[i]] = min(dp[j + dmg[i]], dp[j] + cost[i]... | n, m = map(int, input().split())
dmg = []
cost = []
for i in range(m):
a, b = map(int, input().split())
dmg.append(a)
cost.append(b)
inf = 10**9
dp = [inf] * 30000
dp[0] = 0
for i in range(m):
for j in range(n):
if dp[j] != inf:
dp[j + dmg[i]] = min(dp[j + dmg[i]], dp[j] + cost[i]... | replace | 10 | 11 | 10 | 11 | 0 | |
p02787 | C++ | Time Limit Exceeded | // #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 10000009
#define INF (ll)1e18
#define pll pair<ll, ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i, n) ... | // #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 10000009
#define INF (ll)1e18
#define pll pair<ll, ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i, n) ... | replace | 117 | 118 | 117 | 118 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2e9;
// const ll INF = 9e18;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int H, N;
cin >> H >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++)
cin >> A[i] >> B[i];
int amin = INF;
for (int i = 0; i... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2e9;
// const ll INF = 9e18;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int H, N;
cin >> H >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++)
cin >> A[i] >> B[i];
int amin = INF;
for (int i = 0; i... | replace | 20 | 26 | 20 | 24 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0... | replace | 40 | 41 | 40 | 41 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 16) >= this->size() (which is 16)
|
p02787 | C++ | Time Limit Exceeded | // Author : Mohamed Sameh
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std;
int h, n;
const int M = 1e3;
int a[M][2];
l... | // Author : Mohamed Sameh
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std;
int h, n;
const int M = 1e3;
int a[M][2];
l... | replace | 24 | 36 | 24 | 26 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1010, M = 20010;
int n, m;
int a[N], b[N];
int f[M];
int main() {
scanf("%d%d", &m, &n);
for (int i = 1; i <= n; i++)
scanf("%d%d", &a[i], &b[i]);
memset(f, 0x3... | #include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1010, M = 20010;
int n, m;
int a[N], b[N];
int f[M];
int main() {
scanf("%d%d", &m, &n);
for (int i = 1; i <= n; i++)
scanf("%d%d", &a[i], &b[i]);
memset(f, 0x3... | replace | 25 | 28 | 25 | 27 | TLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = (0); i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(), (x).end()
#define rrng(x) (x).rbegin(), (x).rend()
#define limit(... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = (0); i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(), (x).end()
#define rrng(x) (x).rbegin(), (x).rend()
#define limit(... | replace | 88 | 89 | 88 | 89 | -11 | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <ctype.h>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <ctype.h>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack... | replace | 66 | 67 | 66 | 68 | -11 | |
p02787 | C++ | Time Limit Exceeded | #pragma region
#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 int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define FOR(i, s,... | #pragma region
#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 int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define FOR(i, s,... | replace | 176 | 177 | 176 | 177 | TLE | |
p02787 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define vout(x) rep(i, x.size()) cout << x[i] << " "
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a =... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define vout(x) rep(i, x.size()) cout << x[i] << " "
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a =... | replace | 41 | 44 | 41 | 42 | TLE | |
p02787 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> dp(10000, vector<int>(10000, 999999999));
vector<int> A(10000), B(10000);
int H, N;
void input() {
cin >> H >> N;
for (int i = 0; i < N; i++) {
cin >> A.at(i) >> B.at(i);
}
return;
}
void DP() {
dp.at(0)... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> dp(10010, vector<int>(10010, 999999999));
vector<int> A(10010), B(10010);
int H, N;
void input() {
cin >> H >> N;
for (int i = 0; i < N; i++) {
cin >> A.at(i) >> B.at(i);
}
return;
}
void DP() {
dp.at(0)... | replace | 5 | 7 | 5 | 7 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02787 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main() {
int h, n;
cin >> h >> n;
vector<int>... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main() {
int h, n;
cin >> h >> n;
vector<int>... | replace | 25 | 26 | 25 | 26 | 0 | |
p02787 | C++ | Memory Limit Exceeded | #include "bits/stdc++.h"
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a), i##_len = (b); i < i##_len; ++i)
#define MSVC_UNKO(x) x
#define rep(...) \
MSVC_UNKO(_overload3(__VA_ARGS__,... | #include "bits/stdc++.h"
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a), i##_len = (b); i < i##_len; ++i)
#define MSVC_UNKO(x) x
#define rep(...) \
MSVC_UNKO(_overload3(__VA_ARGS__,... | replace | 31 | 49 | 31 | 35 | MLE | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int N = 5000;
long long dp[N];
int a[N], b[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int h, n;
cin >> h >> n;
for (int i = 0; i < h; ++i) {
dp[i] = 1e18;
}
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
for ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
long long dp[N];
int a[N], b[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int h, n;
cin >> h >> n;
for (int i = 0; i < h; ++i) {
dp[i] = 1e18;
}
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
... | replace | 4 | 5 | 4 | 5 | 0 | |
p02787 | Python | Runtime Error | def main():
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
dp = [0] + [0] * h
for i in range(1, h + 1):
dp[i] = min(dp[i - a] + b for a, b in ab)
print(dp[h])
if __name__ == "__main__":
main()
| def main():
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
amax = max(a for a, b in ab)
dp = [0] + [0] * (h + amax)
for i in range(1, h + 1):
dp[i] = min(dp[i - a] + b for a, b in ab)
print(dp[h])
if __name__ == "__main__":
main()
| replace | 4 | 5 | 4 | 6 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;
int h, n, a, b, dp[MAXN];
int main() {
scanf("%d%d", &h, &n);
memset(dp, 0x3f, sizeof(dp));
dp[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%d%d", &a, &b);
for (int i = a; i <= h; i++) {
dp[i] = min(dp[i], dp[i - a] + b);
}... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;
int h, n, a, b, dp[MAXN];
int main() {
scanf("%d%d", &h, &n);
memset(dp, 0x3f, sizeof(dp));
dp[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%d%d", &a, &b);
for (int i = a; i <= h; i++) {
dp[i] = min(dp[i], dp[i - a] + b);
}... | replace | 13 | 14 | 13 | 14 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define F first
#define S second
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __pri... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define F first
#define S second
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __pri... | replace | 59 | 60 | 59 | 60 | -11 | |
p02787 | Python | Runtime Error | H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
dp = [0] * (H + 1)
for h in range(1, H + 1):
dp[h] = min([dp[h - a] + b for a, b in AB])
print(dp[-1])
| H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
dp = [0] * (H + 1)
for h in range(1, H + 1):
dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])
print(dp[-1])
| replace | 6 | 7 | 6 | 7 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
int dp[11000];
int h, n;
const int INF = 1001001001;
int main() {
cin >> h >> n;
rep(j, h + 1) dp[j] = INF;
dp[0] = 0;
rep(i, n) {
int a, b;
cin >> a >> b;
re... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
int dp[11000];
int h, n;
const int INF = 1001001001;
int main() {
cin >> h >> n;
rep(j, h + 1) dp[j] = INF;
dp[0] = 0;
rep(i, n) {
int a, b;
cin >> a >> b;
re... | replace | 15 | 16 | 15 | 16 | 0 | |
p02787 | Python | Runtime Error | import sys
def solve(h, n, ab):
ab.sort(key=lambda x: x[1] / x[0])
INF = 10**18
cache = {}
# とりあえず一番コスパいいやつだけを使った結果を暫定最良値としておく
best = ((h - 1) // ab[0][0] + 1) * ab[0][1]
def dp(k, i=0, cost=0):
nonlocal best
if k <= 0:
return cost
if (k, i) in cache:
... | import sys
def solve(h, n, ab):
ab.sort(key=lambda x: x[1] / x[0])
INF = 10**18
cache = {}
# とりあえず一番コスパいいやつだけを使った結果を暫定最良値としておく
best = ((h - 1) // ab[0][0] + 1) * ab[0][1]
def dp(k, i=0, cost=0):
nonlocal best
if k <= 0:
return cost
if (k, i) in cache:
... | replace | 33 | 34 | 33 | 34 | 0 | |
p02787 | Python | Runtime Error | h, n, *L = map(int, open(0).read().split())
dp = [0] * (h + 1)
for i in range(1, h + 1):
dp[i] = min(dp[i - a] + b for a, b in zip(*[iter(L)] * 2))
print(dp[h])
| h, n, *L = map(int, open(0).read().split())
dp = [0] * (h + 99999)
for i in range(1, h + 1):
dp[i] = min(dp[i - a] + b for a, b in zip(*[iter(L)] * 2))
print(dp[h])
| replace | 1 | 2 | 1 | 2 | 0 | |
p02787 | Python | Runtime Error | def main():
h, n = map(int, input().split())
magic_list = []
for _ in range(n):
a, b = map(int, input().split())
magic_list.append((a, b))
ans = solve(h, magic_list)
print(ans)
def solve(h, magic_list):
# 1-origin
dp = [0] * (h + 1)
# time O(HN)
for hp in range(1... | def main():
h, n = map(int, input().split())
magic_list = []
for _ in range(n):
a, b = map(int, input().split())
magic_list.append((a, b))
ans = solve(h, magic_list)
print(ans)
def solve(h, magic_list):
# 1-origin
max_attack = max(magic_list)[0]
dp = [0] * (h + max_at... | replace | 14 | 15 | 14 | 16 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
int H, N;
cin >> H >> N;
vector<int> A(N), B(N);
int maxA = 0;
for (int i = 0; i < N; i++) {
cin >> A[i] >> B[i];
maxA = max(maxA, A[i]);
}
int Hmax = H + maxA + 1;
vector<vector<int>> dp(N... | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
int H, N;
cin >> H >> N;
vector<int> A(N), B(N);
int maxA = 0;
for (int i = 0; i < N; i++) {
cin >> A[i] >> B[i];
maxA = max(maxA, A[i]);
}
int Hmax = H + maxA + 1;
vector<vector<int>> dp(N... | replace | 16 | 17 | 16 | 17 | -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)
|
p02787 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long lo... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long lo... | replace | 40 | 41 | 40 | 41 | 0 | |
p02787 | Python | Runtime Error | h, n = map(int, input().split())
a = []
b = []
for i in range(n):
a_, b_ = map(int, input().split())
a.append(a_)
b.append(b_)
dp = [float("inf")] * (h + 1010)
dp[0] = 0
for i in range(h + 1):
for j in range(n):
dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])
print(min(dp[h:]))
| h, n = map(int, input().split())
a = []
b = []
for i in range(n):
a_, b_ = map(int, input().split())
a.append(a_)
b.append(b_)
dp = [float("inf")] * (h + 10010)
dp[0] = 0
for i in range(h + 1):
for j in range(n):
dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])
print(min(dp[h:]))
| replace | 8 | 9 | 8 | 9 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int, int>
#define vi vector<int>
#define vpi vector<pi>
const int N = 1005;
int dp[10 * N], a[N], b[N];
int main() {
int h, n;
cin >> h >> n;
for (int i = 1; i <= n; i++) {
cin >> a... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int, int>
#define vi vector<int>
#define vpi vector<pi>
const int N = 1005;
int dp[20 * N], a[N], b[N];
int main() {
int h, n;
cin >> h >> n;
for (int i = 1; i <= n; i++) {
cin >> a... | replace | 10 | 11 | 10 | 11 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(), (x).end()
#define int long long
#define fr first
#def... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(), (x).end()
#define int long long
#define fr first
#def... | replace | 33 | 34 | 33 | 34 | 0 | |
p02787 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) \
for (__typeof__((s).begin()... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) \
for (__typeof__((s).begin()... | replace | 59 | 60 | 59 | 60 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.