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 | // by rko27
// One more....
//---------------------------------------------------------------------------------------------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ll long long
#define pb push_back
#define mp ma... | // by rko27
// One more....
//---------------------------------------------------------------------------------------------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ll long long
#define pb push_back
#define mp ma... | replace | 52 | 56 | 52 | 56 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
#include <utility>
using namespace std;
typedef long long ll;
ll dp[1000];
ll arr[1000];
int n = 0;
ll dpfun(int i) {
if (dp[i] != -1)
return dp[i];
if (i == n - 1)
return dp[i] = 0;
if (i == n - 2)
return dp[i] = abs(a... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
#include <utility>
using namespace std;
typedef long long ll;
ll dp[100005];
ll arr[100005];
int n = 0;
ll dpfun(int i) {
if (dp[i] != -1)
return dp[i];
if (i == n - 1)
return dp[i] = 0;
if (i == n - 2)
return dp[i] = a... | replace | 9 | 11 | 9 | 11 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main(void) {
int N;
cin >> N;
ll h[N];
ll dp[N];
for (int i = 1; i <= N; i++) {
cin >> h[i];
}... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main(void) {
int N;
cin >> N;
ll h[100010];
ll dp[100010];
for (int i = 1; i <= N; i++) {
cin >>... | replace | 17 | 19 | 17 | 19 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int dp[10010];
int m... | #include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int dp[100100];
int ... | replace | 16 | 17 | 16 | 17 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
// i番目に到達するために必要なコストの最小値をdp[i]とする。
int dp[10010];
// dpテーブルの初期化
dp[0] = 0;
dp[1] = 0;
dp[2] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
// i番目に到達するために必要なコストの最小値をdp[i]とする。
int dp[n];
// dpテーブルの初期化
dp[0] = 0;
dp[1] = 0;
dp[2] = abs(h[1] - h[0]);
for (int i = 2; i < n; i++) {
dp[i + 1]... | replace | 12 | 13 | 12 | 13 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ff first
#define ss second
#define int long long int
#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_queu... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ff first
#define ss second
#define int long long int
#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_queu... | delete | 37 | 41 | 37 | 37 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long
int n, x, dp[10001];
vector<int> a;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n && cin >> x; i++)
a.push_back(x);
dp[1] = abs(a[1] - a[0]);
for (i... | #include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long
int n, x, dp[100001];
vector<int> a;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n && cin >> x; i++)
a.push_back(x);
dp[1] = abs(a[1] - a[0]);
for (... | replace | 5 | 6 | 5 | 6 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for... | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for... | replace | 36 | 37 | 36 | 37 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <cstdlib>
#include <vector>
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;
}
return 0;
}
const long long IN... | #include <bits/stdc++.h>
#include <cstdlib>
#include <vector>
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;
}
return 0;
}
const long long IN... | replace | 22 | 23 | 22 | 23 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0);
int main() {
IOS;
int n;
cin >> n;
int dp[n];
vector<int> H;
memset(dp, 0, sizeof(dp));
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
H.push_back(temp);
}
bool change = true;
for (int i ... | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0);
int main() {
IOS;
int n;
cin >> n;
int dp[n];
vector<int> H;
memset(dp, 0, sizeof(dp));
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
H.push_back(temp);
}
bool change = true;
dp[1] = abs... | replace | 16 | 38 | 16 | 46 | TLE | |
p03160 | C++ | Runtime Error | // *
// *
// * Created By :hozaifa wahid
// * "mai maut ko takia aur kafan ko chadar banakar sota hu"
// *------------------------------------
// * OS : Ubuntu 16.04
// * Language : CPP14
// * Editor : Sublime Text 3
// * C++ compiler : g++
// *
// *
// https://www.geeksforgeeks.org/find-the-point-where-maximum-in... | // *
// *
// * Created By :hozaifa wahid
// * "mai maut ko takia aur kafan ko chadar banakar sota hu"
// *------------------------------------
// * OS : Ubuntu 16.04
// * Language : CPP14
// * Editor : Sublime Text 3
// * C++ compiler : g++
// *
// *
// https://www.geeksforgeeks.org/find-the-point-where-maximum-in... | replace | 107 | 109 | 107 | 109 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(V) V.begin(), V.end()
#define see(x) cerr << #x << " = " << x << "\n";
#define Unique(V) sort(all(V)), V.erase(unique(all(V)), V.end())
typedef long long int LL;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const d... | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(V) V.begin(), V.end()
#define see(x) cerr << #x << " = " << x << "\n";
#define Unique(V) sort(all(V)), V.erase(unique(all(V)), V.end())
typedef long long int LL;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const d... | replace | 13 | 14 | 13 | 14 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int h[N];
int dp[N];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
dp[n - 1] = 0;
dp[n - 2] = abs(h[n - 1] - h[n - 2]);
for (int i = n - 3; i >= 0; i++)
dp[i] =
min(dp[i + 1] + abs(h[i] - h[i + 1... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int h[N];
int dp[N];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
dp[n - 1] = 0;
dp[n - 2] = abs(h[n - 1] - h[n - 2]);
for (int i = n - 3; i >= 0; i--)
dp[i] =
min(dp[i + 1] + abs(h[i] - h[i + 1... | replace | 13 | 14 | 13 | 14 | -11 | |
p03160 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
int n, h[5000], dp[5000];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[... | #include "bits/stdc++.h"
using namespace std;
int n, h[10000000], dp[10000000];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (int i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <typename T> T load() {
T r;
cin >> r;
return r;
}
template <typename T> vector<T> loadMany(int n) {
vector<T> rs(n);
generate(rs.begin(), rs.end(), &load<T>);
return rs;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
while (true)... | #include <bits/stdc++.h>
using namespace std;
template <typename T> T load() {
T r;
cin >> r;
return r;
}
template <typename T> vector<T> loadMany(int n) {
vector<T> rs(n);
generate(rs.begin(), rs.end(), &load<T>);
return rs;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
auto n = loa... | delete | 17 | 19 | 17 | 17 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define endl "\n"
#define mod 1000000007
#define INF 1e18
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define IOS ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define endl "\n"
#define mod 1000000007
#define INF 1e18
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define IOS ... | replace | 67 | 68 | 67 | 68 | 0 | |
p03160 | C++ | Runtime Error | // 98tarunkumar
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define lop(i, n) for (int i = 0; i < n; i++)
#define rlop(i, n) for (int i = n; i > 0; i--)
#define lli long long int
#define MOD 1000000007
#define f(i, a, b) for (i = a; i < b; i++)
#define ainp(a, n) ... | // 98tarunkumar
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define lop(i, n) for (int i = 0; i < n; i++)
#define rlop(i, n) for (int i = n; i > 0; i--)
#define lli long long int
#define MOD 1000000007
#define f(i, a, b) for (i = a; i < b; i++)
#define ainp(a, n) ... | replace | 26 | 30 | 26 | 30 | 0 | |
p03160 | C++ | Time Limit Exceeded | // i_am_arin
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<string> vs;
#define f(i, a, n) for (ll i = a; i < (ll)n; i++)
#define f2(i, a, b) for (ll i = a; i <= (ll)b; i++)
#define PB push_back... | // i_am_arin
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<string> vs;
#define f(i, a, n) for (ll i = a; i < (ll)n; i++)
#define f2(i, a, b) for (ll i = a; i <= (ll)b; i++)
#define PB push_back... | replace | 31 | 32 | 31 | 33 | TLE | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
const int MAX_T = 10100;
const long long INF = 1LL << 60;
template <class T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <class T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
int main() {
int N;
cin >> N;
long long h[MAX_T];
... | #include <algorithm>
#include <iostream>
using namespace std;
const int MAX_T = 100100;
const long long INF = 1LL << 60;
template <class T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <class T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
int main() {
int N;
cin >> N;
long long h[MAX_T];
... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Time Limit Exceeded | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#includ... | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#includ... | replace | 212 | 213 | 212 | 213 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define tam 10001
int dp[tam], A[tam], n;
int solver(int index) {
if (dp[index] != -1)
return dp[index];
if (index <= 1)
return dp[index] = abs(A[0] - A[index]);
return dp[index] = min(solver(index - 1) + abs(A[index] - A[index - 1]),
... | #include <bits/stdc++.h>
using namespace std;
#define tam 100001
int dp[tam], A[tam], n, pr = 0;
int solver(int index) {
if (dp[index] != -1)
return dp[index];
if (index <= 1)
return dp[index] = abs(A[0] - A[index]);
return dp[index] = min(solver(index - 1) + abs(A[index] - A[index - 1]),
... | replace | 3 | 5 | 3 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, i;
cin >> N;
int *h = new int(N);
int *d = new int(N);
for (i = 0; i < N; i++)
cin >> h[i];
d[0] = 0;
d[1] = abs(h[1] - h[0]);
for (i = 2; i < N; i++)
d[i] =
min(d[i - 1] + abs(h[i] - h[i - 1]), d[i - 2] + abs(h[i] - h[... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, i;
cin >> N;
int h[100000];
int d[100000];
for (i = 0; i < N; i++)
cin >> h[i];
d[0] = 0;
d[1] = abs(h[1] - h[0]);
for (i = 2; i < N; i++)
d[i] =
min(d[i - 1] + abs(h[i] - h[i - 1]), d[i - 2] + abs(h[i] - h[i - 2]));
... | replace | 6 | 8 | 6 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS \
; \
ios::sync_with_stdio(0); \
cin.tie... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS \
; \
ios::sync_with_stdio(0); \
cin.tie... | replace | 8 | 9 | 8 | 9 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fast \
ios::sync_with_stdio(NULL); \
cin.tie(0); \
cout.tie(0);
#define make_pair mp
#define pb push_... | #include <bits/stdc++.h>
#define fast \
ios::sync_with_stdio(NULL); \
cin.tie(0); \
cout.tie(0);
#define make_pair mp
#define pb push_... | replace | 22 | 26 | 22 | 26 | -11 | |
p03160 | C++ | Runtime Error | // https://cs.stackexchange.com/questions/84426/find-a-node-with-maximum-distance-from-given-node-in-a-tree
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including
// tree_order_statistics_node_update using namespace __gnu_pbds; #include
/... | // https://cs.stackexchange.com/questions/84426/find-a-node-with-maximum-distance-from-given-node-in-a-tree
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including
// tree_order_statistics_node_update using namespace __gnu_pbds; #include
/... | replace | 54 | 59 | 54 | 55 | -11 | |
p03160 | C++ | Runtime Error | /******************************************
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fin for (int i = 1; i <= n; i++)
#define fiab for (int i = a; i < b; i++)
#define fi1b for (int i =... | /******************************************
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fin for (int i = 1; i <= n; i++)
#define fiab for (int i = a; i < b; i++)
#define fi1b for (int i =... | delete | 43 | 52 | 43 | 43 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repA(i, a, n) for (int i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb p... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repA(i, a, n) for (int i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb p... | replace | 24 | 28 | 24 | 28 | -6 | terminate called after throwing an instance of 'std::__ios_failure'
what(): basic_ios::clear: iostream error
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie... | replace | 55 | 59 | 55 | 56 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <iostream>
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
const int MAXN = 1e5 + 7;
template <typename T> inline T read() {
T res = 0, flag = 1;
char in =... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <iostream>
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
const int MAXN = 1e5 + 7;
template <typename T> inline T read() {
T res = 0, flag = 1;
char in =... | delete | 56 | 60 | 56 | 56 | TLE | |
p03160 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
const int INF = 1e9 + 5;
int main() {
int n;
int h[10010];
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j <= i + 2; j++) {
if (j < ... | #include <iostream>
#include <vector>
using namespace std;
const int INF = 1e9 + 5;
int main() {
int n;
int h[100010];
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j <= i + 2; j++) {
if (j <... | replace | 9 | 10 | 9 | 10 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int dp[10005];
int h[10005];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (int i = 2; i <= n; i++) {
dp[i] =
min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) +... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int dp[100005];
int h[100005];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (int i = 2; i <= n; i++) {
dp[i] =
min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2])... | replace | 4 | 6 | 4 | 6 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
int a[n];
int dp[n];
for (int i = 0; i < n; i++)
cin >> a[i];
dp[0] = 0;
dp[1] = abs(a[1] - a[0]);
for (int i... | #include <bits/stdc++.h>
using namespace std;
int main() {
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
int a[n];
int dp[n];
for (int i = 0; i < n; i++)
cin >> a[i];
dp[0] = 0;
dp[1] = abs(a[1] - a[0]);
for (int... | replace | 5 | 7 | 5 | 7 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define INF (int)(1e9)
// The recurrence we will be optimizing is
// c(n) = min(c(n - 1) + cost(n, n - 1),
// c(n - 2) + cost(n, n - 2))
// h[i] is the "value" of stone i
// cost(i, j) = abs(h[i] - h[j])
// I think this way is more natural
int solve_backward... | #include <bits/stdc++.h>
using namespace std;
#define INF (int)(1e9)
// The recurrence we will be optimizing is
// c(n) = min(c(n - 1) + cost(n, n - 1),
// c(n - 2) + cost(n, n - 2))
// h[i] is the "value" of stone i
// cost(i, j) = abs(h[i] - h[j])
// I think this way is more natural
int solve_backward... | replace | 51 | 53 | 51 | 53 | TLE | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using ll = long long;
#define... | #include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using ll = long long;
#define... | replace | 44 | 46 | 44 | 46 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int num_stones;
vector<int> height(10000);
vector<int> cost(10000);
cin >> num_stones;
for (int i = 0; i < num_stones; i++)
cin >> height[i];
cost[0] = 0;
cost[1] = abs(height[1] - height[0]);
for (int i = 2; i < num_stones; i++) {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int num_stones;
vector<int> height(1000000);
vector<int> cost(1000000);
cin >> num_stones;
for (int i = 0; i < num_stones; i++)
cin >> height[i];
cost[0] = 0;
cost[1] = abs(height[1] - height[0]);
for (int i = 2; i < num_stones; i++) {
... | replace | 6 | 8 | 6 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> ht(n, 0);
for (int i = 0; i < n; ++i) {
cin >> ht[i];
}
std::vector<int> cost(n);
cost[0] = 0;
cost[1] = abs(ht[0] - ht[1]);
for (int i = 2; i < n; ++i) {
cost[i] = min(abs(ht[i] - ht[i - 2]) + cost[i - 2... | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> ht(n, 0);
for (int i = 0; i < n; ++i) {
cin >> ht[i];
}
std::vector<int> cost(n);
cost[0] = 0;
cost[1] = abs(ht[0] - ht[1]);
for (int i = 2; i < n; ++i) {
cost[i] = min(abs(ht[i] - ht[i - 2]) + cost[i - 2... | delete | 20 | 24 | 20 | 20 | 0 | |
p03160 | C++ | Runtime Error | // JAI SHREE RAM
typedef long long int ll;
typedef unsigned long long int ull;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define FOR(i, n) for (int i = 0; i < n; i++)
#define MOD 1000... | // JAI SHREE RAM
typedef long long int ll;
typedef unsigned long long int ull;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define FOR(i, n) for (int i = 0; i < n; i++)
#define MOD 1000... | replace | 45 | 49 | 45 | 46 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int maxn = 20010;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x... | replace | 2 | 3 | 2 | 3 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define REP(i, n) for (lint i{}, i##_len = (n); i < i##_len; ++i)
#define DOUBLE_LOOP(i, h, j, w) ... | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define REP(i, n) for (lint i{}, i##_len = (n); i < i##_len; ++i)
#define DOUBLE_LOOP(i, h, j, w) ... | insert | 50 | 50 | 50 | 51 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#if __has_include("print.hpp")
#include "print.hpp"
#endif
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> p;
vector<int> dp(10, 0);
vector<int> v;
int n;
void dfs() {
for (int i = 2; i < n;... | #include <bits/stdc++.h>
using namespace std;
#if __has_include("print.hpp")
#include "print.hpp"
#endif
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> p;
vector<int> dp(100500, 0);
vector<int> v;
int n;
void dfs() {
for (int i = 2; i ... | replace | 13 | 14 | 13 | 14 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize "03"
#pragma GCC target("sse4")
#define ll long long int
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); ... | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize "03"
#pragma GCC target("sse4")
#define ll long long int
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); ... | replace | 45 | 46 | 45 | 46 | 0 | Time elapsed : 36.11ms
|
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <utility>
#define ll long long
#define fr first
#define sd second
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
Node(int x) {
data = x;
left = NULL;
right = NULL;
}
};
#define Node struct Node
int dp[100005];
int calc(int ... | #include <bits/stdc++.h>
#include <utility>
#define ll long long
#define fr first
#define sd second
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
Node(int x) {
data = x;
left = NULL;
right = NULL;
}
};
#define Node struct Node
int dp[100005];
int calc(int ... | replace | 27 | 29 | 27 | 31 | TLE | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#define INF 1000000000000
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n... | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#define INF 1000000000000
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n... | replace | 19 | 20 | 19 | 20 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n), dp(n);
for (int i = 0; i < n; i++)
cin >> v[i];
dp[0] = 0;
for (int i = 1; i <= n; i++)
dp[i] = INT_MAX;
for (int i = 0; i < n; i++) {
if (i + 1 < n)
dp[i + 1] = min(dp[i + 1], dp[i] + ab... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n), dp(n + 1);
for (int i = 0; i < n; i++)
cin >> v[i];
dp[0] = 0;
for (int i = 1; i <= n; i++)
dp[i] = INT_MAX;
for (int i = 0; i < n; i++) {
if (i + 1 < n)
dp[i + 1] = min(dp[i + 1], dp[i] ... | replace | 8 | 9 | 8 | 9 | 0 | |
p03160 | C++ | Runtime Error | #include <iostream>
#define int long long
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
// const int MOD = 10e9+7;
const int INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
retur... | #include <iostream>
#define int long long
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
// const int MOD = 10e9+7;
const int INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
retur... | replace | 27 | 28 | 27 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <cstdio>
int h[10010];
int ans[10010];
int cost(int a, int b) {
int ret = a - b;
return ret >= 0 ? ret : -ret;
}
int min(int a, int b) { return a < b ? a : b; }
int main() {
int n;
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
ans[2] = cost(h[1]... | #include <cstdio>
int h[100100];
int ans[100100];
int cost(int a, int b) {
int ret = a - b;
return ret >= 0 ? ret : -ret;
}
int min(int a, int b) { return a < b ? a : b; }
int main() {
int n;
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
ans[2] = cost(h[... | replace | 1 | 3 | 1 | 3 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> h(N);
for (int i = 0; i < N; i++)
cin >> h[i];
static int dp[1000000000];
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (int i = 2; i < N; i++) {
dp[i] =
min(dp[i - 2]... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> h(N);
for (int i = 0; i < N; i++)
cin >> h[i];
int dp[1000000];
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (int i = 2; i < N; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i... | replace | 13 | 14 | 13 | 14 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define M_DEBUG if (1)
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; -... | #include <bits/stdc++.h>
using namespace std;
#define M_DEBUG if (1)
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; -... | replace | 38 | 39 | 38 | 39 | 0 | |
p03160 | C++ | Runtime Error | /*
███╗ ███╗ █████╗ ███████╗███╗ ███╗ ██████╗ ██╗
██╗██████╗ ███████╗ █████╗ ███╗ ███╗██████╗ ██╗ ██╗ ████╗
████║██╔══██╗╚════██║████╗ ████║██╔═══██╗██║ ██║██╔══██╗╚════██║██╔══██╗████╗
████║██╔══██╗╚██╗ ██╔╝ ██╔████╔██║███████║ ██╔╝██╔████╔██║██║ ██║██║
██║██║ ██║ █... | /*
███╗ ███╗ █████╗ ███████╗███╗ ███╗ ██████╗ ██╗
██╗██████╗ ███████╗ █████╗ ███╗ ███╗██████╗ ██╗ ██╗ ████╗
████║██╔══██╗╚════██║████╗ ████║██╔═══██╗██║ ██║██╔══██╗╚════██║██╔══██╗████╗
████║██╔══██╗╚██╗ ██╔╝ ██╔████╔██║███████║ ██╔╝██╔████╔██║██║ ██║██║
██║██║ ██║ █... | replace | 71 | 72 | 71 | 72 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define watchArray(v) \
for (auto i : v) \
cout << i << " "; ... | #include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define watchArray(v) \
for (auto i : v) \
cout << i << " "; ... | replace | 24 | 28 | 24 | 28 | -11 | |
p03160 | C++ | Runtime Error | // 1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC
// of solution)_5.decide method_6.dry run_ 7.code_8.test_9.submit
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define _READ freopen("input.txt", "r", stdin... | // 1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC
// of solution)_5.decide method_6.dry run_ 7.code_8.test_9.submit
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define _READ freopen("input.txt", "r", stdin... | replace | 16 | 19 | 16 | 17 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | // #include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int dp[n];
dp[0] = 0;
dp[1] = abs(arr[0] - arr[1]);
for (int i = 2; i < n; i++) {
dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]),
... | // #include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int dp[n];
dp[0] = 0;
dp[1] = abs(arr[0] - arr[1]);
for (int i = 2; i < n; i++) {
dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]),
... | replace | 16 | 18 | 16 | 19 | 30 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#define loopi(x, y) for (int i = x; i < (y); i++)
#define loopj(x, y) for (int j = x; j < (y); j++)
#define newline cout << "\n";
#define ll long long int
using names... | #include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#define loopi(x, y) for (int i = x; i < (y); i++)
#define loopj(x, y) for (int j = x; j < (y); j++)
#define newline cout << "\n";
#define ll long long int
using names... | replace | 44 | 48 | 44 | 48 | -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 ll;
typedef vector<int> vec;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> par;
typedef vector<par> vpar;
#define forn(i, n) for (ll i = 0; i < n; i++)
#define wez(n) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> par;
typedef vector<par> vpar;
#define forn(i, n) for (ll i = 0; i < n; i++)
#define wez(n) ... | replace | 24 | 28 | 24 | 28 | -11 | |
p03160 | C++ | Runtime Error | /********************************************/ /**
****** Author: Shivam Kejriwal
******************
****** Handle: techno_phyle
... | /********************************************/ /**
****** Author: Shivam Kejriwal
******************
****** Handle: techno_phyle
... | replace | 45 | 49 | 45 | 49 | 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
#define pb push_back
#define fi first
#define fastio \
ios_base::sync_with_stdio(... | #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
#define pb push_back
#define fi first
#define fastio \
ios_base::sync_with_stdio(... | replace | 168 | 172 | 168 | 172 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long n, arr[100005], dp[100005];
long long f(long long a) {
if (a > n)
return 1e18;
if (a == n)
return 0;
if (dp[a] != -1)
return dp[a];
return min(abs(arr[a + 1] - arr[a]) + f(a + 1),
abs(arr[a + 2] - arr[a] + f(a + 2)));
}
int main() ... | #include <bits/stdc++.h>
using namespace std;
long long n, arr[100005], dp[100005];
long long f(long long a) {
if (a > n)
return 1e18;
if (a == n)
return 0;
if (dp[a] != -1)
return dp[a];
return dp[a] = min(abs(arr[a + 1] - arr[a]) + f(a + 1),
abs(arr[a + 2] - arr[a]) + f(a + 2)... | replace | 10 | 12 | 10 | 12 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int h[10010];
int a[100100];
int dp[100100];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
a[0] = 0;
for (int i = 1; i < n; i++)
a[i] = h[i] - h[i - 1];
dp[1] = abs(a[1]);
for (int i = 0; i + 2 < n; i++)
dp[i + 2] =
... | #include <bits/stdc++.h>
using namespace std;
int h[100100];
int a[100100];
int dp[100100];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
a[0] = 0;
for (int i = 1; i < n; i++)
a[i] = h[i] - h[i - 1];
dp[1] = abs(a[1]);
for (int i = 0; i + 2 < n; i++)
dp[i + 2] =
... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define max1 1000005
#define siz 100000
#define mod 998244353
#define inf 1e18 + 5
#define ll long long int
#define debug(x) cout << #x << " " << x << endl
#define jam(x) cout << "Case #" << x << ": "
typedef pair<ll, ll> pr;
int main() {
ios_base::sync_with_stdio(false);... | #include <bits/stdc++.h>
using namespace std;
#define max1 1000005
#define siz 100000
#define mod 998244353
#define inf 1e18 + 5
#define ll long long int
#define debug(x) cout << #x << " " << x << endl
#define jam(x) cout << "Case #" << x << ": "
typedef pair<ll, ll> pr;
int main() {
ios_base::sync_with_stdio(false);... | replace | 14 | 18 | 14 | 18 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
// 💖 Hi, thanks for using ICIE! 💖
// 🔧 To use a custom code template, press Ctrl+Shift+P and select "ICIE Template
// configure" from the list 🔧 📝 If you spot any bugs or miss any features,
// create an issue at https://github.com/pustaczek/icie/issues 📝
int main() ... | #include <bits/stdc++.h>
using namespace std;
// 💖 Hi, thanks for using ICIE! 💖
// 🔧 To use a custom code template, press Ctrl+Shift+P and select "ICIE Template
// configure" from the list 🔧 📝 If you spot any bugs or miss any features,
// create an issue at https://github.com/pustaczek/icie/issues 📝
int main() ... | replace | 12 | 13 | 12 | 13 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int dp[101000];
int main() {
int n;
scanf("%d", &n);
vector<int> a(1 << n);
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
}
memset(dp, 0, sizeof dp);
dp[0] = 0;
for (int i = 1; i < n; ++i) {
int op1 = INT_MAX, op2 = INT_MAX;
if (i >= 1) {... | #include <bits/stdc++.h>
using namespace std;
int dp[101000];
int main() {
int n;
scanf("%d", &n);
vector<int> a(n);
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
}
memset(dp, 0, sizeof dp);
dp[0] = 0;
for (int i = 1; i < n; ++i) {
int op1 = INT_MAX, op2 = INT_MAX;
if (i >= 1) {
... | replace | 9 | 10 | 9 | 10 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <queue>
#include <vector>
// #include <map>
#include <cmath>
#include <cstring>
#include <iomanip>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int, int>... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <queue>
#include <vector>
// #include <map>
#include <cmath>
#include <cstring>
#include <iomanip>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int, int>... | replace | 22 | 23 | 22 | 23 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define p(V) \
for (int iiv = 0; iiv < V.size(); iiv++) \
cout << V[iiv] << " ";
#define mp make_pair
#define pb push_back
#define graph v... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define p(V) \
for (int iiv = 0; iiv < V.size(); iiv++) \
cout << V[iiv] << " ";
#define mp make_pair
#define pb push_back
#define graph v... | delete | 21 | 25 | 21 | 21 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define endl '\n'
#define ll long long
#define int long long
const int32_t INFint = 1e9;
const ll INFll = 1e18;
#define MOD 1000000007ll
#define fast \
ios_base::sync_with_stdio(0... | #include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define endl '\n'
#define ll long long
#define int long long
const int32_t INFint = 1e9;
const ll INFll = 1e18;
#define MOD 1000000007ll
#define fast \
ios_base::sync_with_stdio(0... | delete | 63 | 67 | 63 | 63 | -11 | |
p03160 | C++ | Runtime Error | //***********************
// Author:kibi11
// Quarantine Days
//***********************
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fr(i, n) for (int i = 0; i < n; i++)
#define fr1(i, a, b) for (int i = a; i < b; i++)
#define frr(... | //***********************
// Author:kibi11
// Quarantine Days
//***********************
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fr(i, n) for (int i = 0; i < n; i++)
#define fr1(i, a, b) for (int i = a; i < b; i++)
#define frr(... | replace | 84 | 89 | 84 | 89 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
signed main() {
#ifndef ONLINE_JUDGE
freopen("solve.in", "r", stdin);
freopen("solve.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int h[N], dp[N];
for (int i =... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int h[N], dp[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;... | delete | 8 | 12 | 8 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<lli, lli> pll;
typedef std::vector<lli> vll;
typedef std::vector<pll> vpll;
typedef std::vector<bool> vbb;
typedef map<lli, lli> mll;
typedef set<lli> sll;
typedef multiset<l... | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<lli, lli> pll;
typedef std::vector<lli> vll;
typedef std::vector<pll> vpll;
typedef std::vector<bool> vbb;
typedef map<lli, lli> mll;
typedef set<lli> sll;
typedef multiset<l... | replace | 169 | 173 | 169 | 173 | -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 main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
vector<int> h(n);
vector<long long> dp(n, 1e18);
for (int i = 0; i < n; ++i) {
cin >> h[i];
}
dp[0] = 0;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j <= i +... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
vector<int> h(n);
vector<long long> dp(n, 1e18);
for (int i = 0; i < n; ++i) {
cin >> h[i];
}
dp[0] = 0;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j <= i +... | replace | 18 | 19 | 18 | 19 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> h(N), dp(1010);
for (int i = 0; i < N; i++)
cin >> h[i];
for (int i = 0; i < N; i++)
dp[i] = INT_MAX;
dp[0] = 0;
for (int i = 0; i < N; i++) {
if (dp[i + 1] > dp[i] + abs(h[i] - h[i + 1]))
dp[i + 1] ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> h(N), dp(100010);
for (int i = 0; i < N; i++)
cin >> h[i];
for (int i = 0; i < N; i++)
dp[i] = INT_MAX;
dp[0] = 0;
for (int i = 0; i < N; i++) {
if (dp[i + 1] > dp[i] + abs(h[i] - h[i + 1]))
dp[i + 1... | replace | 6 | 7 | 6 | 7 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#define lli long long int
using namespace std;
lli cache[100005];
lli getmin(vector<int> h, int i, int n) {
if (i == n - 1) {
return 0;
}
if (cache[i] != -1) {
return cache[i];
}
lli r1 = INT_MAX, r2 = INT_MAX;
if ((i + 1) <= (n - 1)... | #include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#define lli long long int
using namespace std;
lli cache[100005];
lli getmin(vector<int> &h, int i, int n) {
if (i == n - 1) {
return 0;
}
if (cache[i] != -1) {
return cache[i];
}
lli r1 = INT_MAX, r2 = INT_MAX;
if ((i + 1) <= (n - 1... | replace | 7 | 8 | 7 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define z 500000000000000000
#define sh 500000
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define z 500000000000000000
#define sh 500000
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, i;
cin >> n;
int ar[n + 1];
for (i = 1; i <= n; i++)
cin >> ar[i];
int dp[n + 1];
dp[1... | delete | 9 | 13 | 9 | 9 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define whole(v) begin(v), end(v)
#define print(c, n) \
for (int i = 0; i < n; i++) ... | #include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define whole(v) begin(v), end(v)
#define print(c, n) \
for (int i = 0; i < n; i++) ... | replace | 14 | 18 | 14 | 15 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef uint64_t u64;
typedef int64_t s64;
ty... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef uint64_t u64;
typedef int64_t s64;
ty... | replace | 36 | 37 | 36 | 37 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
#define ll long long
#define fr first
#define se second
#define fi(i, s, e, inc) for (auto i = s; i < e; i += inc)
#define fie(i, s, e, inc) for (auto i = s; i <= e; i += inc)
#define fd(i, s, e, dec) for (auto i = s; i > e; i -= dec)
#define fd... | #include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
#define ll long long
#define fr first
#define se second
#define fi(i, s, e, inc) for (auto i = s; i < e; i += inc)
#define fie(i, s, e, inc) for (auto i = s; i <= e; i += inc)
#define fd(i, s, e, dec) for (auto i = s; i > e; i -= dec)
#define fd... | delete | 49 | 53 | 49 | 49 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
using namespace std;
typedef long long ll;
int n;
ll h[100005];
ll memo[100005];
ll dp(int i) {
if (i == n - 1)
return 0;
if (i >= n)
return 10000000000;
if (memo[i] != -1) {
return memo[i];
}
return memo[i] = min(... | #include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
using namespace std;
typedef long long ll;
int n;
ll h[100005];
ll memo[100005];
ll dp(int i) {
if (i == n - 1)
return 0;
if (i >= n)
return 10000000000;
if (memo[i] != -1) {
return memo[i];
}
return memo[i] = min(... | delete | 28 | 35 | 28 | 28 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int h[11000] = {}, dp[11000] = {};
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] = (abs(h[i] - h[i - 1]) + dp[i - ... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int h[110000] = {}, dp[110000] = {};
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] = (abs(h[i] - h[i - 1]) + dp[i ... | replace | 8 | 9 | 8 | 9 | 0 | |
p03160 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define show(x) cout << #x << " " << x << " ";
#define f(i, j, k) for (int i = j; i <= k; i++)
#define fr(i, j, k) for (int i = j; i >= k; i--)
#define ll long long
#define all(A) A.begin(), A.end()
#define FIO ... | #include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define show(x) cout << #x << " " << x << " ";
#define f(i, j, k) for (int i = j; i <= k; i++)
#define fr(i, j, k) for (int i = j; i >= k; i--)
#define ll long long
#define all(A) A.begin(), A.end()
#define FIO ... | replace | 12 | 13 | 12 | 13 | 0 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#inc... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#inc... | replace | 74 | 75 | 74 | 75 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()
const long long INF ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()
const long long INF ... | replace | 38 | 39 | 38 | 39 | 0 | |
p03160 | C++ | Time Limit Exceeded | /*author* Priyanshu Shrivastav (from IIT Palakkad) *
* *_ __ ___ _ ______ ___ _ ____ ___ ___| |_ *
* | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
* | | | | | | | | (_| (_) | | | \ V /| | (__| |_ *
* |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
When I wrote this, only God and I understood what I was... | /*author* Priyanshu Shrivastav (from IIT Palakkad) *
* *_ __ ___ _ ______ ___ _ ____ ___ ___| |_ *
* | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
* | | | | | | | | (_| (_) | | | \ V /| | (__| |_ *
* |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
When I wrote this, only God and I understood what I was... | replace | 28 | 29 | 28 | 29 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define w(t) \
ll t; \
cin >> t; \
whil... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define w(t) \
ll t; \
cin >> t; \
whil... | replace | 16 | 17 | 16 | 17 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_... | #include <bits/stdc++.h>
#define int long long
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_... | replace | 30 | 31 | 30 | 31 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
#define all(a) a.begin(), a.end()
#define ll long long int
#define ld long double
ll power(ll a, ll b, ll m) {
if (b == 0)
r... | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
#define all(a) a.begin(), a.end()
#define ll long long int
#define ld long double
ll power(ll a, ll b, ll m) {
if (b == 0)
r... | insert | 35 | 35 | 35 | 38 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ROCK \
ios_base::sync_with_stdio(0); \
cin.tie(0); ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ROCK \
ios_base::sync_with_stdio(0); \
cin.tie(0); ... | replace | 16 | 18 | 16 | 18 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int *a;
int dp[40001];
int n;
int f(int x) {
if (x == n + 1)
return 0;
else {
dp[x] =
min(dp[x - 2] + abs(a[x - 2] - a[x]), dp[x - 1] + abs(a[x - 1] - a[x]));
return f(x + 1);
}
}
int main() {
cin >> n;
a = new int[n + 1];
for (int i = 1; i <... | #include <bits/stdc++.h>
using namespace std;
int *a;
int dp[500001];
int n;
int f(int x) {
if (x == n + 1)
return 0;
else {
dp[x] =
min(dp[x - 2] + abs(a[x - 2] - a[x]), dp[x - 1] + abs(a[x - 1] - a[x]));
return f(x + 1);
}
}
int main() {
cin >> n;
a = new int[n + 1];
for (int i = 1; i ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
signed main() {
int n, h[10005], dp[10005] = {};
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> h[i];
}
dp[1] = 0;
for (int i = 2; i <= n; i++) {
if (i != 2) {
dp[i] = min(abs(h[i] - h[i - 2]) + dp[i - 2],
abs(h[i] - h[i - 1]) + ... | #include <bits/stdc++.h>
using namespace std;
signed main() {
int n, h[100005], dp[100005] = {};
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> h[i];
}
dp[1] = 0;
for (int i = 2; i <= n; i++) {
if (i != 2) {
dp[i] = min(abs(h[i] - h[i - 2]) + dp[i - 2],
abs(h[i] - h[i - 1]) ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
#define pb p... | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
#define pb p... | delete | 84 | 88 | 84 | 84 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int dp[10000];
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
dp[0] = 0;
for (int i = 1; i < n; i++) {
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
if (i > 1)
dp[i] = min(dp[i], dp[i - 2] + abs(h[i]... | #include <bits/stdc++.h>
using namespace std;
int dp[1000000];
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
dp[0] = 0;
for (int i = 1; i < n; i++) {
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
if (i > 1)
dp[i] = min(dp[i], dp[i - 2] + abs(h[... | replace | 4 | 5 | 4 | 5 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for (int ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
/*
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
*/
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for... | replace | 5 | 9 | 5 | 11 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
const int MOD... | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
const int MOD... | insert | 19 | 19 | 19 | 20 | 0 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(), a.end()
#define stoink stack<ll>
#define vec vector<ll>
#define vg vector<vector<ll>>
#define vgw vector < vector<pair<ll, ll>>
#define pa pair<ll, ll>
#define mp make_pair
#define pb... | #include <bits/stdc++.h>
using namespace std;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(), a.end()
#define stoink stack<ll>
#define vec vector<ll>
#define vg vector<vector<ll>>
#define vgw vector < vector<pair<ll, ll>>
#define pa pair<ll, ll>
#define mp make_pair
#define pb... | replace | 28 | 30 | 28 | 31 | TLE | |
p03160 | C++ | Runtime Error | #define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define endl... | #define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define endl... | replace | 32 | 33 | 32 | 33 | 0 | |
p03160 | C++ | Runtime Error | #define _USE_MATH_DEFINES // M_PI
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
using ll = long long;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define rREP(i, a, n) for (int(i) = (n)-1; (i) >= (a); --(i))
#define all(x) (x).begin(), (x).end()
#define... | #define _USE_MATH_DEFINES // M_PI
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
using ll = long long;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define rREP(i, a, n) for (int(i) = (n)-1; (i) >= (a); --(i))
#define all(x) (x).begin(), (x).end()
#define... | replace | 41 | 43 | 41 | 42 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <string>
#include <vector>
using namespace std::chrono;
using namespace std;
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define ll long long
bool isPowerOfTwo(ll x) {
/* First x in the below expression is for the case when x is 0 */
return x && (!(x & (x - 1)));
}
bool SameS... | #include <bits/stdc++.h>
#include <string>
#include <vector>
using namespace std::chrono;
using namespace std;
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define ll long long
bool isPowerOfTwo(ll x) {
/* First x in the below expression is for the case when x is 0 */
return x && (!(x & (x - 1)));
}
bool SameS... | replace | 68 | 69 | 68 | 69 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define rep(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begi... | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define rep(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begi... | replace | 94 | 98 | 94 | 98 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int minCost(int *arr, int n, int curr, int *dp) {
if (curr == n)
return 0;
if (curr == n - 1) {
return abs(arr[curr] - arr[n]);
}
if (dp[curr] != -1)
return dp[curr];
int oneJump = abs(arr[curr] - arr[curr + 1]) + minCost(arr, n,... | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int minCost(int *arr, int n, int curr, int *dp) {
if (curr == n)
return 0;
if (curr == n - 1) {
return abs(arr[curr] - arr[n]);
}
if (dp[curr] != -1)
return dp[curr];
int oneJump = abs(arr[curr] - arr[curr + 1]) + minCost(arr, n,... | replace | 33 | 34 | 33 | 35 | 30 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.ti... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.ti... | delete | 11 | 15 | 11 | 11 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
long long n, m;
cin >> n;
vector<long long> hh(10009, 0);
vector<long long> hhh(10005, 0);
for (int i = 0; i < n; i++) {
cin >> hh.at(i);
}
hhh.at(1) = abs(hh.at(0) - hh.at(1));
for (in... | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
long long n, m;
cin >> n;
vector<long long> hh(100000, 0);
vector<long long> hhh(100000, 0);
for (int i = 0; i < n; i++) {
cin >> hh.at(i);
}
hhh.at(1) = abs(hh.at(0) - hh.at(1));
for (... | replace | 7 | 9 | 7 | 9 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
//////////////////
#ifdef DEBUG
#include "debug.h"
#define dump(...) \
DUMPOUT << " " << string(#__VA_ARGS__) << ": " \
<< "[" << to_string(__LINE__) << ":" << __FUNCTIO... | #include <bits/stdc++.h>
using namespace std;
//////////////////
#ifdef DEBUG
#include "debug.h"
#define dump(...) \
DUMPOUT << " " << string(#__VA_ARGS__) << ": " \
<< "[" << to_string(__LINE__) << ":" << __FUNCTIO... | replace | 75 | 76 | 75 | 76 | -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>
#include <climits>
#include <cmath>
#include <iostream>
using namespace std;
#define ll long long
ll dp[100];
ll arr[100] = {0};
int n = 0;
ll solve(int i) {
if (i == n - 1)
return 0;
if (dp[i] != -1)
return dp[i];
ll op1, op2;
op1 = abs(arr[i] - arr[i + 1]) + solve(i + 1);
... | #include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <iostream>
using namespace std;
#define ll long long
ll dp[100009];
ll arr[100009] = {0};
int n = 0;
ll solve(int i) {
if (i == n - 1)
return 0;
if (dp[i] != -1)
return dp[i];
ll op1, op2;
op1 = abs(arr[i] - arr[i + 1]) + solve(i +... | replace | 6 | 8 | 6 | 8 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.