problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long int jump(int n, int h[], int start, int end, long long int y[]) { if (y[n] != -1) { return y[n]; } if (end == start + 1) { int k = abs(h[end] - h[start]); y[n] = k; return y[n]; } if (end == start) { return 0; } int d = abs(h[st...
#include <bits/stdc++.h> using namespace std; long long int jump(int n, int h[], int start, int end, long long int y[]) { if (y[n] != -1) { return y[n]; } if (end == start + 1) { int k = abs(h[end] - h[start]); y[n] = k; return y[n]; } if (end == start) { return 0; } int d = abs(h[st...
replace
24
28
24
28
0
p03160
C++
Runtime Error
#include <iostream> #include <math.h> using namespace std; long long min(long long a, long long b); int main(void) { long long N, h[10001], sum[10001], i; cin >> N; for (i = 1; i <= N; i++) { cin >> h[i]; } if (i == 1) { cout << 0 << endl; } else if (i == 2) { cout << abs(h[1] - h[2]) <...
#include <iostream> #include <math.h> using namespace std; long long min(long long a, long long b); int main(void) { long long N, h[100001], sum[100001], i; cin >> N; for (i = 1; i <= N; i++) { cin >> h[i]; } if (i == 1) { cout << 0 << endl; } else if (i == 2) { cout << abs(h[1] - h[2])...
replace
8
9
8
9
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(i, n) for (int i = 0; i > (int)(n); i--) #define ALL(v) v.begin(), v.end() #define INF 1e9 typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(i, n) for (int i = 0; i > (int)(n); i--) #define ALL(v) v.begin(), v.end() #define INF 1e9 typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template...
replace
23
24
23
24
0
p03160
C++
Runtime Error
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <vector> using namespace std; #define int long long #define ll long long #define pb push_back #define pii pair<...
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <vector> using namespace std; #define int long long #define ll long long #define pb push_back #define pii pair<...
delete
63
68
63
63
0
p03160
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define INF (long long)(1e18) #define MOD (int)(1e9 + 7) #define yn(f) ((f) ? "Yes" : "No") #define YN(f) ((f) ? ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define INF (long long)(1e18) #define MOD (int)(1e9 + 7) #define yn(f) ((f) ? "Yes" : "No") #define YN(f) ((f) ? ...
replace
17
18
17
18
0
p03160
C++
Time Limit Exceeded
#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...
insert
35
35
35
37
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define all(x) (x).begin(), (x).end() #define ldb ldouble // typedef tuple <int, int, int> t3; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; type...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define all(x) (x).begin(), (x).end() #define ldb ldouble // typedef tuple <int, int, int> t3; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; type...
replace
64
65
64
65
0
Time elapsed: 34ms
p03160
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int n; int d[10100]; int h[10100]; cin >> n; for (int i = 1; i <= n; ++i) { cin >> h[i]; } d[1] = 0; d[2] = abs(h[2] - h[1]); for (int i = 3; i <= n; ++i) { auto cost1 = abs(h[i] - h[i - 1]) + d[i - 1...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int n; int d[100100]; int h[100100]; cin >> n; for (int i = 1; i <= n; ++i) { cin >> h[i]; } d[1] = 0; d[2] = abs(h[2] - h[1]); for (int i = 3; i <= n; ++i) { auto cost1 = abs(h[i] - h[i - 1]) + d[i -...
replace
7
9
7
9
0
p03160
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int solve(vector<int> h, vector<int> a, int i) { if (a.at(i) > -1) { return a.at(i); } else { a.at(i) = min(a.at(i - 2) + abs(h.at(i) - h.at(i - 2)), a.at(i - 1) + abs(h.at(i)...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int solve(vector<int> &h, vector<int> &a, int i) { if (a.at(i) > -1) { return a.at(i); } else { a.at(i) = min(a.at(i - 2) + abs(h.at(i) - h.at(i - 2)), a.at(i - 1) + abs(h.at(...
replace
6
7
6
7
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using Edge = pair<int, int>; using Graph = vector<vector<Edge>>; #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) const ll MOD = 1000000007; const ll nmax = 8; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Edge = pair<int, int>; using Graph = vector<vector<Edge>>; #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) const ll MOD = 1000000007; const ll nmax = 8; ...
replace
80
81
80
81
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define per(i, n) for (long long i = (long long)(n - 1); i >= 0; --i) #define REP(i, s, t) for (long long i = s; i < t; i++) #define PER(i, s, t) for (long long i = s; i > t; --i) #define all(x) x.begin(), x.end() #define sp(n) se...
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define per(i, n) for (long long i = (long long)(n - 1); i >= 0; --i) #define REP(i, s, t) for (long long i = s; i < t; i++) #define PER(i, s, t) for (long long i = s; i > t; --i) #define all(x) x.begin(), x.end() #define sp(n) se...
replace
12
13
12
13
0
p03160
C++
Runtime Error
#include <iostream> using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const long long INF = 1LL << 60; long long dp[10010]; int h[100010]; long long rec(int i) { if (dp[i] < INF) return dp[i]; if (i == 0) return 0; ...
#include <iostream> using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const long long INF = 1LL << 60; long long dp[100010]; int h[100010]; long long rec(int i) { if (dp[i] < INF) return dp[i]; if (i == 0) return 0; ...
replace
12
13
12
13
0
p03160
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; int N; int h[100000]; int dp[100000]; int solve(int now) { if (now == N - 1) return 0; if (dp[now] = !-1) return dp[now]; ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; int N; int h[100000]; int dp[100000]; int solve(int now) { if (now == N - 1) return 0; if (dp[now] != -1) return dp[now]; ...
replace
20
21
20
21
TLE
p03160
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(a) (a).begin(), (a).end() #define PI 3.141592653589793238 #defin...
#include <algorithm> #include <iomanip> #include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(a) (a).begin(), (a).end() #define PI 3.141592653589793238 #defin...
replace
18
19
18
19
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 FASTIO \ cin.tie(0); \ cout...
#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 FASTIO \ cin.tie(0); \ cout...
replace
26
30
26
30
-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; void chmin(int &a, int b) { if (a > b) { a = b; } } int INF = 1000000000; int N; vector<int> dp(N), h(N); int rec(int i) { if (dp.at(i) < INF) { return dp.at(i); } if (i == 0) { return 0; } int res = INF; chmin(res, rec(i - 1) + abs(h.at(i - 1...
#include <bits/stdc++.h> using namespace std; void chmin(int &a, int b) { if (a > b) { a = b; } } int INF = 1000000000; int N; vector<int> dp(100010), h(100010); int rec(int i) { if (dp.at(i) < INF) { return dp.at(i); } if (i == 0) { return 0; } int res = INF; chmin(res, rec(i - 1) + abs(...
replace
11
12
11
12
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
p03160
C++
Runtime Error
/* ################ # Avi Kasliwal # # Noob Coder:( # ################ */ #include <algorithm> #include <bits/stdc++.h> using namespace std; #define int long long #define IOS \ ios_base::sync_with_stdio(false); ...
/* ################ # Avi Kasliwal # # Noob Coder:( # ################ */ #include <algorithm> #include <bits/stdc++.h> using namespace std; #define int long long #define IOS \ ios_base::sync_with_stdio(false); ...
replace
74
78
74
78
-11
p03160
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:256000000") // #pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <cassert> #include <ccomplex> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #inc...
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:256000000") // #pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <cassert> #include <ccomplex> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #inc...
replace
34
35
34
35
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long ll dp[11009]; ll val[11009]; ll n; ll frog(ll i) { if (i == n - 1) return 0; if (i > n - 1) return 989898; // cout<<"I = "<<i<<endl; // if(i==n-1)return (abs(val[i]-val[n-1])); // if(i==n-2)return (abs(val[i]-val[n-2])); if (d...
#include <bits/stdc++.h> using namespace std; #define ll long long ll dp[100009]; ll val[100009]; ll n; ll frog(ll i) { if (i == n - 1) return 0; if (i > n - 1) return 989898; // cout<<"I = "<<i<<endl; // if(i==n-1)return (abs(val[i]-val[n-1])); // if(i==n-2)return (abs(val[i]-val[n-2])); if ...
replace
3
5
3
5
0
p03160
C++
Runtime Error
// \[T]/ //Praise // (*) //The / \ Sun #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double dbl; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef vector<long long> vl; typedef vector<pair<int...
// \[T]/ //Praise // (*) //The / \ Sun #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double dbl; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef vector<long long> vl; typedef vector<pair<int...
replace
38
42
38
42
-11
p03160
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; // template<typename... T> // void read(T&... args) { // ((cin >> args), ...); // } // template<typename... T> // void write(T&&... args) { // ((cout << args << " "), ...); // } // #define deb(x) cerr << #x << " " << x <<endl; // #define debs(args ...) cerr << ...
#include "bits/stdc++.h" using namespace std; // template<typename... T> // void read(T&... args) { // ((cin >> args), ...); // } // template<typename... T> // void write(T&&... args) { // ((cout << args << " "), ...); // } // #define deb(x) cerr << #x << " " << x <<endl; // #define debs(args ...) cerr << ...
replace
27
31
27
28
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #include <unordered_map> #define M 1000000007 #define T 998244353 #define PI 3.142 #define ll long long using namespace std; int ab(int a, int b) { if (a < b) { return b - a; } return a - b; } int mini(int a, int b) { if (a > b) { return b; } return a; } int main() { i...
#include <bits/stdc++.h> #include <unordered_map> #define M 1000000007 #define T 998244353 #define PI 3.142 #define ll long long using namespace std; int ab(int a, int b) { if (a < b) { return b - a; } return a - b; } int mini(int a, int b) { if (a > b) { return b; } return a; } int main() { i...
delete
27
32
27
27
0
p03160
C++
Runtime Error
/* @author : srinathbalaji_99 */ #include <bits/stdc++.h> #define PB push_back #define MP make_pair #define endl '\n' #define MAX LLONG_MAX #define MIN LLONG_MIN #define rep(i, a, b, inc) for (long long i = a; i < b; i += inc) #define REP(i, n) rep(i, 0, n, 1) #define MEM(a, b) memset(a, (b), sizeof(a)) #define P...
/* @author : srinathbalaji_99 */ #include <bits/stdc++.h> #define PB push_back #define MP make_pair #define endl '\n' #define MAX LLONG_MAX #define MIN LLONG_MIN #define rep(i, a, b, inc) for (long long i = a; i < b; i += inc) #define REP(i, n) rep(i, 0, n, 1) #define MEM(a, b) memset(a, (b), sizeof(a)) #define P...
replace
55
59
55
59
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define MOD 1000000007 #define inf 3e18 #define ld long double // #define mp make_pair #define vpll vector<pair<ll, ll>> #define sll set<ll> #define vll vector<ll> #define vld vector<ld> #define vvll vector<...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define MOD 1000000007 #define inf 3e18 #define ld long double // #define mp make_pair #define vpll vector<pair<ll, ll>> #define sll set<ll> #define vll vector<ll> #define vld vector<ld> #define vvll vector<...
replace
54
56
54
57
-6
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; const ll LINF = 1LL << 60; const int MOD = 1000000007; template <typename T> void print(const T &v) { for (int i = 0; i < v.size(); i++) { if (i) cout << ' '; cout << v[i]; } co...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; const ll LINF = 1LL << 60; const int MOD = 1000000007; template <typename T> void print(const T &v) { for (int i = 0; i < v.size(); i++) { if (i) cout << ' '; cout << v[i]; } co...
replace
33
35
33
35
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int dp[100001]; int n, arr[100001]; int pound(int pos) { if (dp[pos] != -1) return dp[pos]; return dp[pos] = min(abs(arr[pos] - arr[pos - 1]) + pound(pos - 1), abs(arr[pos] - arr[pos - 2]) + pound(pos - 2)); } int main...
#include <bits/stdc++.h> using namespace std; #define ll long long int dp[100001]; int n, arr[100001]; int pound(int pos) { if (dp[pos] != -1) return dp[pos]; return dp[pos] = min(abs(arr[pos] - arr[pos - 1]) + pound(pos - 1), abs(arr[pos] - arr[pos - 2]) + pound(pos - 2)); } int main...
delete
19
23
19
19
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int n, h[100001], min_cost[100001]; int mincost(int i) { if (i == 0) return 0; if (i == 1) return abs(h[1] - h[0]); if (min_cost[i - 1] == -1) min_cost[i - 1] = mincost(i - 1); if (min_cost[i - 2] == -1) min_cost[i - 2] = mincos...
#include <bits/stdc++.h> using namespace std; #define int long long int n, h[100001], min_cost[100001]; int mincost(int i) { if (i == 0) return 0; if (i == 1) return abs(h[1] - h[0]); if (min_cost[i - 1] == -1) min_cost[i - 1] = mincost(i - 1); if (min_cost[i - 2] == -1) min_cost[i - 2] = mincos...
replace
20
24
20
24
0
p03160
C++
Runtime Error
// slight modification similar logic errichto's code #include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; vector<int> h(n); for (int &x : h) { cin >> x; } vector<int> dp(n, INF); dp[0] = 0; for (int i ...
// slight modification similar logic errichto's code #include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> h(n); for (int &x : h) { cin >> x; } vector<int> dp(n, INF); dp[0] = 0; ...
insert
14
14
14
15
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define ld long double #define pb push_back #define mp make_pair #define w(x) \ int t; ...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define ld long double #define pb push_back #define mp make_pair #define w(x) \ int t; ...
replace
37
44
37
38
-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 FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) FOR(i, 0, n - 1) /* #define INF 1e10 */ 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; } templ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) FOR(i, 0, n - 1) /* #define INF 1e10 */ 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; } templ...
replace
24
27
24
25
-11
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long ll mod = 1e9 + 7; #define PI 3.1415926535897932385 #define INF 100000000000000000ll #define fastio \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long ll mod = 1e9 + 7; #define PI 3.1415926535897932385 #define INF 100000000000000000ll #define fastio \ ios_base::sync_with_stdio(false); ...
replace
40
42
40
42
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define f first #define s second #define pb push_back #define mp make_pair #define mod 1000000007 #define fr(i, a, b) for (int i = a; i < b; i++) int main() { ios::sync_with_stdio(false); cin.tie(0...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define f first #define s second #define pb push_back #define mp make_pair #define mod 1000000007 #define fr(i, a, b) for (int i = a; i < b; i++) int main() { // ios::sync_with_stdio(false); // cin...
replace
12
18
12
18
0
p03160
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cstring> #include <iostream> using namespace std; const int N = 1e3 + 6, M = 1e5 + 5, OO = 0x3f3f3f3f; int n, h[N], op1, op2, dp[N]; int frog() { dp[1] = 0; dp[2] = abs(h[2] - h[1]); for (int i = 3; i <= n; i++) { dp[i] = min(dp[i - 2] + abs(...
#include <algorithm> #include <bits/stdc++.h> #include <cstring> #include <iostream> using namespace std; const int N = 1e5 + 6, M = 1e5 + 5, OO = 0x3f3f3f3f; int n, h[N], op1, op2, dp[N]; int frog() { dp[1] = 0; dp[2] = abs(h[2] - h[1]); for (int i = 3; i <= n; i++) { dp[i] = min(dp[i - 2] + abs(...
replace
7
8
7
8
0
p03160
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long const ll mod = 1e9 + 7; ll h[1000000]{0}; ll dp[1000000]{0}; ll n; ll solve(ll i) { if (i == n) return 0; if (i > n) return INT_MAX; ll ans = INT_MAX; ans = solve(i + 1) + abs(h[i + 1] - h[i]); if (i + 2 <= n) { ans = min(ans, sol...
#include <bits/stdc++.h> using namespace std; #define ll long long const ll mod = 1e9 + 7; ll h[1000000]{0}; ll dp[1000000]{0}; ll n; ll solve(ll i) { if (i == n) return 0; if (i > n) return INT_MAX; if (dp[i] != -1) return dp[i]; ll ans = INT_MAX; ans = solve(i + 1) + abs(h[i + 1] - h[i]); if ...
insert
13
13
13
15
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[10001]; int h[10001]; int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int n; cin >> n; if (n == 1) { cout << 0; return 0; } for (int i = 0; i < n; i++) { cin >> h[i]; } if (n == 2) { cout << abs(h[0] - h[1]);...
#include <bits/stdc++.h> using namespace std; int dp[100001]; int h[100001]; int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int n; cin >> n; if (n == 1) { cout << 0; return 0; } for (int i = 0; i < n; i++) { cin >> h[i]; } if (n == 2) { cout << abs(h[0] - h[1]...
replace
4
6
4
6
0
p03160
C++
Runtime Error
// Om Sree Sai Ram #include <bits/stdc++.h> #include <fstream> #include <iostream> using namespace std; vector<int> dp; int dfs(int i, int ar[], int n) { if (dp[i] != INT_MAX) { return dp[i]; } if (i == n - 1) { return 0; } if (i + 1 < n) { int tmp = abs(ar[i + 1] - ar[i]) + dfs(i + 1, ar, n); ...
// Om Sree Sai Ram #include <bits/stdc++.h> #include <fstream> #include <iostream> using namespace std; vector<int> dp; int dfs(int i, int ar[], int n) { if (dp[i] != INT_MAX) { return dp[i]; } if (i == n - 1) { return 0; } if (i + 1 < n) { int tmp = abs(ar[i + 1] - ar[i]) + dfs(i + 1, ar, n); ...
delete
26
31
26
26
0
p03160
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> h(100000 + 100, -1); vector<ll> dp(100000 + 100, -1); ll calc(ll i) { if (i == 1) return 0; if (i == 2) return abs(h[1] - h[2]); if (dp[i] != -1) return dp[i]; return min(calc(i - 1) + abs(h[i] - h[i - 1]), ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> h(100000 + 100, -1); vector<ll> dp(100000 + 100, -1); ll calc(ll i) { if (i == 1) return 0; if (i == 2) return abs(h[1] - h[2]); if (dp[i] != -1) return dp[i]; dp[i] = min(calc(i - 1) + abs(h[i] - h[i - 1]), ...
replace
14
16
14
17
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int a[1005], f[1005], n; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; f[0] = 0; f[1] = 0; f[2] = abs(a[2] - a[1]); for (int i = 3; i <= n; i++) f[i] = min(abs(a[i] - a[i - 1]) + f[i - 1], abs(a[i] - a[i - 2]) + f[i - 2]); c...
#include <bits/stdc++.h> using namespace std; int a[100005], f[10005], n; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; f[0] = 0; f[1] = 0; f[2] = abs(a[2] - a[1]); for (int i = 3; i <= n; i++) f[i] = min(abs(a[i] - a[i - 1]) + f[i - 1], abs(a[i] - a[i - 2]) + f[i - 2]); ...
replace
3
4
3
4
0
p03160
C++
Runtime Error
// Includes #include <algorithm> #include <assert.h> #include <bitset> #include <cstdlib> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <sta...
// Includes #include <algorithm> #include <assert.h> #include <bitset> #include <cstdlib> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <sta...
replace
69
73
69
73
0
p03160
C++
Time Limit Exceeded
#include <stdio.h> #include <stdlib.h> #define MAX 2147483647 int h[100000]; int dp[100000]; void chmin(int *a, int b) { if (*a > b) { *a = b; } } int rec(int i) { if (dp[i] != MAX) { return dp[i]; } if (i == 0) { return 0; } int res = MAX; chmin(&res, rec(i - 1) + abs(h[i - 1] - h[i]))...
#include <stdio.h> #include <stdlib.h> #define MAX 2147483647 int h[100000]; int dp[100000]; void chmin(int *a, int b) { if (*a > b) { *a = b; } } int rec(int i) { if (dp[i] != MAX) { return dp[i]; } if (i == 0) { return 0; } int res = MAX; chmin(&res, rec(i - 1) + abs(h[i - 1] - h[i]))...
replace
27
28
27
28
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const long long INF = 1LL << 60; int main() { int n; vector<int> h(10010); vector<long long> dp(100010); cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n; i++) dp[i] = INF; dp[0] = 0; for (int i = 0; i < n; i++) { dp[i +...
#include <bits/stdc++.h> using namespace std; const long long INF = 1LL << 60; int main() { int n; vector<int> h(100010); vector<long long> dp(100010); cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n; i++) dp[i] = INF; dp[0] = 0; for (int i = 0; i < n; i++) { dp[i ...
replace
6
7
6
7
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define pb push_back #define fi first` #define se second void solve() { ll n; cin >> n; std::vector<ll> v(n), ans(n); for (auto &i : v) cin >> i; ans[1] = abs(v[1] - v[0]); // ans[2]=min(ans[0]+abs(v[2]-v[1]),abs(v[2]-v...
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define pb push_back #define fi first` #define se second void solve() { ll n; cin >> n; std::vector<ll> v(n), ans(n); for (auto &i : v) cin >> i; ans[1] = abs(v[1] - v[0]); // ans[2]=min(ans[0]+abs(v[2]-v[1]),abs(v[2]-v...
replace
23
29
23
29
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03160
C++
Runtime Error
#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; #define testcase(t) \ int t; ...
#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; #define testcase(t) \ int t; ...
replace
43
45
43
45
0
p03160
C++
Runtime Error
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> costs(n); for (int i = 0; i < n; ++i) { cin >> costs[i]; } vector<int> dp(n); for (int i = 0; i < n; ++i) { if (i == 0) dp[0] = 0; else if (i == 1) { dp[1] = ab...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> costs(n); for (int i = 0; i < n; ++i) { cin >> costs[i]; } vector<int> dp(n); for (int i = 0; i < n; ++i) { if (i == 0) dp[0] = 0; else if (i == 1) { dp[1] = ab...
replace
29
30
29
30
30
p03160
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define L "\n" #define S " " #define ll long long #define pb push_back #define mp make_pair #define vi std::vector<int> #define si std::set<int> #define vl std::vector<long long> #define qi std::queue<int> #define de(a) cout << #a << " ------> " << a << "\n" #define SIZE 100002 #define INF IN...
#include <bits/stdc++.h> #define L "\n" #define S " " #define ll long long #define pb push_back #define mp make_pair #define vi std::vector<int> #define si std::set<int> #define vl std::vector<long long> #define qi std::queue<int> #define de(a) cout << #a << " ------> " << a << "\n" #define SIZE 100002 #define INF IN...
insert
40
40
40
41
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long int #define mod 1000000007 #define w(t) \ int t; \ cin >> t while (t--...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long int #define mod 1000000007 #define w(t) \ int t; \ cin >> t while (t--...
replace
58
59
58
59
-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 min(int a, int b) { return (a < b) ? a : b; } int main() { int n; cin >> n; vector<int> v(n); for (auto &i : v) cin >> i; vector<int> dp(n); dp[0] = 0; dp[1] = abs(v[1] - v[0]); for (int i = 2; i < n; i++) { dp[i] = min(abs(v[i] ...
#include <bits/stdc++.h> using namespace std; int min(int a, int b) { return (a < b) ? a : b; } int main() { int n; cin >> n; vector<int> v(n); for (auto &i : v) cin >> i; vector<int> dp(n); dp[0] = 0; dp[1] = abs(v[1] - v[0]); for (int i = 2; i < n; i++) { dp[i] = min(abs(v[i] ...
delete
27
29
27
27
1
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define max(x, y) ((x) > (y) ? (x) : (y)) #define min(x, y) ((x) < (y) ? (x) : (y)) #define abs(x) ((x) < 0 ? (-(x)) : (x)) #define rep(i, a, m) for ((i) = (a); (i) < (m); ++(i)) #define REP(i, n) for ((i) = 0; (i) < (int)(n); (i)++) #define fi first #define se second #define pb push_back #defi...
#include <bits/stdc++.h> #define max(x, y) ((x) > (y) ? (x) : (y)) #define min(x, y) ((x) < (y) ? (x) : (y)) #define abs(x) ((x) < 0 ? (-(x)) : (x)) #define rep(i, a, m) for ((i) = (a); (i) < (m); ++(i)) #define REP(i, n) for ((i) = 0; (i) < (int)(n); (i)++) #define fi first #define se second #define pb push_back #defi...
replace
36
38
36
40
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() typedef long long ll; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i) #define repprev(i, a, b) for (ll i = b - 1; i >= a; i--) #define reprev(i, n) repprev(i, 0, n) u...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() typedef long long ll; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i) #define repprev(i, a, b) for (ll i = b - 1; i >= a; i--) #define reprev(i, n) repprev(i, 0, n) u...
replace
190
191
190
191
0
p03160
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int a[10010], dp[10010]; int main() { int n; scanf("%d", &n); scanf("%d", &a[1]); scanf("%d", &a[2]); dp[2] = max(a[1], a[2]) - min(a[1], a[2]); for (int i = 3; i <= n; i++) { ; scanf(...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int a[100100], dp[100100]; int main() { int n; scanf("%d", &n); scanf("%d", &a[1]); scanf("%d", &a[2]); dp[2] = max(a[1], a[2]) - min(a[1], a[2]); for (int i = 3; i <= n; i++) { ; scan...
replace
6
7
6
7
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmin(T &a, const T b) { if (a > b) { a = b; return true; } return false; } int h[10010]; int dp[100010]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &h[i]); } const int INF = 1...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmin(T &a, const T b) { if (a > b) { a = b; return true; } return false; } int h[100010]; int dp[100010]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &h[i]); } const int INF = ...
replace
11
12
11
12
0
p03160
C++
Runtime Error
#include <climits> #include <iostream> #include <vector> using namespace std; int vals[10005]; int dp[10005]; int f(int n) { if (n == 0) { return 0; } if (dp[n] != -1) { return dp[n]; } int left = INT_MAX; int right = INT_MAX; if (n - 1 >= 0) { left = f(n - 1) + abs(vals[n - 1] - vals[n]...
#include <climits> #include <iostream> #include <vector> using namespace std; int vals[100005]; int dp[100005]; int f(int n) { if (n == 0) { return 0; } if (dp[n] != -1) { return dp[n]; } int left = INT_MAX; int right = INT_MAX; if (n - 1 >= 0) { left = f(n - 1) + abs(vals[n - 1] - vals[...
replace
6
8
6
8
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007ll #define vll vector<ll> #define pll pair<ll, ll> #define vpll vector<pll> #define pb push_back #define mp make_pair #define x first #define y second #define db(x) cout << #x << " = " << x << '\n' #define sep cout << "************...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007ll #define vll vector<ll> #define pll pair<ll, ll> #define vpll vector<pll> #define pb push_back #define mp make_pair #define x first #define y second #define db(x) cout << #x << " = " << x << '\n' #define sep cout << "************...
replace
16
20
16
20
0
p03160
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int rec(int i, const vector<int> &h, vector<int> *memo) { if (i == 1) return 0; if (i == 2) return abs(h[i - 1] - h[i - 2]); if ((*memo)[i] != -1) return (*memo)[i]; int cost1 = abs(h[i - 1] - h[i - 2]); int cost2 ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int rec(int i, const vector<int> &h, vector<int> *memo) { if (i == 1) return 0; if (i == 2) return abs(h[i - 1] - h[i - 2]); if ((*memo)[i] != -1) return (*memo)[i]; int cost1 = abs(h[i - 1] - h[i - 2]); int cost2 ...
replace
18
19
18
20
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define maxx 100010 #define mp make_pair typedef pair<int, int> ii; int dp[maxx]; vector<int> peso; int x; int main() { cin >> x; int n; for (int i = 0; i < n; i++) { cin >> n; peso.push_back(n); } dp[0] = 0; dp[1] = dp[0] + abs(peso[0] - peso[1]); f...
#include <bits/stdc++.h> using namespace std; #define maxx 100010 #define mp make_pair typedef pair<int, int> ii; int dp[maxx]; vector<int> peso; int x; int main() { cin >> x; int n; for (int i = 0; i < x; i++) { cin >> n; peso.push_back(n); } dp[0] = 0; dp[1] = dp[0] + abs(peso[0] - peso[1]); f...
replace
12
13
12
13
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int n; vector<int> h; int elem; vector<int> dp(10000 + 7); cin >> n; for (int i = 0; i < n; i++) { cin >> elem; h.push_back(elem); } dp[0] = 0; dp[1] = abs(h[1] - h[0]); for (int i = 2; i < n...
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int n; vector<int> h; int elem; vector<int> dp(100000 + 7); cin >> n; for (int i = 0; i < n; i++) { cin >> elem; h.push_back(elem); } dp[0] = 0; dp[1] = abs(h[1] - h[0]); for (int i = 2; i < ...
replace
10
11
10
11
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MAX 10000 int main() { int n; cin >> n; int f[MAX] = {}, h[MAX] = {}; for (int i = 1; i <= n; i++) { cin >> h[i]; } h[0] = 0; f[1] = 0; f[2] = abs(h[2] - h[1]); for (int i = 3; i <= n; i++) { f[i] = min(f[i - 1] + abs(h[i - 1] - h...
#include <bits/stdc++.h> using namespace std; #define MAX 100000 int main() { int n; cin >> n; int f[MAX] = {}, h[MAX] = {}; for (int i = 1; i <= n; i++) { cin >> h[i]; } h[0] = 0; f[1] = 0; f[2] = abs(h[2] - h[1]); for (int i = 3; i <= n; i++) { f[i] = min(f[i - 1] + abs(h[i - 1] - ...
replace
2
3
2
3
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n), dp(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } if (n == 1) return 0; dp[0] = 0, dp[1] = abs(a[1] - a[0]); for (int i = 2; i < n; ++i) dp[i] = min(abs(a[i] - a[i - 1]) + dp[i - 1], abs(...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n), dp(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } if (n == 1) return 0; dp[0] = 0, dp[1] = abs(a[1] - a[0]); for (int i = 2; i < n; ++i) dp[i] = min(abs(a[i] - a[i - 1]) + dp[i - 1], abs(...
replace
16
17
16
18
30
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define vi vector<int> #include <algorithm> #include <iostream> #include <iterator> using namespace std; string s; int main() { int a[10000]; int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); int dp[n + 1]; dp[0] = 0; dp[1] = dp[0] + abs(a[0] - a[1]);...
#include <bits/stdc++.h> #define vi vector<int> #include <algorithm> #include <iostream> #include <iterator> using namespace std; string s; int main() { int a[100000]; int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); int dp[n + 1]; dp[0] = 0; dp[1] = dp[0] + abs(a[0] - a[1])...
replace
10
11
10
11
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n; cin >> n; int h[n]; for (int i = 0; i < n; i++) cin >> h[i]; int dp[...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif */ int n; cin >> n; int h[n]; for (int i = 0; i < n; i++) cin >> h[i]; ...
replace
7
13
7
13
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define f(i, x, n) for (int i = x; i < n; i++) #define all(c) c.begin(), c.end() #define int ll #define print(x) cerr << (#x) << "is " << x << "\n" using ll = long long; using pii = pair<int, int>; c...
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define f(i, x, n) for (int i = x; i < n; i++) #define all(c) c.begin(), c.end() #define int ll #define print(x) cerr << (#x) << "is " << x << "\n" using ll = long long; using pii = pair<int, int>; c...
replace
31
35
31
35
0
p03160
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> #define ARRAY_LENGTH (10010) // Infinity value const long long INF = 1LL << 60; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } else { return false; } } int main(void) { int N; lon...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define ARRAY_LENGTH (100010) // Infinity value const long long INF = 1LL << 60; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } else { return false; } } int main(void) { int N; lo...
replace
5
6
5
6
0
p03160
C++
Runtime Error
#include <cmath> #include <iostream> using namespace std; const long long INF = 1LL << 60; int N; int H[10010]; int main() { cin >> N; for (int i = 0; i < N; ++i) cin >> H[i]; long long dp[100010]; for (int i = 0; i < 100010; ++i) dp[i] = INF; dp[0] = 0; for (int i = 1; i < N; ++i) { dp[i] ...
#include <cmath> #include <iostream> using namespace std; const long long INF = 1LL << 60; int N; int H[100010]; int main() { cin >> N; for (int i = 0; i < N; ++i) cin >> H[i]; long long dp[100010]; for (int i = 0; i < 100010; ++i) dp[i] = INF; dp[0] = 0; for (int i = 1; i < N; ++i) { dp[i]...
replace
7
8
7
8
0
p03160
C++
Runtime Error
// Vaidik Patel(India) // DA-IICT #include <bits/stdc++.h> using namespace std; //******************************************** #include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc. #include <ext/pb_ds/tree_policy.hpp> // include the tree_ord...
// Vaidik Patel(India) // DA-IICT #include <bits/stdc++.h> using namespace std; //******************************************** #include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc. #include <ext/pb_ds/tree_policy.hpp> // include the tree_ord...
delete
99
104
99
99
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #if 1 #define int long long #define MAX LLONG_MAX #define MIN LLONG_MIN #define stoi stoll #else #define MAX INT_MAX #define MIN INT_MIN #endif #define INF MAX / 2 #define ALL(obj) (obj).begin(), (obj).end() #define fi first #define se second const int NIL = -1; const int MOD = 1000000007; #def...
#include <bits/stdc++.h> #if 1 #define int long long #define MAX LLONG_MAX #define MIN LLONG_MIN #define stoi stoll #else #define MAX INT_MAX #define MIN INT_MIN #endif #define INF MAX / 2 #define ALL(obj) (obj).begin(), (obj).end() #define fi first #define se second const int NIL = -1; const int MOD = 1000000007; #def...
replace
65
66
65
66
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long // typedef //------------------------------------------ typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef vector<PII> VP; // rep //------------------------------------------ #define FOR(i, ...
#include <bits/stdc++.h> using namespace std; #define int long long // typedef //------------------------------------------ typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef vector<PII> VP; // rep //------------------------------------------ #define FOR(i, ...
replace
21
22
21
22
0
p03160
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define ll long long #define inf 1e18 #define pi acos(-1.0) ll n, a[100005], dp[100005]; ll f...
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define ll long long #define inf 1e18 #define pi acos(-1.0) ll n, a[100005], dp[100005]; ll f...
replace
20
21
20
22
TLE
p03160
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int dp[1000000]; int a[1000000]; int getans(int i, int n) { if (i == n) { return 0; } if (dp[i] != -1) { return dp[i]; } int cost = abs(a[i] - a[i + 1]) + getans(i + 1, n); if (i + 2 <= n) { cost = min(cost, abs(a[i] - a[i + 2]) + getans(i + 2, n)); ...
#include <bits/stdc++.h> using namespace std; int dp[1000000]; int a[1000000]; int getans(int i, int n) { if (i == n) { return 0; } if (dp[i] != -1) { return dp[i]; } int cost = abs(a[i] - a[i + 1]) + getans(i + 1, n); if (i + 2 <= n) { cost = min(cost, abs(a[i] - a[i + 2]) + getans(i + 2, n)); ...
replace
16
17
16
17
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n, 0); vector<int> dp(n, 0); for (int i = 0; i < n; i++) cin >> a[i]; if (n == 2) return abs(a[1] - a[0]); dp[1] = abs(a[1] - a[0]); for (int i = 2; i < n; i++) dp[i] = min(abs(a[i] - a[i - 1])...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n, 0); vector<int> dp(n, 0); for (int i = 0; i < n; i++) cin >> a[i]; if (n == 2) { cout << abs(a[1] - a[0]); return 0; } dp[1] = abs(a[1] - a[0]); for (int i = 2; i < n; i++) dp[i] = min...
replace
10
12
10
14
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define SORT(c) sort((c).begin(), (c).end()) #define MOD 1000000007 // S.size() 配列名.Length() using namespace std; typedef unsigned long long ll; int main(void) { int n; cin >> n; int h[n + 1]; rep(i, n) cin >> h[i + 1]; int dp[100...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define SORT(c) sort((c).begin(), (c).end()) #define MOD 1000000007 // S.size() 配列名.Length() using namespace std; typedef unsigned long long ll; int main(void) { int n; cin >> n; int h[n + 1]; rep(i, n) cin >> h[i + 1]; int dp[100...
replace
13
14
13
14
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define pb push_back #define mp make_pair #define INF (int)1e9 #define cBits(x) __builtin_popcount(x) #define gcd(a, b) __gcd((a), (b)) #define lcm(a, b) a / gcd(a, b) * b #define FOR(i, a, b) for (int i = a; i < b; i++) #defi...
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define pb push_back #define mp make_pair #define INF (int)1e9 #define cBits(x) __builtin_popcount(x) #define gcd(a, b) __gcd((a), (b)) #define lcm(a, b) a / gcd(a, b) * b #define FOR(i, a, b) for (int i = a; i < b; i++) #defi...
replace
32
36
32
36
-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; #define endl "\n" #define pb push_back #define mp make_pair #define MOD 1000000007 #define INF (long long int)1e9 #define EPS 1e-9 #define PI 3.1415926535897932384626433832795 #define ll long long int #define ret return #define NUM 100020 void fastio() { ios_base::sync_w...
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define pb push_back #define mp make_pair #define MOD 1000000007 #define INF (long long int)1e9 #define EPS 1e-9 #define PI 3.1415926535897932384626433832795 #define ll long long int #define ret return #define NUM 100020 void fastio() { ios_base::sync_w...
replace
28
29
28
29
-11
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long int ull; #define endl "\n" #define pb push_back #define sq(a) (a) * (a) #define debug(x) cerr << #x << '=' << (x) << endl; #define debugv(v) \ cerr << #v << " : ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long int ull; #define endl "\n" #define pb push_back #define sq(a) (a) * (a) #define debug(x) cerr << #x << '=' << (x) << endl; #define debugv(v) \ cerr << #v << " : ...
delete
38
42
38
38
0
p03160
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define stdi(in) freopen(in, "r", stdin) #define stdo(out) freopen(out, "w", stdout) #define stdio(in, out) \ stdi(in); ...
#include <algorithm> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define stdi(in) freopen(in, "r", stdin) #define stdo(out) freopen(out, "w", stdout) #define stdio(in, out) \ stdi(in); ...
replace
53
56
53
56
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int n; vector<int> h(n + 1); vector<int> cost(n + 1); int Ans(int n) { if (cost[n] != -1) return cost[n]; cost[n] = min((Ans(n - 1) + abs(h[n - 1] - h[n])), (Ans(n - 2) + abs(h[n - 2] - h[n]))); retur...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int n; vector<int> h(100000); vector<int> cost(100000); int Ans(int n) { if (cost[n] != -1) return cost[n]; cost[n] = min((Ans(n - 1) + abs(h[n - 1] - h[n])), (Ans(n - 2) + abs(h[n - 2] - h[n]))); ret...
replace
5
7
5
7
0
p03160
C++
Runtime Error
//_Hala Madrid_// #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ldb; typedef vector<int> vi; typedef pair<int, int> pii; #define fio \ ios_base::sync_with_stdio(false); ...
//_Hala Madrid_// #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ldb; typedef vector<int> vi; typedef pair<int, int> pii; #define fio \ ios_base::sync_with_stdio(false); ...
replace
40
41
40
41
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define fr first #define sc second #define memset(X, Y) memset(X, Y, sizeof X) #define all(X) X.begin(), X.end() #define sz size() #define pb push_back #define ve vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define ll long long #define Graph vector<vector<int>> #define Fp co...
#include <bits/stdc++.h> #define fr first #define sc second #define memset(X, Y) memset(X, Y, sizeof X) #define all(X) X.begin(), X.end() #define sz size() #define pb push_back #define ve vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define ll long long #define Graph vector<vector<int>> #define Fp co...
replace
17
18
17
18
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> dp(n), arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; dp[0] = 0; if (n > 1) dp[1] = abs(arr[1] - arr[0]); for (int i = 2; i < n; i++) dp[n] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> dp(n), arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; dp[0] = 0; if (n > 1) dp[1] = abs(arr[1] - arr[0]); for (int i = 2; i < n; i++) dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp...
replace
12
13
12
13
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int const int maxn = 1e3 + 5; int32_t main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; vector<int...
#include <bits/stdc++.h> using namespace std; #define int long long int const int maxn = 1e3 + 5; int32_t main() { // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) cin >> 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; typedef long long ll; typedef long double ld; #define rep(i, a, b) for (ll i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) (ll)(x).size() typedef pair<ll, ll> pii; typedef vector<ll> vi; ll ans[100000] = {}; ll fun(l...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i, a, b) for (ll i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) (ll)(x).size() typedef pair<ll, ll> pii; typedef vector<ll> vi; ll ans[100000] = {}; ll fun(l...
replace
20
24
20
24
-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; typedef unsigned long long ull; typedef long long ll; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
delete
30
34
30
30
-11
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < (N); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e12; const int inf = 1e9; typedef long long ll; typedef pair<ll, int> P; typedef set<int> S; int n; vector<int> v(10010...
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < (N); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e12; const int inf = 1e9; typedef long long ll; typedef pair<ll, int> P; typedef set<int> S; int n; vector<int> v(10010...
replace
11
12
11
12
0
p03160
C++
Runtime Error
// Charan Sriramula #include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long int ll; const ll lg = 14; const ll N = 5e3 + 5; const ll INF = 1e9; const ll mod = 1e9 + 7; const double PI = 3.14159265358979323846; #define ints(n) scanf("%d", &n) #define intp(n) printf("%d\n", n) #define l...
// Charan Sriramula #include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long int ll; const ll lg = 14; const ll N = 5e5 + 5; const ll INF = 1e9; const ll mod = 1e9 + 7; const double PI = 3.14159265358979323846; #define ints(n) scanf("%d", &n) #define intp(n) printf("%d\n", n) #define l...
replace
8
9
8
9
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> 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; } constexpr long long INF = 1LL << 60; long long h[10010]; long long dp[100010]...
#include <bits/stdc++.h> 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; } constexpr long long INF = 1LL << 60; long long h[100010]; long long dp[100010...
replace
18
19
18
19
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long int ll; int main() { ios::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; vector<int> h(n); for (auto &x : h) ci...
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long int ll; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> h(n); for (auto &x : h) cin >> x; vector<int> dp(n, INT_MAX); dp[0] = 0; for (int i = 0; i < n; i++) for (auto j : {i ...
delete
7
11
7
7
-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> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> h(n); vector<int> dp(1e9); rep(i, n) { cin >> h.at(i); } dp[0] = 0; dp[1] = abs(h[1] - h[0]); ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> h(n); vector<int> dp(n, 1e9); rep(i, n) { cin >> h.at(i); } dp[0] = 0; dp[1] = abs(h[1] - h[0]);...
replace
12
13
12
13
-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 int #define mp make_pair #define pb push_back #define fi first #define si second #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define fi first #define si second #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie...
replace
72
77
72
74
-6
terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append
p03160
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define int long long int #define pb push_back #define F first #define S second #define vi vector<int> #define pi pair<int, int> #define PI 3.14159265 #define all(x) x.begin(), x.end() #define er(n) cout <...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define int long long int #define pb push_back #define F first #define S second #define vi vector<int> #define pi pair<int, int> #define PI 3.14159265 #define all(x) x.begin(), x.end() #define er(n) cout <...
replace
29
30
29
30
-11
p03160
C++
Time Limit Exceeded
// In the name of **** God **** /* Copyright (C) JadedBeast Morocco created : 7/3/2019 */ #include <bits/stdc++.h> using namespace std; int dp(int i, int *values, int *result, int n) { if (i >= n) return 0; if (i < n - 2) ...
// In the name of **** God **** /* Copyright (C) JadedBeast Morocco created : 7/3/2019 */ #include <bits/stdc++.h> using namespace std; int dp(int i, int *values, int *result, int n) { if (i >= n) return 0; if (result[i] < IN...
insert
19
19
19
21
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll N1097 = 1000000007LL; int h[10000]; int dp[10000]; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { scanf("%d", &h[i]); } dp[1] = abs(h[1] - h[0]); for (int i = 2; i < N; i++) { dp[i] = min(dp[i - 1] + ab...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll N1097 = 1000000007LL; int h[1000000]; int dp[1000000]; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { scanf("%d", &h[i]); } dp[1] = abs(h[1] - h[0]); for (int i = 2; i < N; i++) { dp[i] = min(dp[i - 1] ...
replace
6
8
6
8
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(char ch) { string s(1, ch); return '\'' + s + '\''; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A...
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(char ch) { string s(1, ch); return '\'' + s + '\''; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A...
replace
89
93
89
93
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03160
C++
Time Limit Exceeded
#include <iostream> using namespace std; typedef long long ll; ll mincost(ll n, ll h[], ll *cost) { if (cost[n] != 0) return cost[n]; else { if (n <= 3) return cost[n] = abs(h[n] - h[1]); return cost[n] = min(abs(h[n] - h[n - 2]) + mincost(n - 2, h, cost), abs(h[n] - h[n ...
#include <iostream> using namespace std; typedef long long ll; ll mincost(ll n, ll h[], ll *cost) { if (cost[n] != 0) return cost[n]; else { cost[2] = abs(h[2] - h[1]); cost[3] = abs(h[3] - h[1]); for (ll i = 4; i <= n; i++) { cost[i] = min(abs(h[i] - h[i - 1]) + cost[i - 1], ...
replace
8
12
8
15
TLE
p03160
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ld long double #define endl "\n" #define ull unsigned long long #define pb push_back #define all(v) ((v).begin()), ((v).end()) #define vi vector<ll> #define INF 1000000000 #define M ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); using namespace std; int main...
#include <bits/stdc++.h> #define ll long long #define ld long double #define endl "\n" #define ull unsigned long long #define pb push_back #define all(v) ((v).begin()), ((v).end()) #define vi vector<ll> #define INF 1000000000 #define M ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); using namespace std; int main...
replace
12
13
12
13
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define sz(x) ((int)(x).size()) #define chmin(x, y) x = min(x, y) const int INF = 1e9; const int MOD = 1e9 + 7; con...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define sz(x) ((int)(x).size()) #define chmin(x, y) x = min(x, y) const int INF = 1e9; const int MOD = 1e9 + 7; con...
replace
14
16
14
16
0
p03160
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main // g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vll = vector<vl>; using vii = vector<vi>; usin...
#include <bits/stdc++.h> using namespace std; // g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main // g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vll = vector<vl>; using vii = vector<vi>; usin...
replace
128
129
128
129
TLE
p03160
C++
Runtime Error
// --------------------<optimizations>-------------------- #pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\ #pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\ #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std;...
// --------------------<optimizations>-------------------- #pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\ #pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\ #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std;...
replace
66
68
66
68
-11
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[1001] = {0}; int fun(int arr[], int n) { dp[0] = 0; dp[1] = abs(arr[1] - arr[0]); for (int i = 2; i < n; i++) { int option1 = dp[i - 1] + abs(arr[i] - arr[i - 1]); int option2 = dp[i - 2] + abs(arr[i] - arr[i - 2]); dp[i] = min(option1, option2); ...
#include <bits/stdc++.h> using namespace std; int dp[100000] = {0}; int fun(int arr[], int n) { dp[0] = 0; dp[1] = abs(arr[1] - arr[0]); for (int i = 2; i < n; i++) { int option1 = dp[i - 1] + abs(arr[i] - arr[i - 1]); int option2 = dp[i - 2] + abs(arr[i] - arr[i - 2]); dp[i] = min(option1, option2); ...
replace
2
3
2
3
0
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; vector<int> vec; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; vec.push_back(x); } vector<int> dp; dp.push_back(0); dp.push_back(abs(vec[0] - vec[1])); for (int i = 2; i < n; i++) { int y = min(abs(v...
#include <bits/stdc++.h> using namespace std; int main() { int n; vector<int> vec; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; vec.push_back(x); } vector<int> dp; dp.push_back(0); dp.push_back(abs(vec[0] - vec[1])); for (int i = 2; i < n; i++) { int y = min(abs(v...
replace
30
31
30
33
30
p03160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define pb push_back #define pie 3.141592653589 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 ll i, n...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define pb push_back #define pie 3.141592653589 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll i, n, n2, m, t, j, l, r, pos, mpos, f = 0, k, p, n1, z, q, x, y, x1, y1, ...
delete
12
17
12
12
0
p03160
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n; int h[10000]; int a[10000]; a[0] = 0; cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n; i++) { a[i + 1] = abs(h[i] - h[i + 1]) + a[i]; if (i > 0) { if (a[i + 1] > abs(h[i - 1] - h[i + 1]) + a[i - 1]) ...
#include <iostream> using namespace std; int main() { int n; int h[1000000]; int a[1000000]; a[0] = 0; cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n; i++) { a[i + 1] = abs(h[i] - h[i + 1]) + a[i]; if (i > 0) { if (a[i + 1] > abs(h[i - 1] - h[i + 1]) + a[i - ...
replace
4
6
4
6
0