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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p03158 | C++ | Runtime Error | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;
using namespace std;
int main() {
int n, q;
cin >> n >> q;
vl a(n),... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;
using namespace std;
int main() {
int n, q;
cin >> n >> q;
vl a(n),... | replace | 14 | 15 | 14 | 15 | 0 | |
p03158 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
#define int long long int
#define rep(i, n) for (int i = 0; i < (n)... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
#define int long long int
#define rep(i, n) for (int i = 0; i < (n)... | replace | 51 | 52 | 51 | 52 | 0 | |
p03158 | C++ | Runtime Error | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = int(n) - 1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = int(n) - 1; (i) >= (int)(m); --(i))
#define ALL(x) begin(x), end(x)
#define d... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = int(n) - 1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = int(n) - 1; (i) >= (int)(m); --(i))
#define ALL(x) begin(x), end(x)
#define d... | replace | 54 | 55 | 54 | 55 | 0 | |
p03158 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
template <typename ty1, typename ty2> inline int add(ty1 x, ty2 y) {
if (y >= MOD)
y %= MOD;
if (x >= MOD)
x %= MOD;
x += y;
return x < MOD ? x : x - MOD;
}
template <typename ty1, typename ty2> inline void addto(ty1 &x, ty2 y) {
if ... | #include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
template <typename ty1, typename ty2> inline int add(ty1 x, ty2 y) {
if (y >= MOD)
y %= MOD;
if (x >= MOD)
x %= MOD;
x += y;
return x < MOD ? x : x - MOD;
}
template <typename ty1, typename ty2> inline void addto(ty1 &x, ty2 y) {
if ... | replace | 198 | 199 | 198 | 204 | 0 | |
p03158 | C++ | Runtime Error | #include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <str... | #include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <str... | replace | 48 | 49 | 48 | 49 | 0 | |
p03158 | C++ | Runtime Error | // #define DEBUGGING // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)
#ifndef DEBUGGING
#define DEBUG(...)
#else
template <typename T> void _debug(T value) { std::cerr << value; }
te... | // #define DEBUGGING // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)
#ifndef DEBUGGING
#define DEBUG(...)
#else
template <typename T> void _debug(T value) { std::cerr << value; }
te... | replace | 72 | 80 | 72 | 84 | 0 | |
p03158 | C++ | Runtime Error | #include "bits/stdc++.h"
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v... | #include "bits/stdc++.h"
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v... | replace | 72 | 73 | 72 | 73 | 0 | |
p03158 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (int i = (a); i >= (b); --i)
#define edge(i, u) \
for (int i = head[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define mod 1000000007
#define ll long long... | #include <bits/stdc++.h>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (int i = (a); i >= (b); --i)
#define edge(i, u) \
for (int i = head[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define mod 1000000007
#define ll long long... | replace | 7 | 8 | 7 | 8 | 0 | |
p03159 | C++ | Runtime Error | // https://atcoder.jp/contests/aising2019/tasks/aising2019_e
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if (1)
#else
#define CIN_ONLY if (1)
struct cww {
cww() {
CIN_ONLY {
ios::sync_with_stdio(false);
cin.tie(0);
}
}
} star;
#define DEBUG if (0)... | // https://atcoder.jp/contests/aising2019/tasks/aising2019_e
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if (1)
#else
#define CIN_ONLY if (1)
struct cww {
cww() {
CIN_ONLY {
ios::sync_with_stdio(false);
cin.tie(0);
}
}
} star;
#define DEBUG if (0)... | replace | 103 | 104 | 103 | 104 | -11 | |
p03159 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define _USE_MATH_DEFINES
#include <complex>
#include <functional>
#include <math.h>
using namespace std;
#define rep(i, x) for (ll i = 0; i < x; i++)
#define r... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define _USE_MATH_DEFINES
#include <complex>
#include <functional>
#include <math.h>
using namespace std;
#define rep(i, x) for (ll i = 0; i < x; i++)
#define r... | replace | 150 | 157 | 150 | 151 | TLE | |
p03159 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
... | #include "bits/stdc++.h"
using namespace std;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
... | replace | 62 | 63 | 62 | 63 | TLE | |
p03159 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define FOR(i, begin, end) for (int i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (int i = (end)-1; i >= (begin); i--)
#define IREP(i, n) IFOR(i, 0, n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define L... | #include <bits/stdc++.h>
#define FOR(i, begin, end) for (int i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (int i = (end)-1; i >= (begin); i--)
#define IREP(i, n) IFOR(i, 0, n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define L... | replace | 139 | 155 | 139 | 153 | TLE | |
p03159 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
const long long MAXN = 3e3 + 5;
vector<long long> v1[MAXN];
long long dp[MAXN][MAXN][3];
long long temp[MAXN][3];
long long sz[MAXN];
long long arr[MAXN];
void dfs(long long curr, long long par) {
for (long long x : v1[curr]) {
if (x != par) {
df... | #include <iostream>
#include <vector>
using namespace std;
const long long MAXN = 5e3 + 5;
vector<long long> v1[MAXN];
long long dp[MAXN][MAXN][3];
long long temp[MAXN][3];
long long sz[MAXN];
long long arr[MAXN];
void dfs(long long curr, long long par) {
for (long long x : v1[curr]) {
if (x != par) {
df... | replace | 5 | 6 | 5 | 6 | -11 | |
p03159 | C++ | Time Limit Exceeded | /**
* author: otera
**/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <se... | /**
* author: otera
**/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <se... | replace | 111 | 112 | 111 | 112 | TLE | |
p03159 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long dp[5010][5010];
long long tmp[5010];
bool pos[5010][5010];
bool ptmp[5010];
int sz[5010];
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector<vecto... | #include <bits/stdc++.h>
using namespace std;
long long dp[5010][5010];
long long tmp[5010];
bool pos[5010][5010];
bool ptmp[5010];
int sz[5010];
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector<vecto... | replace | 40 | 41 | 40 | 41 | -11 | |
p03159 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <s... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <s... | insert | 105 | 105 | 105 | 107 | TLE | |
p03159 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
signed main() {
int n;
cin >> n;
vector<int> a(n);
for (auto &y : a)
cin >> y;
vector<int> u(n - 1);
vector<int> v(n - 1);
for (int i = 0; i < n - 1; ++i) {
cin >> u[i] >> v[i];
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
signed main() {
int n;
cin >> n;
vector<int> a(n);
for (auto &y : a)
cin >> y;
vector<int> u(n - 1);
vector<int> v(n - 1);
for (int i = 0; i < n - 1; ++i) {
cin >> u[i] >> v[i];
... | replace | 81 | 82 | 81 | 82 | -11 | |
p03159 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include ... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include ... | replace | 76 | 77 | 76 | 77 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
int *h;
int *dp;
bool *v;
int solve(int n, const int &max) {
if (n == max - 1)
return 0;
if (n == max) {
return 1e9;
}
if (v[n])
return dp[n];
int cost = dp[n] = min(solve(n + 1, max) + abs(h[n] - h[n + 1]),
solve(n + 2, ma... | #include "bits/stdc++.h"
using namespace std;
int *h;
int *dp;
bool *v;
int solve(int n, const int &max) {
if (n == max - 1)
return 0;
if (n == max) {
return 1e9;
}
if (v[n])
return dp[n];
int cost = dp[n] = min(solve(n + 1, max) + abs(h[n] - h[n + 1]),
solve(n + 2, ma... | insert | 19 | 19 | 19 | 20 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define frst first
#define sec second
#define fast cin.tie(0), ios_base ::sync_with_stdio(0)
#define db double
#define mod 1000000007
void online_judge() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.t... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define frst first
#define sec second
#define fast cin.tie(0), ios_base ::sync_with_stdio(0)
#define db double
#define mod 1000000007
void online_judge() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.t... | replace | 133 | 134 | 133 | 134 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define frst first
#define sec second
#define fast cin.tie(0), ios_base ::sync_with_stdio(0)
#define db double
#define mod 1000000007
void online_judge() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.t... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define frst first
#define sec second
#define fast cin.tie(0), ios_base ::sync_with_stdio(0)
#define db double
#define mod 1000000007
void online_judge() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.t... | replace | 134 | 135 | 134 | 135 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
vector<int64_t> dp(100010, INT64_MAX);
int64_t dfs(vector<int> &arr, int i) {
if (dp[i] != INT64_MAX) {
return dp[i];
}
if (i <= 0) {
return 0;
}
//
// i - 1 と、i - 2 への遷移を再帰的に集めてきて
// それの min を返り値とする
//
// これは、同じ i であれば、返り値が同じになる
// ことがメ... | #include <bits/stdc++.h>
using namespace std;
vector<int64_t> dp(100010, INT64_MAX);
int64_t dfs(vector<int> &arr, int i) {
if (dp[i] != INT64_MAX) {
return dp[i];
}
if (i <= 0) {
return 0;
}
//
// i - 1 と、i - 2 への遷移を再帰的に集めてきて
// それの min を返り値とする
//
// これは、同じ i であれば、返り値が同じになる
// ことがメ... | insert | 33 | 33 | 33 | 34 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef vector<ll> vl;
typedef vector<vl> vv;
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define endl '\n'
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main() {
fast();
#ifndef ONLINE_... | #include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef vector<ll> vl;
typedef vector<vl> vv;
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define endl '\n'
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main() {
fast();
// #ifndef ON... | replace | 18 | 22 | 18 | 22 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define erep(i, n) for (ll i = 1; i <= (n)i++)
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
// input
ll h[10010];
// dp tabel
ll dp[100010];
int main(voi... | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define erep(i, n) for (ll i = 1; i <= (n)i++)
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
// input
ll h[100010];
// dp tabel
ll dp[100010];
int main(vo... | replace | 9 | 10 | 9 | 10 | 0 | |
p03160 | C++ | Runtime Error | //////////////////////////////////////
//// ABHINASH GIRI ////
/////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define pr 4294967296 // 2^32
#define fast \
ios_base::sync_with_stdio(false); ... | //////////////////////////////////////
//// ABHINASH GIRI ////
/////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define pr 4294967296 // 2^32
#define fast \
ios_base::sync_with_stdio(false); ... | replace | 109 | 111 | 109 | 115 | 0 | |
p03160 | C++ | Runtime Error | // #pragma GCC optimize "trapv"
#include <bits/stdc++.h>
#define ll long long
#define fab(a, b, i) for (int i = a; i < b; i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define quick ... | // #pragma GCC optimize "trapv"
#include <bits/stdc++.h>
#define ll long long
#define fab(a, b, i) for (int i = a; i < b; i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define quick ... | replace | 19 | 23 | 19 | 20 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define F(i, a, b) for (ll i = a; i < b; i++)
#define RF(i, a, b) for (ll i = a; i > b; i--)
#define pii pair<ll, ll>
#define ff first
#define ss second
#define pb(x) push_back(x)
#define pob pop_back
#define mp(x, y) make_pair(x, y)
#define mod 1000000007
#define w(t) ... | #include <bits/stdc++.h>
#define ll long long
#define F(i, a, b) for (ll i = a; i < b; i++)
#define RF(i, a, b) for (ll i = a; i > b; i--)
#define pii pair<ll, ll>
#define ff first
#define ss second
#define pb(x) push_back(x)
#define pob pop_back
#define mp(x, y) make_pair(x, y)
#define mod 1000000007
#define w(t) ... | delete | 36 | 41 | 36 | 36 | 0 | |
p03160 | C++ | Runtime Error | #include <iostream>
#define ll long long
using namespace std;
ll int min(ll int a, ll int b) {
if (a > b)
return b;
return a;
}
ll int abs(ll int a) {
if (a > 0)
return a;
return -a;
}
ll int x[10000];
int main() {
int a;
cin >> a;
int b[a + 6];
for (int i = 0; i < a; i++)
cin >> b[i];
x[1... | #include <iostream>
#define ll long long
using namespace std;
ll int min(ll int a, ll int b) {
if (a > b)
return b;
return a;
}
ll int abs(ll int a) {
if (a > 0)
return a;
return -a;
}
ll int x[200000];
int main() {
int a;
cin >> a;
int b[a + 6];
for (int i = 0; i < a; i++)
cin >> b[i];
x[... | replace | 13 | 14 | 13 | 14 | 0 | |
p03160 | C++ | Runtime Error | // DP1
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
}
vect... | // DP1
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
}
vect... | replace | 21 | 26 | 21 | 25 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 18446744073709551614) >= this->size() (which is 4)
|
p03160 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
// #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
... | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
// #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
... | replace | 23 | 24 | 23 | 24 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n... | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n... | delete | 13 | 18 | 13 | 13 | -11 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <vector>
// #include <bits/stdc++.h>
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
const int N = 5e4 + 100;
usi... | #include <algorithm>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <vector>
// #include <bits/stdc++.h>
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
const int N = 5e5 + 100;
usi... | replace | 16 | 17 | 16 | 17 | 0 | |
p03160 | C++ | Runtime Error | // https://atcoder.jp/contests/dp/tasks/dp_a
// 29-02-2020
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
vector<int> h(n), dp(n, 0);
f... | // https://atcoder.jp/contests/dp/tasks/dp_a
// 29-02-2020
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// #ifndef ONLINE_JUDGE
// freopen ("input.txt", "r", stdin);
// freopen ("output.txt", "w", stdout);
// #endif
int n;
cin >> n;
vector<int> h... | replace | 8 | 12 | 8 | 12 | -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 F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair<int, int>
#define pll pair<long long, long long>
#defi... | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair<int, int>
#define pll pair<long long, long long>
#defi... | replace | 20 | 21 | 20 | 21 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define rep(n) for (int i = 0; i < n; i++)
#define rrep(n) for (int i = n; i >= 0; i--)
#define Rep(a, b) for (int i = a; i < b; i++)
#define Rrep(a, b) for (int i = a; i >= b; i--)
#define gcd(x, y) __gcd(x, y)
#define mp make_pair
#define fi first
#define se second
#defin... | #include <bits/stdc++.h>
#define ll long long
#define rep(n) for (int i = 0; i < n; i++)
#define rrep(n) for (int i = n; i >= 0; i--)
#define Rep(a, b) for (int i = a; i < b; i++)
#define Rrep(a, b) for (int i = a; i >= b; i--)
#define gcd(x, y) __gcd(x, y)
#define mp make_pair
#define fi first
#define se second
#defin... | replace | 26 | 27 | 26 | 27 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int dp[1100];
for (int i = 0; i < 110000; i++)
dp[i] = 1000000000;
int h[N];
for (int i = 0; i < N; i++)
cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
// cout<<dp[0]<<endl<<dp[1]<<endl;
for (int i = 2; i < N; ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int dp[110000];
for (int i = 0; i < 110000; i++)
dp[i] = 1000000000;
int h[N];
for (int i = 0; i < N; i++)
cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
// cout<<dp[0]<<endl<<dp[1]<<endl;
for (int i = 2; i < N... | replace | 6 | 7 | 6 | 7 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
const int mxn = 1e5 + 100;
int a[mxn], dp[mxn], n;
bool cal[mxn];
int abs(int x) { return (x > 0 ? x : -x); }
int dpf(int x) {
if (cal[x] == true)
return dp[x];
dp[x] = dpf(x - 1) + abs(a[x] - a[x - 1]);
if (x > 1)
dp[x] = min(dp[x], dpf(x - 2) + abs(a[x] - a[x -... | #include <iostream>
using namespace std;
const int mxn = 1e5 + 100;
int a[mxn], dp[mxn], n;
bool cal[mxn];
int abs(int x) { return (x > 0 ? x : -x); }
int dpf(int x) {
if (cal[x] == true)
return dp[x];
cal[x] = true;
dp[x] = dpf(x - 1) + abs(a[x] - a[x - 1]);
if (x > 1)
dp[x] = min(dp[x], dpf(x - 2) +... | insert | 11 | 11 | 11 | 12 | TLE | |
p03160 | C++ | Runtime Error |
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
using namespace __gnu_pbds; //policy-based data structures (like set with
adttional functionality) some operations
//(*name.find_by_order(x) it givesyou value of x index in sorted set and
name.find_by_key(no) it gives you the number ... |
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
using namespace __gnu_pbds; //policy-based data structures (like set with
adttional functionality) some operations
//(*name.find_by_order(x) it givesyou value of x index in sorted set and
name.find_by_key(no) it gives you the number ... | replace | 90 | 94 | 90 | 91 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const LL INF = 1e15;
LL memo[100005];
LL datas[100005];
int N;
LL solve(int ix) {
if (ix == N)
return 0;
if (ix > N)
return INF;
if (memo[ix] != -1)
r... | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const LL INF = 1e15;
LL memo[100005];
LL datas[100005];
int N;
LL solve(int ix) {
if (ix == N)
return 0;
if (ix > N)
return INF;
if (memo[ix] != -1)
r... | replace | 18 | 20 | 18 | 20 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
int n;
scanf("%d", &n);
vector<int> h(n);
for (int &x : h) {
scanf("%d", &x);
}
vector<int> ans(n, 0);
ans[n - 2] = abs(h[n - 1] - h[n - 2]);
ans[n - 3] = abs(h[n - 3] - h[n - 1]);
for (int i = n - 4; i >= 0; i--)... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
int n;
scanf("%d", &n);
vector<int> h(n);
for (int &x : h) {
scanf("%d", &x);
}
vector<int> ans(n, 0);
ans[n - 2] = abs(h[n - 1] - h[n - 2]);
if (n >= 3)
ans[n - 3] = abs(h[n - 3] - h[n - 1]);
for (int i = n -... | replace | 13 | 14 | 13 | 15 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define FAST_IO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define INF (1e10 + 5)
#define F firs... | #include <bits/stdc++.h>
#define FAST_IO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define INF (1e10 + 5)
#define F firs... | replace | 81 | 82 | 81 | 82 | 0 | |
p03160 | C++ | Runtime Error | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
const int maxN = 1e4 + 5, INF = 1e9 + 5;
vector<int> dp(maxN, INF), a(maxN);
int rc(int in) {
if (dp[in] != INF)
return dp[in];
if (in == 0) {
return dp[0] = 0;
}
if (in == 1) {
return dp[1] = abs(a[1] - a[0]);
}
ret... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
const int maxN = 2e5 + 5, INF = 1e9 + 5;
vector<int> dp(maxN, INF), a(maxN);
int rc(int in) {
if (dp[in] != INF)
return dp[in];
if (in == 0) {
return dp[0] = 0;
}
if (in == 1) {
return dp[1] = abs(a[1] - a[0]);
}
ret... | replace | 6 | 7 | 6 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
t... | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
t... | replace | 26 | 27 | 26 | 27 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int, int> ii;
const int inf = 1e9 + 1;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n;
ci... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int, int> ii;
const int inf = 1e9 + 1;
int main() {
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n;
c... | replace | 11 | 12 | 11 | 12 | -6 | terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
|
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define INF 1000000000
using namespace std;
int n, h[100005], mem[100005];
int dp(int i) {
if (i == 1)
return 0;
if (i < 1)
return INF;
int a1 = dp(i - 1) + abs(h[i - 1] - h[i]);
int a2 = dp(i - 2) + abs(h[i - 2] - h[i]);
return mem[i] = min(a1, a2);
}
int main() {
cin >> n;... | #include <bits/stdc++.h>
#define INF 1000000000
using namespace std;
int n, h[100005], mem[100005];
int dp(int i) {
if (i == 1)
return 0;
if (i < 1)
return INF;
if (mem[i] != -1)
return mem[i];
int a1 = dp(i - 1) + abs(h[i - 1] - h[i]);
int a2 = dp(i - 2) + abs(h[i - 2] - h[i]);
return mem[i] = ... | insert | 9 | 9 | 9 | 11 | TLE | |
p03160 | C++ | Runtime Error | // Inbornhandsome
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)... | // Inbornhandsome
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)... | replace | 34 | 36 | 34 | 35 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
long double PI = 3.141592653589793238463;
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
ll a[100005];
ll dp[100005][4];
int n;
int D(int x) {
for (int i = x; i < n; i++) {
dp[i][0] = (abs(a[i] - a[i - 1]) + min(dp[i - 1][0], dp[i - 1][1]));
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
long double PI = 3.141592653589793238463;
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
ll a[100005];
ll dp[100005][4];
int n;
void D(int x) {
for (int i = x; i < n; i++) {
dp[i][0] = (abs(a[i] - a[i - 1]) + min(dp[i - 1][0], dp[i - 1][1]));
... | replace | 11 | 12 | 11 | 12 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define f(n) for (int i = 0; i < n; i++)
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
... | #include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define f(n) for (int i = 0; i < n; i++)
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
... | replace | 57 | 58 | 57 | 58 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define EACH(i, a, b) for (int i = (a); i <= (b); i++)
#define ... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define EACH(i, a, b) for (int i = (a); i <= (b); i++)
#define ... | replace | 42 | 43 | 42 | 43 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
const int MAX_N = 100005;
const int MAX = 2000000005;
int N;
int mem[MAX_N];
int heights[MAX_N];
int dp(int stone) {
if (stone == N)
return 0;
if (stone > N)
return MAX;
int best = MAX;
if (stone + 1 <= N)
best = std::min(
dp(stone + 1) + std::abs(heights[stone] ... | #include <bits/stdc++.h>
const int MAX_N = 100005;
const int MAX = 2000000005;
int N;
int mem[MAX_N];
int heights[MAX_N];
int dp(int stone) {
if (stone == N)
return 0;
if (stone > N)
return MAX;
if (mem[stone] != -1)
return mem[stone];
int best = MAX;
if (stone + 1 <= N)
best = std::min(
... | insert | 14 | 14 | 14 | 16 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int getCost(int *arr, int index, vector<int> mem) {
if (mem[index] != -1)
return mem[index];
int cost = INT_MAX;
if (index + 1 < mem.size())
cost = min(cost,
abs(arr[index] - arr[index + 1]) + getCost(arr, index + 1, mem));
if (index + 2 < me... | #include <bits/stdc++.h>
using namespace std;
int getCost(int *arr, int index, vector<int> &mem) {
if (mem[index] != -1)
return mem[index];
int cost = INT_MAX;
if (index + 1 < mem.size())
cost = min(cost,
abs(arr[index] - arr[index + 1]) + getCost(arr, index + 1, mem));
if (index + 2 < m... | replace | 2 | 3 | 2 | 3 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FastRead \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long ... | #include <bits/stdc++.h>
using namespace std;
#define FastRead \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long ... | delete | 63 | 68 | 63 | 63 | 0 | |
p03160 | C++ | Runtime Error | /***
** AUTHOR::ASHUTOSH MOUDGIL
***/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define F f... | /***
** AUTHOR::ASHUTOSH MOUDGIL
***/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define F f... | replace | 24 | 26 | 24 | 26 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define dd double
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vdd vector<double>
#define vpii vector<pair<int, int>>
#define vpll v... | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define dd double
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vdd vector<double>
#define vpii vector<pair<int, int>>
#define vpll v... | replace | 76 | 78 | 76 | 79 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | // Created by Tanuj Jain
#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 mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
template <class T>
using oset =
tree<T, null_ty... | // Created by Tanuj Jain
#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 mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
template <class T>
using oset =
tree<T, null_ty... | replace | 66 | 70 | 66 | 70 | -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;
int minCost(int n, int cost[], int dp[]) {
if (n == 1) {
return 0;
}
if (n == 2) {
return abs(cost[1] - cost[0]);
}
if (dp[n] != -1) {
return dp[n];
}
int cost1 = abs(cost[n - 1] - cost[n - 2]) + minCost(n - 1, cost, dp);
int cost2 = abs(cost[n ... | #include <bits/stdc++.h>
using namespace std;
int minCost(int n, int cost[], int dp[]) {
if (n == 1) {
return 0;
}
if (n == 2) {
return abs(cost[1] - cost[0]);
}
if (dp[n] != -1) {
return dp[n];
}
int cost1 = abs(cost[n - 1] - cost[n - 2]) + minCost(n - 1, cost, dp);
int cost2 = abs(cost[n ... | replace | 26 | 28 | 26 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define oo int(1e9)
using namespace std;
int n;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
cout.tie(0);
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
vector<int> dp(n);
for (int i = 1; i <= n; i++)
dp[i] = oo;
for (int i = 0; i < n; i++)
... | #include <bits/stdc++.h>
#define oo int(1e9)
using namespace std;
int n;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
cout.tie(0);
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
vector<int> dp(n);
for (int i = 1; i < n; i++)
dp[i] = oo;
for (int i = 0; i < n; i++)
... | replace | 14 | 15 | 14 | 15 | 0 | |
p03160 | C++ | Runtime Error | // I'm a f*cking looser
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define asc(A) sort(A.begin(), A.end())
#define dsc(A... | // I'm a f*cking looser
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define asc(A) sort(A.begin(), A.end())
#define dsc(A... | replace | 13 | 18 | 13 | 14 | -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 ll long long
#define mod 1000000007
#define inf 1000000000000000000
#define fr first
#define sc second
#define pb push_back
#define pf push_front
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define per(i, a, n) for (ll i = n - 1; i >= a; i--)
#define pll pair<l... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define inf 1000000000000000000
#define fr first
#define sc second
#define pb push_back
#define pf push_front
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define per(i, a, n) for (ll i = n - 1; i >= a; i--)
#define pll pair<l... | replace | 26 | 31 | 26 | 31 | -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 IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define int lon... | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define int lon... | delete | 42 | 46 | 42 | 42 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int64_t min_cost(int step, vector<int> &h, vector<int64_t> &memo) {
if (step == 1)
return 0;
if (step == 2)
return abs(h.at(0) - h.at(1));
int elem = step - 1;
int64_t near = abs(h.at(elem) - h.at(elem - 1));
if (memo.at(elem - 1) != -1) {
near += me... | #include <bits/stdc++.h>
using namespace std;
int64_t min_cost(int step, vector<int> &h, vector<int64_t> &memo) {
if (step == 1)
return 0;
if (step == 2)
return abs(h.at(0) - h.at(1));
int elem = step - 1;
int64_t near = abs(h.at(elem) - h.at(elem - 1));
if (memo.at(elem - 1) != -1) {
near += me... | replace | 22 | 23 | 22 | 23 | TLE | |
p03160 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long int ll;
const ll INF = 1000000000;... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long int ll;
const ll INF = 1000000000;... | replace | 30 | 31 | 30 | 31 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, dp[10020], h[10020];
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++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - ... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, dp[100020], h[100020];
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++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i ... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
void solve() {
int n;
cin >> n;
vector<int> vec(n), dp(n, INT_MAX);
for (int i = 0; i < n; ++i) {
cin >> vec[i];
}
dp[0] = 0, dp[1] = abs(vec[0] - vec[1]);
for (int i = 2; i < n; ++i) {
dp[i] = min(abs(vec... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
void solve() {
int n;
cin >> n;
vector<int> vec(n), dp(n, INT_MAX);
for (int i = 0; i < n; ++i) {
cin >> vec[i];
}
dp[0] = 0, dp[1] = abs(vec[0] - vec[1]);
for (int i = 2; i < n; ++i) {
dp[i] = min(abs(vec... | delete | 23 | 27 | 23 | 23 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
//************** StrAnge.R *********************
#define ll long long int
#define ull unsigned long l... | #include <bits/stdc++.h>
using namespace std;
/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
//************** StrAnge.R *********************
#define ll long long int
#define ull unsigned long l... | replace | 159 | 160 | 159 | 160 | TLE | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX = 10000000;
ll h[100010];
ll dps[100010];
// n番目のジャンプ台まで到達するための最小コストを返す
ll dp(int n) {
if (n == 0) {
return 0;
}
if (dps[n] < MAX) {
return dps[n];
}
ll n1 = dp(n - 1) + abs(h[n] - h[n - 1]);
ll n2 = MAX;
if (n > 1... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MAX = 1LL << 60;
ll h[100010];
ll dps[100010];
// n番目のジャンプ台まで到達するための最小コストを返す
ll dp(int n) {
if (n == 0) {
return 0;
}
if (dps[n] < MAX) {
return dps[n];
}
ll n1 = dp(n - 1) + abs(h[n] - h[n - 1]);
ll n2 = MAX;
if (n > 1) {
... | replace | 4 | 5 | 4 | 5 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <class T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/// find_by_order()
/// order_of_key()
templa... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <class T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/// find_by_order()
/// order_of_key()
templa... | delete | 74 | 78 | 74 | 74 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int h[10005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i += 1)
cin >> h[i];
long long int dp[n + 1];
dp[1] = 0;
dp[2] = abs(h[2] - h[1]);
for (int i = 3; i <= n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs... | #include <bits/stdc++.h>
using namespace std;
int h[100005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i += 1)
cin >> h[i];
long long int dp[n + 1];
dp[1] = 0;
dp[2] = abs(h[2] - h[1]);
for (int i = 3; i <= n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + ab... | replace | 2 | 3 | 2 | 3 | 0 | |
p03160 | C++ | Runtime Error | //<============ Author --> @venom ============>//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fo(i, n) for (int i = 0; i < n; i++)
#define int long long
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#defin... | //<============ Author --> @venom ============>//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fo(i, n) for (int i = 0; i < n; i++)
#define int long long
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#defin... | replace | 55 | 56 | 55 | 56 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <fstream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> stones(n);
for (int i = 0; i < n; i++) {
cin >> stones[i];
}
vector<int> cost(10001, 1e9 + 5);
cost[0] = 0;
for (int i = 0; i < n; i++) {
for (int j : {i + 1, i + 2}) {
... | #include <bits/stdc++.h>
#include <fstream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> stones(n);
for (int i = 0; i < n; i++) {
cin >> stones[i];
}
vector<int> cost(n, INT_MAX);
cost[0] = 0;
for (int i = 0; i < n; i++) {
for (int j : {i + 1, i + 2}) {
... | replace | 11 | 12 | 11 | 12 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios::sync_with_stdio(false); \
cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x)) + 1
#define mod 1000000007
#define L_MAX 1e18... | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios::sync_with_stdio(false); \
cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x)) + 1
#define mod 1000000007
#define L_MAX 1e18... | replace | 59 | 62 | 59 | 68 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(pair<int, int> x, pair<int, int> y) {
return (abs(x.first - x.second) > abs(y.first - y.second));
}
int main(int argc, char **argv) {
#ifndef ONLINE_JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
i... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(pair<int, int> x, pair<int, int> y) {
return (abs(x.first - x.second) > abs(y.first - y.second));
}
int main(int argc, char **argv) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int h[n];
for (int i = 0; i <... | delete | 7 | 11 | 7 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
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... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
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... | replace | 25 | 27 | 25 | 27 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ll long long
#define P pair<int, int>
#define M map<int, int>
int n;
vector<int> h(10000);
vector<int> dp(10000);
int main() {
cin >> n;
rep(i, n) cin >> h.at(i);
dp.at(0) = 0;
dp.at(1) = abs(h[1] - h[0]... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ll long long
#define P pair<int, int>
#define M map<int, int>
int n;
vector<int> h(100000);
vector<int> dp(100000);
int main() {
cin >> n;
rep(i, n) cin >> h.at(i);
dp.at(0) = 0;
dp.at(1) = abs(h[1] - h[... | replace | 8 | 10 | 8 | 10 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <iostream>
#include <math.h>
#include <vector>
using namespace std;
#define MAX 1e9 + 7
int dp[100000] = {};
int h[100000] = {};
int n;
int dfs(int k) {
if (k < n - 2)
dp[k + 2] = min(dp[k + 2], abs(h[k] - h[k + 2]) + dp[k]);
if (k < n - 1)
dp[k + 1] = min(dp[k + 1], abs(h[k] - h[k + 1]) + dp[k]... | #include <iostream>
#include <math.h>
#include <vector>
using namespace std;
#define MAX 1e9 + 7
int dp[100000] = {};
int h[100000] = {};
int n;
int dfs(int k) {
if (k < n - 2)
dp[k + 2] = min(dp[k + 2], abs(h[k] - h[k + 2]) + dp[k]);
if (k < n - 1)
dp[k + 1] = min(dp[k + 1], abs(h[k] - h[k + 1]) + dp[k]... | delete | 16 | 18 | 16 | 16 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ... | replace | 24 | 26 | 24 | 26 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, l, r) for (int i = l; i <= r; i++)
vector<int> dp(100001, -1);
int fun(int n, int h[]) {
if (dp[n] != -1)
return dp[n];
if (n == 0) {
dp[0] = 0;
return 0;
}
if ... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, l, r) for (int i = l; i <= r; i++)
vector<int> dp(100001, -1);
int fun(int n, int h[]) {
if (dp[n] != -1)
return dp[n];
if (n == 0) {
dp[0] = 0;
return 0;
}
if ... | replace | 22 | 24 | 22 | 25 | TLE | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#define INF 2100000000
using namespace std;
int absint(int a) { return max(a, -a); }
int main() {
int n, h[10010], i, j;
int cost[10010];
cin >> n;
for (i = 1; i <= n; i++) {
cin >> h[i];
cost[i] = INF;
}
co... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#define INF 2100000000
using namespace std;
int absint(int a) { return max(a, -a); }
int main() {
int n, h[100010], i, j;
int cost[100010];
cin >> n;
for (i = 1; i <= n; i++) {
cin >> h[i];
cost[i] = INF;
}
... | replace | 9 | 11 | 9 | 11 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main() {
lli n, i;
lli dp[10001];
dp[0] = 0;
dp[1] = 0;
cin >> n;
lli a[n + 1];
for (i = 1; i <= n; i++) {
cin >> a[i];
}
dp[2] = abs(a[2] - a[1]);
for (i = 3; i <= n; i++) {
dp[i] =
min(abs(a[i] - a[i - 2]) ... | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main() {
lli n, i;
lli dp[100001];
dp[0] = 0;
dp[1] = 0;
cin >> n;
lli a[n + 1];
for (i = 1; i <= n; i++) {
cin >> a[i];
}
dp[2] = abs(a[2] - a[1]);
for (i = 3; i <= n; i++) {
dp[i] =
min(abs(a[i] - a[i - 2])... | replace | 5 | 6 | 5 | 6 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int MAX = 10010010;
ll h[100010];
ll dps[100010];
// n番目のジャンプ台まで到達するための最小コストを返す
ll dp(int n) {
if (n == 0) {
return 0;
}
if (dps[n] < MAX) {
return dps[n];
}
ll n1 = dp(n - 1) + abs(h[n] - h[n - 1]);
ll n2 = MAX;
if (n > 1) {
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX = 1LL << 60;
ll h[100010];
ll dps[100010];
// n番目のジャンプ台まで到達するための最小コストを返す
ll dp(int n) {
if (n == 0) {
return 0;
}
if (dps[n] < MAX) {
return dps[n];
}
ll n1 = dp(n - 1) + abs(h[n] - h[n - 1]);
ll n2 = MAX;
if (n > ... | replace | 4 | 5 | 4 | 5 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define int 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 x first
#define y second
#define sz(... | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define int 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 x first
#define y second
#define sz(... | delete | 69 | 73 | 69 | 69 | 0 | Time Taken : 0.002513
|
p03160 | C++ | Runtime Error | /************************************************************
/ AUTHOR : DEVANSHU SINGLA /
/ NICK : DSINGLA /
/ INSTITUTE : IITK /
************************************************************/
// ... | /************************************************************
/ AUTHOR : DEVANSHU SINGLA /
/ NICK : DSINGLA /
/ INSTITUTE : IITK /
************************************************************/
// ... | delete | 40 | 46 | 40 | 40 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("darb.in");
ofstream fout("darb.out");
int minCost[10001], v[10001];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> v[i];
minCost[1] = 0, minCost[2] = abs(v[2] - v[1]);
for (int i = 3; i <= n; i++)
m... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("darb.in");
ofstream fout("darb.out");
int minCost[100001], v[100001];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> v[i];
minCost[1] = 0, minCost[2] = abs(v[2] - v[1]);
for (int i = 3; i <= n; i++)
... | replace | 6 | 7 | 6 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> dp(10001, -1);
int main() {
int n;
cin >> n;
vector<int> h;
for (int i = 0; i < n; i++) {
int h1;
cin >> h1;
h.push_back(h1);
}
dp[0] = 0;
for (int i = 1; i < n; i++) {
if (i == 1)
dp[i] = abs(h[i - 1] - h[i]);
else
... | #include <bits/stdc++.h>
using namespace std;
vector<int> dp(100000001, -1);
int main() {
int n;
cin >> n;
vector<int> h;
for (int i = 0; i < n; i++) {
int h1;
cin >> h1;
h.push_back(h1);
}
dp[0] = 0;
for (int i = 1; i < n; i++) {
if (i == 1)
dp[i] = abs(h[i - 1] - h[i]);
else
... | replace | 2 | 3 | 2 | 3 | 0 | |
p03160 | C++ | Runtime Error | #include <cmath>
#include <iostream>
using namespace std;
int dp[10000] = {};
int main() {
int N;
cin >> N;
int h[N];
for (int i = 0; i < N; i++)
cin >> h[i];
for (int i = 1; i < N; i++) {
if (i == 1)
dp[1] = abs(h[1] - h[0]);
else
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
... | #include <cmath>
#include <iostream>
using namespace std;
int dp[100000] = {};
int main() {
int N;
cin >> N;
int h[N];
for (int i = 0; i < N; i++)
cin >> h[i];
for (int i = 1; i < N; i++) {
if (i == 1)
dp[1] = abs(h[1] - h[0]);
else
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
typedef long long int ll;
ll go(ll *h, ll n, ll index, ll *dp) {
... | #include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
typedef long long int ll;
ll go(ll *h, ll n, ll index, ll *dp) {
... | replace | 42 | 44 | 42 | 50 | TLE | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; i++)
#define why(n, x) \
int n; \
while (cin >> n, n != x)
#define iFOR(i, x, n) for (int i = x; i... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; i++)
#define why(n, x) \
int n; \
while (cin >> n, n != x)
#define iFOR(i, x, n) for (int i = x; i... | replace | 83 | 84 | 83 | 84 | TLE | |
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 vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define w(x) \
int x; ... | #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 vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define w(x) \
int x; ... | replace | 42 | 43 | 42 | 43 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int h[10001];
int dp[10001];
int main() {
int N;
cin >> N;
for (int i = 1; i <= N; ++i) {
cin >> h[i];
}
dp[1] = 0;
dp[2] = abs(h[2] - h[1]);
for (int i = 3; i <= N; ++i) {
dp[i] =
min(abs(h[i] - h[i - 1]) ... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int h[100001];
int dp[100001];
int main() {
int N;
cin >> N;
for (int i = 1; i <= N; ++i) {
cin >> h[i];
}
dp[1] = 0;
dp[2] = abs(h[2] - h[1]);
for (int i = 3; i <= N; ++i) {
dp[i] =
min(abs(h[i] - h[i - 1]... | replace | 5 | 7 | 5 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int h[10000];
for (long long int i = 0; i < n; i++)
cin >> h[i];
vector<long long int> dp(n);
dp[0] = 0;
for (long long int i = 1; i < n; i++) {
if (i - 2 < 0) {
dp[i] = abs(h[i] - h[i - 1]) + dp[... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int h[100000];
for (long long int i = 0; i < n; i++)
cin >> h[i];
vector<long long int> dp(n);
dp[0] = 0;
for (long long int i = 1; i < n; i++) {
if (i - 2 < 0) {
dp[i] = abs(h[i] - h[i - 1]) + dp... | replace | 5 | 6 | 5 | 6 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define endl ... | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define endl ... | replace | 11 | 12 | 11 | 12 | -11 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
vector<int> stones;
vector<int> costs;
int hops(int stone) {
if (stone < 1) {
return 0;
}
if (stone == 1) {
return abs(costs[stone] - costs[stone - 1]);
}
if (stones[stone] != -1) {
return stones[stone... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
vector<int> stones;
vector<int> costs;
int hops(int stone) {
if (stone < 1) {
return 0;
}
if (stone == 1) {
return abs(costs[stone] - costs[stone - 1]);
}
if (stones[stone] != -1) {
return stones[stone... | replace | 26 | 27 | 26 | 27 | -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;
#define LL long long
#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)
vector<LL> InputVec(LL size) {
vector<LL> vec((size_t)size);
REP(i, size) { cin >> vec[(size_t)... | #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)
vector<LL> InputVec(LL size) {
vector<LL> vec((size_t)size);
REP(i, size) { cin >> vec[(size_t)... | replace | 22 | 23 | 22 | 23 | TLE | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int n;
int dp[10010];
int height[10010];
int main() {
cin >> n;
dp[0] = 9999999;
for (int i = 1; i <= n; i++) {
dp[i] = 9999999;
int a;
c... | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int n;
int dp[100100];
int height[100100];
int main() {
cin >> n;
dp[0] = 9999999;
for (int i = 1; i <= n; i++) {
dp[i] = 9999999;
int a;
... | replace | 10 | 12 | 10 | 12 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> vec;
for (int i = 0; i < n; i++)
cin >> vec[i];
int dp[n + 1];
dp[0] = 0;
dp[1] = 0;
for (int j = 2; j <= n; j++) {
if (j > 2)
dp[j] = min(dp[j - 1] + abs(vec[j - 1] - vec[j - 2]),
dp... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> vec(n);
for (int i = 0; i < n; i++)
cin >> vec[i];
int dp[n + 1];
dp[0] = 0;
dp[1] = 0;
for (int j = 2; j <= n; j++) {
if (j > 2)
dp[j] = min(dp[j - 1] + abs(vec[j - 1] - vec[j - 2]),
... | replace | 5 | 6 | 5 | 6 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long int
using namespace std;
int ans1 = 0, ans2 = 0;
const int N = 1e4 + 5;
int arr[N];
int recur(int n) {
int dp[n];
dp[0] = 0;
for (int i = 1; i < n; i++) {
if (i == 1) {
dp[i] = abs(arr[0] - arr[1]);
}
else {
dp[i] = min(dp[i - 1] + abs(arr[i... | #include <bits/stdc++.h>
#define int long long int
using namespace std;
int ans1 = 0, ans2 = 0;
const int N = 1e5 + 5;
int arr[N];
int recur(int n) {
int dp[n];
dp[0] = 0;
for (int i = 1; i < n; i++) {
if (i == 1) {
dp[i] = abs(arr[0] - arr[1]);
}
else {
dp[i] = min(dp[i - 1] + abs(arr[i... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define mod 1000000007
#define pii pair<int, int>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define forn(i, s, e) for (int i = s; i <= e; i++)
#define fo... | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define mod 1000000007
#define pii pair<int, int>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define forn(i, s, e) for (int i = s; i <= e; i++)
#define fo... | replace | 71 | 72 | 71 | 72 | -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;
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], dp[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
dp[i] = I... | #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], dp[n];
for (int i = 0; i < n; i++) {
cin >> a[i... | replace | 8 | 12 | 8 | 12 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
ll mod = 1e9 + 7;
ll a[200005];
ll b[200005];
ll idx[100005][2];
// ll cnt[200005];
ll pre[200005];
// ll end[200005];
m... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
ll mod = 1e9 + 7;
ll a[200005];
ll b[200005];
ll idx[100005][2];
// ll cnt[200005];
ll pre[200005];
// ll end[200005];
m... | replace | 80 | 83 | 80 | 81 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for (int i = x; i < n; ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repr(i, n) for (int i = n - 1; i >= 0; --i)
#define SORT(x) sort((x).begin(), (x).e... | #include <bits/stdc++.h>
using namespace std;
#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for (int i = x; i < n; ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repr(i, n) for (int i = n - 1; i >= 0; --i)
#define SORT(x) sort((x).begin(), (x).e... | replace | 33 | 35 | 33 | 35 | TLE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.