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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
const ll inf = 10000000000;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
ll n, k, i, j;
cin >> n;
ll arr[n ... | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
const ll inf = 10000000000;
int main() {
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
ios::sync_with_stdio(false);
cin.tie(0);
ll n, k, i, j;... | replace | 6 | 10 | 6 | 10 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(a) a.begin(), a.end()
#define print(x) cout << x << "\n";
const ll M = ll(1e9 + 7);
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "[";
for (int i = 0; i < v.size(); ++i) {
os << v[i];
if ... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(a) a.begin(), a.end()
#define print(x) cout << x << "\n";
const ll M = ll(1e9 + 7);
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "[";
for (int i = 0; i < v.size(); ++i) {
os << v[i];
if ... | delete | 43 | 47 | 43 | 43 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define INF (1 << 31) - 1 // INT_MAX/2
#define MOD 1000000007
#define PI acos(-1)
using ll = long long;
using ull = unsigned long long;
using P = std::pair<int, int>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <... | #include <bits/stdc++.h>
#define INF (1 << 31) - 1 // INT_MAX/2
#define MOD 1000000007
#define PI acos(-1)
using ll = long long;
using ull = unsigned long long;
using P = std::pair<int, int>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <... | replace | 35 | 36 | 35 | 36 | -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)
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define debug(x) \
cout << "DEBUG" \
<< " " << #x << ":" << x << '\n'
// ↓0-originか1-originでn回繰り返し
#define rep(i, n) for (int i = 0; i < ((i... | #include <bits/stdc++.h>
using namespace std;
#define debug(x) \
cout << "DEBUG" \
<< " " << #x << ":" << x << '\n'
// ↓0-originか1-originでn回繰り返し
#define rep(i, n) for (int i = 0; i < ((i... | replace | 57 | 58 | 57 | 58 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int solve(int i, int a[], vector<int> &dp, int n) {
if (i > n - 2)
return 0;
if (i == n - 2) {
return dp[i] = abs(a[n - 1] - a[n - 2]);
}
return dp[i] = min((abs(a[i] - a[i + 1]) + solve(i + 1, a, dp, n)),
(abs(a[i] - a[i + 2]) + solve(i... | #include <bits/stdc++.h>
using namespace std;
int solve(int i, int a[], vector<int> &dp, int n) {
if (i > n - 2)
return 0;
if (dp[i] != -1)
return dp[i];
if (i == n - 2) {
return dp[i] = abs(a[n - 1] - a[n - 2]);
}
return dp[i] = min((abs(a[i] - a[i + 1]) + solve(i + 1, a, dp, n)),
... | insert | 5 | 5 | 5 | 7 | TLE | |
p03160 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main(void) {
int N;
int h[10001];
int dp[N + 1];
int tmp, tnp;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
tmp = dp[i - 2] + abs(h[i] - h[i - 2]);
tnp = dp[i - 1]... | #include <iostream>
using namespace std;
int main(void) {
int N;
int h[100001];
int dp[N];
int tmp, tnp;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
tmp = dp[i - 2] + abs(h[i] - h[i - 2]);
tnp = dp[i - 1] + ... | replace | 5 | 7 | 5 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int dp1[n];
for... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];... | replace | 6 | 10 | 6 | 10 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int fun(vector<int> &v, int i, vector<int> dp) {
if (dp[i] != 1e6) {
return dp[i];
}
if (i == v.size()) {
return 1e5;
}
int ans = 0;
if (i + 2 < v.size()) {
ans = ans + min(abs(v[i] - v[i + 1]) + fun(v, i + 1, dp),
abs(v[i] - v... | #include <bits/stdc++.h>
using namespace std;
int fun(vector<int> &v, int i, vector<int> &dp) {
if (dp[i] != 1e6) {
return dp[i];
}
if (i == v.size()) {
return 1e5;
}
int ans = 0;
if (i + 2 < v.size()) {
ans = ans + min(abs(v[i] - v[i + 1]) + fun(v, i + 1, dp),
abs(v[i] - ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long int
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end(... | #include <bits/stdc++.h>
#define ll long long int
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end(... | replace | 114 | 116 | 114 | 116 | 0 | |
p03160 | C++ | Runtime Error | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int n, h[10000], dp[10000], k = 3;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));... | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int n, h[100000], dp[100000], k = 3;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1])... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mod 1000000007
ll dp[100005] = {INT_MAX}, cur = 0;
int main() {
#ifndef ONLINE_JUDGE
freopen("C:\\Users\\msmut\\Documents\\Programming\\Input.txt", "r", std... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mod 1000000007
ll dp[100005] = {INT_MAX}, cur = 0;
int main() {
ll n;
cin >> n;
ll h[n + 5];
for (ll i = 0; i < n; i++)
cin >> h[i];
cur = 0;
... | delete | 11 | 18 | 11 | 11 | -11 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include ... | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include ... | delete | 73 | 79 | 73 | 73 | -6 | terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
|
p03160 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long int ll;
int main() {
int N, dp[1000] = {};
cin >> N;
vector<int> h(N);
fo... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long int ll;
int main() {
int N, dp[1000000] = {};
cin >> N;
vector<int> h(N);
... | replace | 15 | 16 | 15 | 16 | 0 | |
p03160 | C++ | Runtime Error | /*
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
*/
#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iostream>
#define N_MAX 10001
using namespace std;
int dp[N_MAX];
int h[N_MAX];
int n;
int res;
void solve() {
dp[1] = 0;
for (int i = 1; i <= n; i++) {
if (i - 1 >= 1 &... | /*
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
*/
#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iostream>
#define N_MAX 100001
using namespace std;
int dp[N_MAX];
int h[N_MAX];
int n;
int res;
void solve() {
dp[1] = 0;
for (int i = 1; i <= n; i++) {
if (i - 1 >= 1 ... | replace | 8 | 9 | 8 | 9 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Ull unsigned long long
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Ull unsigned long long
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define ... | replace | 48 | 52 | 48 | 49 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O3")
#define ll long long int
// #include <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
// cpp_int x;
// namespace mp=boost::multiprecision;
// mp::cpp_int s=n;
#define all(x) (x).begin(), (x).end()
using ld = long double... | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O3")
#define ll long long int
// #include <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
// cpp_int x;
// namespace mp=boost::multiprecision;
// mp::cpp_int s=n;
#define all(x) (x).begin(), (x).end()
using ld = long double... | delete | 211 | 217 | 211 | 211 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
... | replace | 22 | 23 | 22 | 23 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define INF 10000000
#define MAXN 11000
using namespace std;
long long h[MAXN], dp[MAXN];
int N;
int main() {
fill(dp, dp + MAXN, INF);
cin >> N;
for (int i = 0; i < N; i++) {
cin >> h[i];
}
dp[0] = 0;
for (int i = 0; i < N - 1; i++) {
dp[i + 1] = min(dp[i + 1], dp[i] + ab... | #include <bits/stdc++.h>
#define INF 1000000000
#define MAXN 110000
using namespace std;
long long h[MAXN], dp[MAXN];
int N;
int main() {
fill(dp, dp + MAXN, INF);
cin >> N;
for (int i = 0; i < N; i++) {
cin >> h[i];
}
dp[0] = 0;
for (int i = 0; i < N - 1; i++) {
dp[i + 1] = min(dp[i + 1], dp[i] +... | replace | 1 | 3 | 1 | 3 | 0 | |
p03160 | C++ | Runtime Error | /* -- Aditya0412-- */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpl vector<pll>
#define fi first
#defi... | /* -- Aditya0412-- */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpl vector<pll>
#define fi first
#defi... | delete | 25 | 29 | 25 | 25 | 0 | |
p03160 | C++ | Runtime Error | #include <iostream>
#include <limits.h>
using namespace std;
int dp[100004];
int mincost(int n, int height[]) {
if (n == 1 || n == 0)
return 0;
int cost1 = INT_MAX;
int cost2 = INT_MAX;
if (dp[n] != -1)
return dp[n];
if (n >= 2)
cost1 = abs(height[n - 1] - height[n - 2]) + mincost(n - 1, height);
... | #include <iostream>
#include <limits.h>
using namespace std;
int dp[100004];
int mincost(int n, int height[]) {
if (n == 1 || n == 0)
return 0;
int cost1 = INT_MAX;
int cost2 = INT_MAX;
if (dp[n] != -1)
return dp[n];
if (n >= 2)
cost1 = abs(height[n - 1] - height[n - 2]) + mincost(n - 1, height);
... | replace | 20 | 21 | 20 | 21 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
vector<long long> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
vector<long long> dp(n, INT_MAX);
dp[0] = 0;
for (long long i = 0; i < n; i++) {
for (long long j = i + 1; j <= i + 2; j++) {
dp[j] = m... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
vector<long long> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
vector<long long> dp(n, INT_MAX);
dp[0] = 0;
for (long long i = 0; i < n; i++) {
for (long long j = i + 1; j <= i + 2; j++) {
if (j < n... | replace | 13 | 14 | 13 | 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)
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int dp[10005];
int val[100004];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> val[i];
dp[0] = 0;
for (int i = 1; i < n; i++) {
int y, x = dp[i - 1] + abs(val[i] - val[i - 1]);
if (i == 1)
y = 1000003;
else
y = dp[i - ... | #include <bits/stdc++.h>
using namespace std;
int dp[100005];
int val[100005];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> val[i];
dp[0] = 0;
for (int i = 1; i < n; i++) {
int y, x = dp[i - 1] + abs(val[i] - val[i - 1]);
if (i == 1)
y = 1000003;
else
y = dp[i -... | replace | 2 | 4 | 2 | 4 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define itf ios_base::sync_with_stdio(false)
#define ct cin.tie(NULL)
int Z[100002];
int step(int a[], int n, int i) {
if (i >= n)
return 0;
return min(abs(a[i - 1] - a[i]) + step(a, n, i + 1),
abs(a[i - 1] - a[i + 1]) + step(a, n, i + 2));
}
int m... | #include <bits/stdc++.h>
using namespace std;
#define itf ios_base::sync_with_stdio(false)
#define ct cin.tie(NULL)
int Z[100002];
int step(int a[], int n, int i) {
if (i >= n)
return 0;
if (Z[i] != -1)
return Z[i];
return (Z[i] = min(abs(a[i - 1] - a[i]) + step(a, n, i + 1),
abs... | replace | 12 | 14 | 12 | 17 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define endl '\n'
#define lc (rt << 1)
#define rc (rt << 1 | 1)
#define mp make_pair
#define pb push_back
#define lowbit(a) (a & (-a))
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mst(a, v) memset(a, v, sizeof(a... | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define endl '\n'
#define lc (rt << 1)
#define rc (rt << 1 | 1)
#define mp make_pair
#define pb push_back
#define lowbit(a) (a & (-a))
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mst(a, v) memset(a, v, sizeof(a... | replace | 56 | 57 | 56 | 57 | 0 | |
p03160 | C++ | Runtime Error | /*
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| |
| author : thanos1399 Language : C ++ |
| college : MSIT |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _... | /*
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| |
| author : thanos1399 Language : C ++ |
| college : MSIT |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _... | replace | 104 | 105 | 104 | 105 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int N;
int memo[10001];
int arr[10001];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &arr[i]);
memo[i] = 1000000000;
}
memo[0] = 0;
for (int i = 0; i < N; i++) {
if (i + 1 < N)
memo[i + 1] = min(memo[i + 1], memo[i] + a... | #include <bits/stdc++.h>
using namespace std;
int N;
int memo[100001];
int arr[100001];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &arr[i]);
memo[i] = 1000000000;
}
memo[0] = 0;
for (int i = 0; i < N; i++) {
if (i + 1 < N)
memo[i + 1] = min(memo[i + 1], memo[i] +... | replace | 3 | 5 | 3 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define emb emplace_back
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define emb emplace_back
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | replace | 72 | 76 | 72 | 76 | 0 | |
p03160 | C++ | Runtime Error |
#include <bits/stdc++.h>
#define C continue;
#define R return
#define D double
#define I insert
#define ll long long
#define ld long double
#define ull unsigned long long
#define ui unsigned int
#define pb push_back
#define pf push_front
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#de... |
#include <bits/stdc++.h>
#define C continue;
#define R return
#define D double
#define I insert
#define ll long long
#define ld long double
#define ull unsigned long long
#define ui unsigned int
#define pb push_back
#define pf push_front
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#de... | delete | 104 | 108 | 104 | 104 | -6 | terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int N;
vector<int> h(100001);
int main(void) {
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> h[i];
}
ll dp[10001];
dp[1] = 0;
dp[2] = abs(h[2] - h[1]);
for (int n = 3; n <= N; n++) {
dp[n]... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int N;
vector<int> h(100001);
int main(void) {
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> h[i];
}
ll dp[100001];
dp[1] = 0;
dp[2] = abs(h[2] - h[1]);
for (int n = 3; n <= N; n++) {
dp[n... | replace | 15 | 16 | 15 | 16 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int h[1 << 14];
int m[1 << 14];
cin >> N;
for (int i = 0; i < N; i++) {
cin >> h[i];
}
m[0] = 0;
m[1] = abs(h[0] - h[1]);
for (int i = 2; i < N; i++) {
m[i] =
min(m[i - 2] + abs(h[i] - h[i - 2]), m[i - 1] + abs(h[i] - ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int h[1 << 17];
int m[1 << 17];
cin >> N;
for (int i = 0; i < N; i++) {
cin >> h[i];
}
m[0] = 0;
m[1] = abs(h[0] - h[1]);
for (int i = 2; i < N; i++) {
m[i] =
min(m[i - 2] + abs(h[i] - h[i - 2]), m[i - 1] + abs(h[i] - ... | replace | 6 | 8 | 6 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define inf (pow(10, 18))
#define ll long long int
#define mod 1000000007
#define ntq(z) \
long long int z; \
cin >> z; ... | #include <bits/stdc++.h>
using namespace std;
#define inf (pow(10, 18))
#define ll long long int
#define mod 1000000007
#define ntq(z) \
long long int z; \
cin >> z; ... | delete | 152 | 156 | 152 | 152 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(... | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(... | replace | 79 | 83 | 79 | 83 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll int
const ll inf = 1e9;
const int N = 1e4 + 7;
ll dp[N][3], v[N];
ll n;
ll solve(ll cur, int p) {
if (cur == n)
return 0;
if (cur > n)
return inf;
// cout<<cur<<" "<<p<<endl;
if (dp[cur][p] != -1)
return dp[cur][p];
dp[cur][p] = solve(cur +... | #include <bits/stdc++.h>
using namespace std;
#define ll int
const ll inf = 1e9;
const int N = 1e5 + 7;
ll dp[N][3], v[N];
ll n;
ll solve(ll cur, int p) {
if (cur == n)
return 0;
if (cur > n)
return inf;
// cout<<cur<<" "<<p<<endl;
if (dp[cur][p] != -1)
return dp[cur][p];
dp[cur][p] = solve(cur +... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repi(i, 0, n)
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
// using P = pair<int, int>;
struct Vec {
double x, y;
};
template <class T> inline ... | #include <bits/stdc++.h>
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repi(i, 0, n)
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
// using P = pair<int, int>;
struct Vec {
double x, y;
};
template <class T> inline ... | replace | 27 | 28 | 27 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define str(a) to_string(a)
#define int long long
#define pb push_back
#define mp make_pair
#define SORT(c) sort(c.begin(), c.end())
#define max_heap priority_queue<int>
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define mod 1000000007
#define setbits(... | #include <bits/stdc++.h>
using namespace std;
#define str(a) to_string(a)
#define int long long
#define pb push_back
#define mp make_pair
#define SORT(c) sort(c.begin(), c.end())
#define max_heap priority_queue<int>
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define mod 1000000007
#define setbits(... | replace | 28 | 32 | 28 | 32 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define ac(x, i) get<i>(x)
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#defi... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define ac(x, i) get<i>(x)
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#defi... | replace | 24 | 25 | 24 | 25 | -11 | |
p03160 | C++ | Runtime Error | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int i, n;
cin >> n;
int h[10000], dp[10001];
for (i = 0; i < n; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (i = 2; i < n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i]... | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int i, n;
cin >> n;
int h[n], dp[n];
for (i = 0; i < n; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (i = 2; i < n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i -... | replace | 7 | 8 | 7 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9 + 5;
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
vector<int> h(n);
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9 + 5;
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif*/
int n;
cin >> n;
vector<int> h(n... | replace | 8 | 12 | 8 | 12 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n, stones[N];
int memo[N];
int jumps(int ind) {
if (ind == (n - 1))
return 0;
if (ind >= n)
return INT_MAX;
if (memo[ind] != -1)
return memo[ind];
int oneJump = abs(stones[ind] - stones[ind + 1]) + jumps(ind + 1);
int twoJum... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n, stones[N];
int memo[N];
int jumps(int ind) {
if (ind == (n - 1))
return 0;
if (ind >= n)
return INT_MAX;
if (memo[ind] != -1)
return memo[ind];
int oneJump = abs(stones[ind] - stones[ind + 1]) + jumps(ind + 1);
int twoJum... | replace | 24 | 25 | 24 | 25 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mod 1000000007
#define qmod 998244353
#define M 1000001
#define endl "\n"
#define all(a) (a).begin(), (a).end()
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repr(i, a, b) for (... | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mod 1000000007
#define qmod 998244353
#define M 1000001
#define endl "\n"
#define all(a) (a).begin(), (a).end()
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repr(i, a, b) for (... | replace | 36 | 40 | 36 | 40 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
using namespace std;
void c_p_c() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int minCost(ll *h, int n) {
ll dp[n];
dp[0] = 0;
dp[1] = abs(h[1] -... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
void c_p_c() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int minCost(ll *h, int n) {
ll dp[n];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++)
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i -... | delete | 7 | 11 | 7 | 7 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int n;
int num[101];
int dp[101];
int main() {
memset(dp, 63, sizeof dp);
cin >> n;
for (int qq = 1; qq <= n; qq++)
cin >> num[qq];
dp[1] = 0;
dp[2] = abs(num[1] - num[2]);
for (int qq = 3; qq <= n; qq++) {
dp[qq] = min(abs(num[qq - 2] - num[qq]) + dp[... | #include <bits/stdc++.h>
using namespace std;
int n;
int num[100001];
int dp[100001];
int main() {
memset(dp, 63, sizeof dp);
cin >> n;
for (int qq = 1; qq <= n; qq++)
cin >> num[qq];
dp[1] = 0;
dp[2] = abs(num[1] - num[2]);
for (int qq = 3; qq <= n; qq++) {
dp[qq] = min(abs(num[qq - 2] - num[qq])... | replace | 4 | 6 | 4 | 6 | 0 | |
p03160 | C++ | Runtime Error | // g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using ... | // g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using ... | replace | 26 | 28 | 26 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define MAXN 10005
using namespace std;
int main() {
// freopen("t.txt","r",stdin);
int n;
cin >> n;
int a[MAXN];
long long dp[MAXN];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
dp[1] = 0;
dp[2] = abs(a[2] - a[1]);
for (int i = 3; i <= n; i++) {
dp[i] = min((dp... | #include <bits/stdc++.h>
#define MAXN 100005
using namespace std;
int main() {
// freopen("t.txt","r",stdin);
int n;
cin >> n;
int a[MAXN];
long long dp[MAXN];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
dp[1] = 0;
dp[2] = abs(a[2] - a[1]);
for (int i = 3; i <= n; i++) {
dp[i] = min((d... | replace | 1 | 2 | 1 | 2 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n = 0;
cin >> n;
vector<int> h(n);
rep(i, n) { cin >> h[i]; }
int dp[10010];
dp[0] = 0;
... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n = 0;
cin >> n;
vector<int> h(n);
rep(i, n) { cin >> h[i]; }
int dp[100010];
dp[0] = 0;
... | replace | 15 | 16 | 15 | 16 | 0 | |
p03160 | C++ | Runtime Error | #include <iostream>
int dp[10001];
int h[10001];
int func(int a) {
if (dp[a] != -1) {
return dp[a];
}
if (func(a - 1) + abs(h[a] - h[a - 1]) < func(a - 2) + abs(h[a] - h[a - 2])) {
return dp[a] = func(a - 1) + abs(h[a] - h[a - 1]);
} else {
return dp[a] = func(a - 2) + abs(h[a] - h[a - 2]);
}
}
i... | #include <iostream>
int dp[100001];
int h[100001];
int func(int a) {
if (dp[a] != -1) {
return dp[a];
}
if (func(a - 1) + abs(h[a] - h[a - 1]) < func(a - 2) + abs(h[a] - h[a - 2])) {
return dp[a] = func(a - 1) + abs(h[a] - h[a - 1]);
} else {
return dp[a] = func(a - 2) + abs(h[a] - h[a - 2]);
}
}... | replace | 2 | 4 | 2 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define vii vector<pii>
#define pii pair<int, int>
#define mii map<int, int>
#define pb push_back
#define rev(v) reverse(v.begin(), v.end())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define endl ... | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define vii vector<pii>
#define pii pair<int, int>
#define mii map<int, int>
#define pb push_back
#define rev(v) reverse(v.begin(), v.end())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define endl ... | delete | 37 | 41 | 37 | 37 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int N = 10010;
int ls[N], c[N];
int calc(int n) {
c[2] = abs(ls[1] - ls[2]);
c[3] = min(abs(ls[1] - ls[3]), c[2] + abs(ls[2] - ls[3]));
for (int i = 4; i <= n; i++)
c[i] = min(c[i - 1] + abs(ls[i] - ls[i - 1]),
c[i - 2] + abs(ls[i - 2] - ls[... | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int ls[N], c[N];
int calc(int n) {
c[2] = abs(ls[1] - ls[2]);
c[3] = min(abs(ls[1] - ls[3]), c[2] + abs(ls[2] - ls[3]));
for (int i = 4; i <= n; i++)
c[i] = min(c[i - 1] + abs(ls[i] - ls[i - 1]),
c[i - 2] + abs(ls[i - 2] - ls... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
long long int minimum(long long int a[], long long int n, long long int b[]) {
if (n == 2) {
b[2] = abs(a[1] - a[0]);
return abs(a[1] - a[0]);
} else if (n == 3) {
long long int min = abs(a[2] - a[0]);
if (abs(a[1] - a[0]) + abs(a[2] ... | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
long long int minimum(long long int a[], long long int n, long long int b[]) {
if (n == 2) {
b[2] = abs(a[1] - a[0]);
return abs(a[1] - a[0]);
} else if (n == 3) {
long long int min = abs(a[2] - a[0]);
if (abs(a[1] - a[0]) + abs(a[2] ... | insert | 23 | 23 | 23 | 24 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
const int mx = 2e3 + 11;
const double PI = acos(-1);
#define MOD 1000000007
#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
const int mx = 1e5 + 11;
const double PI = acos(-1);
#define MOD 1000000007
#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I... | replace | 9 | 10 | 9 | 10 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(void) {
int n;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
int dp[10000];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(void) {
int n;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
int dp[1000000];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), ... | replace | 9 | 10 | 9 | 10 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
using namespace std;
const int MAX_N = 10000;
int h[MAX_N], dp[MAX_N + 1];
int n;
void solve() {
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
}
printf("%d",... | #include <algorithm>
#include <cstdio>
using namespace std;
const int MAX_N = 100000;
int h[MAX_N], dp[MAX_N + 1];
int n;
void solve() {
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
}
printf("%d"... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.14159265359
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define pb(a) push_back(a)
//////////// Solution /////////////////////////////////
const int MAXN = 1e5 + 1;
void solve() {
int h[MAXN];
ll dp[MAXN];
int n;
... | #include <bits/stdc++.h>
using namespace std;
#define ONLINE_JUDGE
#define ll long long
#define PI 3.14159265359
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define pb(a) push_back(a)
//////////// Solution /////////////////////////////////
const int MAXN = 1e5 + 1;
void solve() {
int h[MAXN];
ll... | insert | 3 | 3 | 3 | 4 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <limits>
using namespace std;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) \
for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define lli long long int
#define deb(x) co... | #include <bits/stdc++.h>
#include <limits>
using namespace std;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) \
for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define lli long long int
#define deb(x) co... | delete | 59 | 65 | 59 | 59 | -11 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int dp[100010];
int main() {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < 2 * n; i++) {
dp[i] = ... | #include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int dp[100010];
int main() {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < 100010; i++) {
dp[i] =... | replace | 19 | 20 | 19 | 20 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
t... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
t... | replace | 63 | 64 | 63 | 64 | 0 | |
p03160 | 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 ll long long
typedef pair<int, int> pii;
#define MOD 1000000007
#define MOD1 998244353
#define ff first
#define ss second
#define bn cout << "\n"
#define o2(a, ... | #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 ll long long
typedef pair<int, int> pii;
#define MOD 1000000007
#define MOD1 998244353
#define ff first
#define ss second
#define bn cout << "\n"
#define o2(a, ... | delete | 99 | 103 | 99 | 99 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vii vector<int, int>
#define pii pair<int, int>
#define nn "\n"
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vii vector<int, int>
#define pii pair<int, int>
#define nn "\n"
int main() {
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
ios::sync_with_stdio(0... | replace | 10 | 14 | 10 | 14 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int h[10100];
int f[10100];
int main() {
int N;
scanf("%d%d", &N, h + 1);
for (int i = 2; i <= N; i++) {
scanf("%d", h + i);
f[i] = f[i - 1] + abs(h[i] - h[i - 1]);
if (i - 2)
f[i] = min(f[i], f[i - 2] + abs(h[i] - h... | #include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int h[100100];
int f[100100];
int main() {
int N;
scanf("%d%d", &N, h + 1);
for (int i = 2; i <= N; i++) {
scanf("%d", h + i);
f[i] = f[i - 1] + abs(h[i] - h[i - 1]);
if (i - 2)
f[i] = min(f[i], f[i - 2] + abs(h[i] -... | replace | 5 | 7 | 5 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int h[10005], dp[10005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> h[i];
dp[0] = 999999;
dp[1] = 0;
for (int i = 2; i <= n; ++i)
dp[i] =
min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]));
cout <<... | #include <bits/stdc++.h>
using namespace std;
int h[100005], dp[100005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> h[i];
dp[0] = 999999;
dp[1] = 0;
for (int i = 2; i <= n; ++i)
dp[i] =
min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]));
cout ... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <iostream>
#include <queue>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
const int INF = 1001001001;
const int MOD = 1000000007;
int main(void) {
int n;
cin >> n;
vector<int> h(n); // コスト配列
rep(i, n) cin >> h[i];
queue<int> q;
q.push... | #include <iostream>
#include <queue>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
const int INF = 1001001001;
const int MOD = 1000000007;
int main(void) {
int n;
cin >> n;
vector<int> h(n); // コスト配列
rep(i, n) cin >> h[i];
queue<int> q;
q.push... | replace | 22 | 25 | 22 | 24 | TLE | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <iostream>
#define SIZE 10001
#define INF INT_MAX >> 1
using namespace std;
int dp[SIZE];
int main(void) {
int n;
cin >> n;
int h[SIZE] = {0};
for (int i = 0; i < n; i++) {
cin >> h[i];
}
fill(dp, dp + n, INF);
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);... | #include <algorithm>
#include <climits>
#include <iostream>
#define SIZE 100001
#define INF INT_MAX >> 1
using namespace std;
int dp[SIZE];
int main(void) {
int n;
cin >> n;
int h[SIZE] = {0};
for (int i = 0; i < n; i++) {
cin >> h[i];
}
fill(dp, dp + n, INF);
dp[0] = 0;
dp[1] = abs(h[1] - h[0])... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define inf (ll)1e9
#define d(x) cerr << #x ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define inf (ll)1e9
#define d(x) cerr << #x ... | replace | 10 | 11 | 10 | 11 | 0 | |
p03160 | C++ | Runtime Error | // STRIVER_79
// Lets goto the next level
// AIM 6* at CC and CM at CF *__*
#include <algorithm>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define mod (int)(1e9 + 21)
#define all(a) a.begin(), a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n... | // STRIVER_79
// Lets goto the next level
// AIM 6* at CC and CM at CF *__*
#include <algorithm>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define mod (int)(1e9 + 21)
#define all(a) a.begin(), a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n... | replace | 118 | 125 | 118 | 119 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define vs vector<string>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define mc map<char, ll>
#define itr ::iterator
#define f(i, a, b) for (... | #include <bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define vs vector<string>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define mc map<char, ll>
#define itr ::iterator
#define f(i, a, b) for (... | replace | 34 | 35 | 34 | 35 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast \
cin.tie(0); \
cout.tie(0); ... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast \
cin.tie(0); \
cout.tie(0); ... | replace | 34 | 35 | 34 | 35 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i, a, b) for (int i = a; i <= b; i++)
#define g(i, a, b) for (int i = a; i >= b; i--)
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq pr... | #include <bits/stdc++.h>
#include <iostream>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i, a, b) for (int i = a; i <= b; i++)
#define g(i, a, b) for (int i = a; i >= b; i--)
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq pr... | replace | 40 | 46 | 40 | 46 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int a[10010];
int b[10010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
b[0] = 0;
b[1] = abs(a[0] - a[1]);
for (int i = 2; i < n; i++) {
int l = abs(a[i] - a[i - 1]) + b[i - 1];
int r = abs(a[i] - a[i - 2]) + b[i - 2... | #include <bits/stdc++.h>
using namespace std;
int a[100010];
int b[100010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
b[0] = 0;
b[1] = abs(a[0] - a[1]);
for (int i = 2; i < n; i++) {
int l = abs(a[i] - a[i - 1]) + b[i - 1];
int r = abs(a[i] - a[i - 2]) + b[i -... | replace | 3 | 5 | 3 | 5 | 0 | |
p03160 | Python | Runtime Error | import functools
import threading
import sys
class SearchProblem(object):
def __init__(self, N, H):
self.N = N
self.H = H
def isEnd(self, i):
return i == self.N
def succ(self, i):
res = []
if i + 1 <= self.N:
res.append((i + 1, abs(self.H[i + 1] - self... | import functools
import threading
import sys
class SearchProblem(object):
def __init__(self, N, H):
self.N = N
self.H = H
def isEnd(self, i):
return i == self.N
def succ(self, i):
res = []
if i + 1 <= self.N:
res.append((i + 1, abs(self.H[i + 1] - self... | replace | 43 | 45 | 43 | 45 | RuntimeError: can't start new thread | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03160/Python/s280441279.py", line 47, in <module>
threading.Thread(target=main).start()
File "/usr/lib/python3.10/threading.py", line 935, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can... |
p03160 | C++ | Runtime Error | // Author : Vipul Sharma
// LIBRARIES
#include <bits/stdc++.h>
// MACROS
#define ll long long int
#define rep(i, a, b) for (i = a; i < b; i++)
#define rev(i, b, a) for (i = b - 1; i >= a; i--)
#define s1rep(i, a, b) for (i = 1; i <= b; i++)
#define itrep(at) for (auto it = at.begin(); it != at.end(); it++)
#define ld... | // Author : Vipul Sharma
// LIBRARIES
#include <bits/stdc++.h>
// MACROS
#define ll long long int
#define rep(i, a, b) for (i = a; i < b; i++)
#define rev(i, b, a) for (i = b - 1; i >= a; i--)
#define s1rep(i, a, b) for (i = 1; i <= b; i++)
#define itrep(at) for (auto it = at.begin(); it != at.end(); it++)
#define ld... | delete | 68 | 72 | 68 | 68 | -11 | |
p03160 | Python | Runtime Error | import sys
sys.setrecursionlimit(10**4)
n = int(input())
h = [int(x) for x in input().split()]
dp = [-1 for _ in range(n)]
def rec_dp(i: int) -> int:
global h, dp
if i == 0:
return 0
if dp[i] != -1:
return dp[i]
res = rec_dp(i - 1) + abs(h[i] - h[i - 1])
if i - 2 >= 0:
re... | import sys
sys.setrecursionlimit(10**9)
n = int(input())
h = [int(x) for x in input().split()]
dp = [-1 for _ in range(n)]
def rec_dp(i: int) -> int:
global h, dp
if i == 0:
return 0
if dp[i] != -1:
return dp[i]
res = rec_dp(i - 1) + abs(h[i] - h[i - 1])
if i - 2 >= 0:
re... | replace | 2 | 3 | 2 | 3 | 0 | |
p03160 | Python | Runtime Error | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *H = map(int, readline().split())
dp = [0] * N
dp[1] = abs(H[1] - H[0])
for i in range(2, N):
... | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *H = map(int, read().split())
dp = [0] * N
dp[1] = abs(H[1] - H[0])
for i in range(2, N):
... | replace | 16 | 17 | 16 | 17 | IndexError: list index out of range | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03160/Python/s149948517.py", line 19, in <module>
dp[1] = abs(H[1] - H[0])
IndexError: list index out of range
|
p03160 | Python | Runtime Error | # -*- coding: utf-8 -*-
# Input#
n = int(input())
# n, k = map(int, input().split())
h = list(map(int, input().split()))
h = [-1] + h
ans = 0
memo = [-1] * (n + 1)
memo[1] = 0
memo[2] = abs(h[2] - h[1])
def dp(i):
if memo[i] != -1:
return memo[i]
else:
hop1 = dp(i - 1) + abs(h[i] - h[i - 1]... | # -*- coding: utf-8 -*-
# Input#
n = int(input())
# n, k = map(int, input().split())
h = list(map(int, input().split()))
h = [-1] + h
ans = 0
memo = [-1] * (n + 1)
memo[1] = 0
memo[2] = abs(h[2] - h[1])
def dp(i):
if memo[i] != -1:
return memo[i]
else:
hop1 = dp(i - 1) + abs(h[i] - h[i - 1]... | replace | 26 | 27 | 26 | 31 | 0 | |
p03160 | Python | Runtime Error | N = int(input())
h = [int(i) for i in input().split()]
memo = [float("inf")] * N
memo[0], memo[1] = 0, abs(h[1] - h[0])
def frog(ith):
if memo[ith] != float("inf"):
return memo[ith]
memo[ith] = min(
frog(ith - 1) + abs(h[ith] - h[ith - 1]),
frog(ith - 2) + abs(h[ith] - h[ith - 2]),
... | import sys
sys.setrecursionlimit(500000)
N = int(input())
h = [int(i) for i in input().split()]
memo = [float("inf")] * N
memo[0], memo[1] = 0, abs(h[1] - h[0])
def frog(ith):
if memo[ith] != float("inf"):
return memo[ith]
memo[ith] = min(
frog(ith - 1) + abs(h[ith] - h[ith - 1]),
fr... | insert | 0 | 0 | 0 | 3 | 0 | |
p03160 | Python | Runtime Error | def frog():
n = int(input())
h_list = list(map(int, input().split()))
dp = [0] * 100
for n_element in range(n):
if n_element >= 2:
dp[n_element] = min(
dp[n_element - 1] + abs(h_list[n_element] - h_list[n_element - 1]),
dp[n_element - 2] + abs(h_list... | def frog():
n = int(input())
h_list = list(map(int, input().split()))
dp = [0] * 10**5
for n_element in range(n):
if n_element >= 2:
dp[n_element] = min(
dp[n_element - 1] + abs(h_list[n_element] - h_list[n_element - 1]),
dp[n_element - 2] + abs(h_li... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | Python | Runtime Error | INF = float("inf")
def LIST():
return list(map(int, input().split()))
def rec(i: int):
if dp[i] < INF:
return dp[i]
if i == 0:
return 0
res = INF
res = min(res, rec(i - 1) + abs(h[i] - h[i - 1]))
if i > 1:
res = min(res, rec(i - 2) + abs(h[i] - h[i - 2]))
dp[i]... | import sys
sys.setrecursionlimit(10**9)
INF = float("inf")
def LIST():
return list(map(int, input().split()))
def rec(i: int):
if dp[i] < INF:
return dp[i]
if i == 0:
return 0
res = INF
res = min(res, rec(i - 1) + abs(h[i] - h[i - 1]))
if i > 1:
res = min(res, rec... | insert | 0 | 0 | 0 | 4 | 0 | |
p03160 | Python | Runtime Error | N, K = map(int, input().split())
K = 2
(*h,) = map(int, input().split())
a = [abs(h[0] - h[k]) for k in range(K)]
for n in range(N - K):
a = a[1:] + [min([a[k] + abs(h[n + k] - h[n + K]) for k in range(K)])]
print(a[K - 1])
| N, K = int(input()), 2
(*h,) = map(int, input().split())
a = [abs(h[0] - h[k]) for k in range(K)]
for n in range(N - K):
a = a[1:] + [min([a[k] + abs(h[n + k] - h[n + K]) for k in range(K)])]
print(a[K - 1])
| replace | 0 | 2 | 0 | 1 | ValueError: not enough values to unpack (expected 2, got 1) | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03160/Python/s413689583.py", line 1, in <module>
N, K = map(int, input().split())
ValueError: not enough values to unpack (expected 2, got 1)
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int n, dp[10002], v[100002];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> v[i];
}
dp[1] = 0;
for (int i = 2; i <= n; i++) {
if (i == 2)
dp[i] = dp[i - 1] + abs(v[i] - v[i - 1]);
else
dp[i] = min(dp[i - 1] + abs(v[i] - v[i... | #include <bits/stdc++.h>
using namespace std;
ifstream fin("carte.in");
ofstream fout("carte.out");
int n, dp[100002], v[100002];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> v[i];
}
dp[1] = 0;
for (int i = 2; i <= n; i++) {
if (i == 2)
dp[i] = dp[i - 1] + abs(v[i] - v[i - 1]... | replace | 4 | 5 | 4 | 8 | 0 | |
p03160 | Python | Runtime Error | import sys
# import numpy as np
def main():
f = sys.stdin.buffer
N, K = map(int, f.readline().split())
H = list(map(int, f.readline().split()))
dp = [0] * N
for i in range(1, N):
dp[i] = min(
dp[i - k - 1] + abs(H[i] - H[i - k - 1]) for k in range(K) if i - k - 1 >= 0
... | n = int(input())
h = list(map(int, input().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
p0, p1 = p1, p2
print(p1)
| replace | 0 | 19 | 0 | 7 | ValueError: not enough values to unpack (expected 2, got 1) | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03160/Python/s516514400.py", line 19, in <module>
main()
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03160/Python/s516514400.py", line 8, in main
N, K = map(int, f.readline().spli... |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod ... | #include <bits/stdc++.h>
using namespace std;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod ... | replace | 31 | 37 | 31 | 32 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <climits>
using namespace std;
#define endl '\n'
// #define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define c0(x) cout << (x) << " "
#define c1(x) cout << (x) << endl
#define rep for (ll i = 0; i < n; i++)
#define f(i, s, n) for (ll i = s; i < n; i++)
#define f... | #include <bits/stdc++.h>
#include <climits>
using namespace std;
#define endl '\n'
// #define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define c0(x) cout << (x) << " "
#define c1(x) cout << (x) << endl
#define rep for (ll i = 0; i < n; i++)
#define f(i, s, n) for (ll i = s; i < n; i++)
#define f... | replace | 217 | 221 | 217 | 221 | 0 | |
p03160 | 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 INF = 1001001001;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
vector<int> h(... | #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 INF = 1001001001;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
ve... | insert | 18 | 18 | 18 | 19 | 0 | |
p03160 | C++ | Runtime Error | /******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for (int i ... | /******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for (int i ... | replace | 48 | 52 | 48 | 49 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int h[105], dp[105];
int main() {
memset(dp, 0, sizeof(dp));
int n;
cin >> n;
for (int i = 0; i < n; ++i)
cin >> h[i];
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; ++i)
dp[i] =
min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10;
int h[MAXN], dp[MAXN];
int main() {
memset(dp, 0, sizeof(dp));
int n;
cin >> n;
for (int i = 0; i < n; ++i)
cin >> h[i];
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < n; ++i)
dp[i] =
min(dp[i - 1] + abs(h[i - 1] - ... | replace | 3 | 4 | 3 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef map<string, int> msi;
typedef set<ll> sl;
t... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef map<string, int> msi;
typedef set<ll> sl;
t... | delete | 31 | 35 | 31 | 31 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FASTIO \
ios_base::sync_with_stdio(0); \
cin.tie... | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FASTIO \
ios_base::sync_with_stdio(0); \
cin.tie... | replace | 23 | 24 | 23 | 24 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[10005], ara[10005];
ll ans(ll n) {
if (n == 1) {
dp[1] = 0;
}
if (n == 2) {
dp[2] = abs(ara[2] - ara[1]);
return dp[2];
}
if (dp[n] != -1)
return dp[n];
dp[n] = min((ans(n - 1) + abs(ara[n] - ara[n - 1])),
... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[100005], ara[100005];
ll ans(ll n) {
if (n == 1) {
dp[1] = 0;
}
if (n == 2) {
dp[2] = abs(ara[2] - ara[1]);
return dp[2];
}
if (dp[n] != -1)
return dp[n];
dp[n] = min((ans(n - 1) + abs(ara[n] - ara[n - 1])),
... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[10005], ara[10005];
int main() {
ll n;
int i;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> ara[i];
}
dp[1] = 0;
dp[2] = abs(ara[1] - ara[2]);
for (i = 3; i <= n; i++) {
dp[i] = min(dp[i - 1] + abs(ara[i] - ara[i - 1]),
... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[100005], ara[100005];
int main() {
ll n;
int i;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> ara[i];
}
dp[1] = 0;
dp[2] = abs(ara[1] - ara[2]);
for (i = 3; i <= n; i++) {
dp[i] = min(dp[i - 1] + abs(ara[i] - ara[i - 1])... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int dp[60000], i, ara[60000], n;
cin >> n;
for (i = 1; i <= n; i++)
cin >> ara[i];
dp[1] = 0;
for (i = 2; i <= n; i++) {
dp[i] = dp[i - 1] + abs(ara[i] - ara[i - 1]);
if (i > 2)
dp[i] = min(dp[i], dp[i - 2] + abs(ara[i] - ara[i - 2])... | #include <bits/stdc++.h>
using namespace std;
int main() {
int dp[100005], i, ara[100005], n;
cin >> n;
for (i = 1; i <= n; i++)
cin >> ara[i];
dp[1] = 0;
for (i = 2; i <= n; i++) {
dp[i] = dp[i - 1] + abs(ara[i] - ara[i - 1]);
if (i > 2)
dp[i] = min(dp[i], dp[i - 2] + abs(ara[i] - ara[i - 2... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int n, h;
vi heights;
int dp[1... | #include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int n, h;
vi heights;
int dp[1... | replace | 39 | 40 | 39 | 40 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
const int INF = 1001001001;
int main() {
int N, h[10000], dp[10000];
cin >> N;
rep(i, N) { cin >> h[i]; }
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
dp[i] =
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
const int INF = 1001001001;
int main() {
int N, h[100000], dp[100000];
cin >> N;
rep(i, N) { cin >> h[i]; }
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
dp[i] =
... | replace | 8 | 9 | 8 | 9 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <regex>
#include <string>
#include <vector>
using namespace std;
const int INF = 1 << 29;
int main() {
int n;
cin >> n;
vector<int> vec;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
vec.push_back(tmp);
}
for (int i =... | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <regex>
#include <string>
#include <vector>
using namespace std;
const int INF = 1 << 29;
int main() {
int n;
cin >> n;
vector<int> vec;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
vec.push_back(tmp);
}
for (int i =... | replace | 26 | 28 | 26 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
vector<ll> hieghts;
#define INF 1000000007
const int N = 1e7;
vector<ll> dp(N);
ll total_size;
int min_cost(int curr_position) {
dp[0] = 0;
dp[1] = abs(hieghts[1] - hieghts[0]);
for (ll i = 2; i < total_size; i++) {
d... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
vector<ll> hieghts;
#define INF 1000000007
const int N = 1e7;
vector<ll> dp(N);
ll total_size;
int min_cost(int curr_position) {
dp[0] = 0;
dp[1] = abs(hieghts[1] - hieghts[0]);
for (ll i = 2; i < total_size; i++) {
d... | replace | 21 | 25 | 21 | 25 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl '\n'
#define he... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl '\n'
#define he... | replace | 38 | 42 | 38 | 42 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const ll ... | #include <algorithm>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const ll ... | replace | 24 | 25 | 24 | 25 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
bool debug = true;
#endif
typedef long long unsigned llu;
typedef long long lld;
typedef long ld;
#define N 100005
int a[N], dp[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
if (debug)
freopen("input.txt", "r", stdin), ... | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
bool debug = true;
#endif
typedef long long unsigned llu;
typedef long long lld;
typedef long ld;
#define N 100005
int a[N], dp[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i, n;
cin >> n;
for (i = 1; i <= n; i++)
... | delete | 17 | 19 | 17 | 17 | -11 | |
p03160 | 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;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 1LL << 60;
const i... | #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;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 1LL << 60;
const i... | replace | 21 | 22 | 21 | 22 | 0 | |
p03160 | 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;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 1LL << 60;
int ma... | #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;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 1LL << 60;
int ma... | replace | 26 | 28 | 26 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define rep(i, x, n) for (int i = x; i < n; i++)
#define reprev(i, n, x) for (int i = n; i >= x; i--)
#define mp(a, b) make_pair(a, b)
#define mod 998244353
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#pragma GCC target("sse4.2")
using namespace s... | #include <bits/stdc++.h>
#define int long long
#define rep(i, x, n) for (int i = x; i < n; i++)
#define reprev(i, n, x) for (int i = n; i >= x; i--)
#define mp(a, b) make_pair(a, b)
#define mod 998244353
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#pragma GCC target("sse4.2")
using namespace s... | replace | 31 | 35 | 31 | 35 | 0 | time taken: 0.032539
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define clr cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define _val(x) cerr << #x << " is " << x << "\n";
#define all(container) container.begin(), container.end()
#define rall(container) container.rbegin(), container.rend()
#define rep(i, a, b, c) for (ll i = a; i <= b; i += c)
#defin... | #include <bits/stdc++.h>
#define clr cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define _val(x) cerr << #x << " is " << x << "\n";
#define all(container) container.begin(), container.end()
#define rall(container) container.rbegin(), container.rend()
#define rep(i, a, b, c) for (ll i = a; i <= b; i += c)
#defin... | delete | 23 | 27 | 23 | 23 | -11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.