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
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> // statics using namespace std; using int64 = int_fast64_t; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ...
#include <bits/stdc++.h> // statics using namespace std; using int64 = int_fast64_t; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ...
replace
76
78
76
78
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int const int INF = 1e9 + 7; using namespace std; ll dp[100005]; ll solve(int n, int k, vector<int> &h) { dp[1] = 0; for (int i = 2; i <= n; i++) { ll ans = INF; for (int j = 1; j <= k; j++) { ll tmp = INF; if (i - j >= 1) { tmp = abs(h[i] ...
#include <bits/stdc++.h> #define ll long long int const int INF = 1e9 + 7; using namespace std; ll dp[100005]; ll solve(int n, int k, vector<int> &h) { dp[1] = 0; for (int i = 2; i <= n; i++) { ll ans = INF; for (int j = 1; j <= k; j++) { ll tmp = INF; if (i - j >= 1) { tmp = abs(h[i] ...
replace
29
35
29
35
-11
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define input_vector(v, n) \ for (long long i = 0; i < n; i++) { \ cin >> v[i]; \ } #define fastIO ...
#include <bits/stdc++.h> #define input_vector(v, n) \ for (long long i = 0; i < n; i++) { \ cin >> v[i]; \ } #define fastIO ...
replace
22
23
22
23
0
p03161
C++
Runtime Error
#include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <utility> #include <vector> #define div1 1000000007 const long long INF = 1LL << 60; using namespace std; // a>b -> a==b; template <class T> inline bool chmin(T &...
#include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <utility> #include <vector> #define div1 1000000007 const long long INF = 1LL << 60; using namespace std; // a>b -> a==b; template <class T> inline bool chmin(T &...
replace
47
48
47
50
0
p03161
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> const int inf = 0x3f3f3f3f; using namespace std; int main() { int n, temp; cin >> n >> temp; vector<int> arr(n + 1, 0); for (int i = 1; i <= n; i++) cin >> arr[i]; vector<int> dp(n + 1, inf); dp[2] = abs(arr[2] - arr[1]); for (int i = 3; i ...
#include <algorithm> #include <iostream> #include <vector> const int inf = 0x3f3f3f3f; using namespace std; int main() { int n, temp; cin >> n >> temp; vector<int> arr(n + 1, 0); for (int i = 1; i <= n; i++) cin >> arr[i]; vector<int> dp(n + 1, inf); dp[1] = 0; for (int i = 2; i <= n; i++) { fo...
replace
15
19
15
19
0
p03161
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> int main() { int N, K; std::cin >> N >> K; std::vector<int> heights; for (int height; std::cin >> height;) { heights.push_back(height); } std::vector<int> costs_min(1, 0); for (int i = 1; i < K; ++i) { costs_min.push_back(std::abs(hei...
#include <algorithm> #include <iostream> #include <vector> int main() { int N, K; std::cin >> N >> K; std::vector<int> heights; for (int height; std::cin >> height;) { heights.push_back(height); } std::vector<int> costs_min(1, 0); for (int i = 1; i < std::min(K, N); ++i) { costs_min.push_back...
replace
16
17
16
17
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> #include <string.h> using namespace std; #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
#include <bits/stdc++.h> #include <string.h> using namespace std; #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
replace
58
60
58
62
0
p03161
C++
Time Limit Exceeded
/// BISMILLAHIR RAHMANIR RAHEEM /// ALLAH IS WATCHING ME /// ALLAH save us from COVID-19.Amin. /// █▀█─█──█──█▀█─█─█ /// █▄█─█──█──█▄█─█▄█ /// █─█─█▄─█▄─█─█─█─█ /// كُلُّ نَفْسٍ ذَآئِقَةُ الْمَوْت /// Every soul shall taste death. /// TODO:: #include <bits/stdc++.h> #include <ext/pb_ds/assoc_contain...
/// BISMILLAHIR RAHMANIR RAHEEM /// ALLAH IS WATCHING ME /// ALLAH save us from COVID-19.Amin. /// █▀█─█──█──█▀█─█─█ /// █▄█─█──█──█▄█─█▄█ /// █─█─█▄─█▄─█─█─█─█ /// كُلُّ نَفْسٍ ذَآئِقَةُ الْمَوْت /// Every soul shall taste death. /// TODO:: #include <bits/stdc++.h> #include <ext/pb_ds/assoc_contain...
replace
111
112
111
112
TLE
p03161
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
78
79
78
79
0
p03161
C++
Time Limit Exceeded
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <map> //map(辞書) #inclu...
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <map> //map(辞書) #inclu...
replace
46
48
46
47
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define lli long long int #define ...
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define lli long long int #define ...
delete
36
46
36
36
-11
p03161
C++
Runtime Error
#pragma once #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #...
#pragma once #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #...
replace
65
66
65
66
0
p03161
C++
Time Limit Exceeded
// بسم الله الرحمن الرحيم // اللہ کے نام سے شروع جو بڑا مہربان اور نہایت رحم والا ہے // Allah in the name of The Most Affectionate, the Merciful // अल्लाह के नाम से जो दयालु और कृपाशील है #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #inc...
// بسم الله الرحمن الرحيم // اللہ کے نام سے شروع جو بڑا مہربان اور نہایت رحم والا ہے // Allah in the name of The Most Affectionate, the Merciful // अल्लाह के नाम से जो दयालु और कृपाशील है #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #inc...
replace
48
50
48
50
TLE
p03161
C++
Time Limit Exceeded
#include <cmath> #include <iostream> #include <limits> #include <vector> int main() { int n, k; std::cin >> n >> k; std::vector<int> h(n); for (auto &&hi : h) std::cin >> hi; std::vector<int> cost(n, std::numeric_limits<int>::max()); cost[0] = 0; for (int i = 1; i < n; ++i) { for (int j = 0; j ...
#include <cmath> #include <iostream> #include <limits> #include <vector> int main() { int n, k; std::cin >> n >> k; std::vector<int> h(n); for (auto &&hi : h) std::cin >> hi; std::vector<int> cost(n, std::numeric_limits<int>::max()); cost[0] = 0; for (int i = 1; i < n; ++i) { for (int j = 0; j ...
replace
16
17
16
17
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define rep(i, a, b) for (i = a; i < b; i++) #define pb push_back #define all(v) v.begin(), v.end() #define F first #define S second #define CLR(a) memset((a), 0, sizeof(a)) #define mp make_pair #define hell 1000000007 using namespace std; // int g[105][105]; // vector < i...
#include <bits/stdc++.h> #define ll long long #define rep(i, a, b) for (i = a; i < b; i++) #define pb push_back #define all(v) v.begin(), v.end() #define F first #define S second #define CLR(a) memset((a), 0, sizeof(a)) #define mp make_pair #define hell 1000000007 using namespace std; // int g[105][105]; // vector < i...
replace
32
33
32
36
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, i, k, j; cin >> n >> k; ll a[n], dp[n]; for (i = 0; i < n; i++) cin >> a[i]; dp[0] = 0; // dp[1]=abs(a[1]-a[0]); for (i = 1; i < k; i++) // dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2])); { ll m...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, i, k, j; cin >> n >> k; ll a[n], dp[n]; for (i = 0; i < n; i++) cin >> a[i]; dp[0] = 0; // dp[1]=abs(a[1]-a[0]); for (i = 1; i < k; i++) { if (i >= n) break; ll m = dp[i - 1] + abs(a[i] - a[i - 1]); ...
replace
11
14
11
14
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, a[100009], dp[100009], k; ll f(int i) { if (i > n) return 1e9; else if (i == n) return 0; if (dp[i] != -1) return dp[i]; ll ans = f(i + 1) + abs(a[i] - a[i + 1]); for (int j = 2; j <= k; j++) { ans = min(ans, f(i + j) + ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, a[200009], dp[200009], k; ll f(int i) { if (i > n) return 1e9; else if (i == n) return 0; if (dp[i] != -1) return dp[i]; ll ans = f(i + 1) + abs(a[i] - a[i + 1]); for (int j = 2; j <= k; j++) { ans = min(ans, f(i + j) + ...
replace
3
4
3
4
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> h(N, 0); for (int i = 0; i < N; i++) cin >> h[i]; vector<int> cost(N, 0); cost[1] = abs(h[1] - h[0]); for (int i = 2; i < N; i++) { int res = INT_MAX; for (int k = 1; k <= K; k++) { res = m...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> h(N, 0); for (int i = 0; i < N; i++) cin >> h[i]; vector<int> cost(N, 0); cost[1] = abs(h[1] - h[0]); for (int i = 2; i < N; i++) { int res = INT_MAX; for (int k = 1; k <= K and i - k >= 0; k++) ...
replace
15
16
15
16
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, a, n) for (int i = a; i < n; i++) #define pb(v) push_back(v) int main() { // code ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int a[n]; f(i, 0, n) cin >> a[i]; int dp[n + 3]; dp[0] = 0; d...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, a, n) for (int i = a; i < n; i++) #define pb(v) push_back(v) int main() { // code ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int a[n]; f(i, 0, n) cin >> a[i]; int dp[n + k + 1]; dp[0] = 0;...
replace
16
17
16
17
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; vector<long long> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } vector<long long> dp(n, INT_MAX); dp[0] = 0; dp[1] = abs(h[1] - h[0]); for (int i = 2; i < n; i++) { for (int j = i - 1; j <= k; j++...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; vector<long long> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } vector<long long> dp(n, INT_MAX); dp[0] = 0; dp[1] = abs(h[1] - h[0]); for (int i = 2; i < n; i++) { for (int j = 1; j <= k; j++) { ...
replace
16
17
16
19
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int solve(vector<int> &ht, int n, int k) { vector<int> dp(n, 0); dp[0] = 0; dp[1] = abs(ht[1] - ht[0]); int mn = INT_MAX; for (int i = 2; i < n; i++) { for (int j = i - 1; j >= i - k && j >= 0; j--) { mn = min(mn, (dp[j] + abs(ht[i] - ht[j]))); } ...
#include <bits/stdc++.h> using namespace std; int solve(vector<int> &ht, int n, int k) { vector<int> dp(n, 0); dp[0] = 0; dp[1] = abs(ht[1] - ht[0]); int mn = INT_MAX; for (int i = 2; i < n; i++) { for (int j = i - 1; j >= i - k && j >= 0; j--) { mn = min(mn, (dp[j] + abs(ht[i] - ht[j]))); } ...
replace
22
25
22
25
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int solve(vector<int> &ht, int n, int k) { vector<int> dp(n, 0); dp[0] = 0; dp[1] = abs(ht[1] - ht[0]); int mn = INT_MAX; for (int i = 2; i < n; i++) { for (int j = i - 1; j >= i - k && j >= 0; j--) { mn = min(mn, (dp[j] + abs(ht[i] - ht[j]))); } ...
#include <bits/stdc++.h> using namespace std; int solve(vector<int> &ht, int n, int k) { vector<int> dp(n, 0); dp[0] = 0; dp[1] = abs(ht[1] - ht[0]); int mn = INT_MAX; for (int i = 2; i < n; i++) { for (int j = i - 1; j >= i - k && j >= 0; j--) { mn = min(mn, (dp[j] + abs(ht[i] - ht[j]))); } ...
delete
21
24
21
21
-6
terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size()
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll cost[100002], n, k; ll dp[100002]; ll jump(ll pos) { if (dp[pos] != -1) return dp[pos]; if (pos == n) return 0; if (pos > n) return INT_MAX; ll ans = 0, prev = INT_MAX; for (ll i = 1; i <= k; i++) { ans = (abs(cost[pos] - c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll cost[100002], n, k; ll dp[100002]; ll jump(ll pos) { if (dp[pos] != -1) return dp[pos]; if (pos == n) return 0; if (pos > n) return INT_MAX; ll ans = 0, prev = INT_MAX; for (ll i = 1; i <= k; i++) { ans = (abs(cost[pos] - c...
replace
17
18
17
18
TLE
p03161
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; int n, k, h[100001], f[100001]; int abs(int a) { return (a > 0) ? a : (-a); } int way(int a) { int mins = 2147483647, minp = 0; for (int i = ((a - k > 0) ? (a - k) : 1); i < a; i++) { if (f[i] + abs(h[a] - h[i]) < mins) { mins = f[i] + abs(h[a] -...
#include <cstdio> #include <iostream> using namespace std; int n, k, h[100001], f[100001]; int abs(int a) { return (a > 0) ? a : (-a); } int way(int a) { int mins = 2147483647, minp = 0; for (int i = ((a - k > 0) ? (a - k) : 1); i < a; i++) { if (f[i] + abs(h[a] - h[i]) < mins) { mins = f[i] + abs(h[a] -...
replace
17
18
17
18
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const long long INF = 1LL << 60; // これはなに? template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int N, K; cin >> N >> K; vector<int> h(N); for (int i = 0; i < N; ++i) cin >> h[i]; ve...
#include <bits/stdc++.h> using namespace std; const long long INF = 1LL << 60; // これはなに? template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int N, K; cin >> N >> K; vector<int> h(N); for (int i = 0; i < N; ++i) cin >> h[i]; ve...
replace
19
21
19
21
-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)
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> dp(n, 1e9), 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++) for (int j = 1; j <= k; j++) dp[i] = min(dp[i], d...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> dp(n, 1e9), arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; dp[0] = 0; for (int i = 0; i < n; i++) for (int j = 1; j <= k && j <= i; j++) dp[i] = min(dp[i], dp[i - j] + abs(arr[i] - arr[i - j]));...
replace
9
13
9
11
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // repetition #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define euc_dis(x, y) sqrt(x *x + y * y) #define MOD 1e9 + 7 #define sp ' ' using ll = long long; ll mod(ll a, ll b) { return (a % b + b) % b; } ll gcd(ll...
#include <bits/stdc++.h> using namespace std; // repetition #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define euc_dis(x, y) sqrt(x *x + y * y) #define MOD 1e9 + 7 #define sp ' ' using ll = long long; ll mod(ll a, ll b) { return (a % b + b) % b; } ll gcd(ll...
insert
56
56
56
58
0
p03161
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
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main(void) { int n, k; cin >> n >> k; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } vector<int> dp(n); dp[0] = 0; dp[1] = abs(h[1] - h[0]); if (n == 2) { cout << dp[1] << endl; return 0; } for (int i = 2; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, k; cin >> n >> k; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } vector<int> dp(n); dp[0] = 0; dp[1] = abs(h[1] - h[0]); if (n == 2) { cout << dp[1] << endl; return 0; } for (int i = 2; i < n; i++) ...
replace
20
21
20
21
0
p03161
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; ll n, m, k = 0, l = 0, x, y; int main() { #ifdef _DEBUG freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ...
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; ll n, m, k = 0, l = 0, x, y; int main() { #ifdef _DEBUG freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ...
replace
25
26
25
26
TLE
p03161
C++
Time Limit Exceeded
// #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!! #include <bits/stdc++.h> #include <cmath> typedef long long ll; using namespace std; vector<int> arr; stack<int> st; queue<int> qu; queue<pair<int, int>> qu2; priority_queue<int> pq; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, n) for (int i = ...
// #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!! #include <bits/stdc++.h> #include <cmath> typedef long long ll; using namespace std; vector<int> arr; stack<int> st; queue<int> qu; queue<pair<int, int>> qu2; priority_queue<int> pq; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, n) for (int i = ...
replace
50
51
50
51
TLE
p03161
C++
Runtime Error
#include <cmath> #include <iostream> #include <vector> using namespace std; #define rep(i, a, b) for (auto(i) = a; i < b; i++) #define list(i, N) for (auto(i) = 0; i < N; i++) typedef long long ll; #define int ll #define INF 1e9 + 5 #undef int int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #d...
#include <cmath> #include <iostream> #include <vector> using namespace std; #define rep(i, a, b) for (auto(i) = a; i < b; i++) #define list(i, N) for (auto(i) = 0; i < N; i++) typedef long long ll; #define int ll #define INF 1e9 + 5 #undef int int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #d...
replace
30
31
30
31
0
p03161
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 dpj[100001][101]; int dp[100001]; int jump(int a, int k, int h[], int n) { if (a == n) { return 0; } if (dp[a] != -1) { return dp[a]; } int min =...
#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 dpj[100001][101]; int dp[100001]; int jump(int a, int k, int h[], int n) { if (a == n) { return 0; } if (dp[a] != -1) { return dp[a]; } int min =...
delete
47
53
47
47
-11
p03161
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main(int, char **) { int n, k; cin >> n >> k; vector<int> h(n), a(n); for (int i = 0; i < n; ++i) { cin >> h[i]; } a[0] = 0; for (int i = 1; i < k; ++i) { a[i] = abs(h[i] - h[i - 1]) + a[i - 1]; ...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main(int, char **) { int n, k; cin >> n >> k; vector<long> h(n), a(n); for (int i = 0; i < n; ++i) { cin >> h[i]; } a[0] = 0; for (int i = 1; i < k; ++i) { a[i] = abs(h[i] - h[i - 1]) + a[i - 1]; ...
replace
8
9
8
9
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long n, k; cin >> n >> k; long a[n], cost[n]; for (int i = 0; i < n; ++i) cost[i] = INT_MAX; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 1; i <= k; ++i) cost[i] = abs(a[i] - a[0]); for (int i = 1; i < n; ++i) for (int j...
#include <bits/stdc++.h> using namespace std; int main() { long n, k; cin >> n >> k; long a[n], cost[n]; for (int i = 0; i < n; ++i) cost[i] = INT_MAX; for (int i = 0; i < n; ++i) cin >> a[i]; cost[0] = 0; for (int i = 0; i < n; ++i) for (int j = i + 1; j <= i + k and j < n; ++j) cost[...
replace
12
15
12
14
0
p03161
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> // << fixed << precision(10) #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define FOR(i, s, t) for (int i = s; i < t; i++) #define REP(i, n) FOR(i, 0, n) #define PRINT(s) cout << s << "\n" #define SOR...
#include <algorithm> #include <cmath> #include <iomanip> // << fixed << precision(10) #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define FOR(i, s, t) for (int i = s; i < t; i++) #define REP(i, n) FOR(i, 0, n) #define PRINT(s) cout << s << "\n" #define SOR...
replace
38
39
38
39
0
p03161
C++
Runtime Error
#include <algorithm> #include <chrono> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; #define INF 1000000000 #de...
#include <algorithm> #include <chrono> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; #define INF 1000000000 #de...
replace
29
30
29
30
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define i...
#include <bits/stdc++.h> #define ll long long int #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define i...
delete
27
32
27
27
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03161
C++
Runtime Error
#include <bits/stdc++.h> #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 INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long int ll; int main() { int n, k; scanf("%d%d", &n, &k); int...
#include <bits/stdc++.h> #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 INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long int ll; int main() { int n, k; scanf("%d%d", &n, &k); int...
replace
12
13
12
13
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("frog_in.txt", "r", stdin); #endif int n, k; cin >> n >> k; k = min(n, k); int arr[n], dp[n]; for (int i = 0; i < n; ++i) { cin >> arr[...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; k = min(n, k); int arr[n], dp[n]; for (int i = 0; i < n; ++i) { cin >> arr[i]; if (i < k) dp[i] = abs(arr[0] - arr[i]); } for ...
delete
8
12
8
8
0
p03161
C++
Runtime Error
/* LEARNING DP: FROG 2 + Frog need to reach stone N + Can jump to Stone i + 1 or i + 2 when the Frog is on Stone i + Cost |hi - hj| => Imagine if the frog were at stone i + 1 or i + 2 What is the minium cost to reach on Stone i. + DIFFERENT FROM FROG 1: ...
/* LEARNING DP: FROG 2 + Frog need to reach stone N + Can jump to Stone i + 1 or i + 2 when the Frog is on Stone i + Cost |hi - hj| => Imagine if the frog were at stone i + 1 or i + 2 What is the minium cost to reach on Stone i. + DIFFERENT FROM FROG 1: ...
replace
21
22
21
22
0
p03161
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; long long int INF = 1e9 + 5; int main() { int n; cin >> n; int k; cin >> k; vector<long long int> arr(n + 1); for (int i = 1; i <= n; i++) { cin >> arr[i]; } vector<long long int> dp(n + 1, INF); dp[1] = 0; for (int i = 2; i <= n; i++) {...
#include <iostream> #include <vector> using namespace std; long long int INF = 1e9 + 5; int main() { int n; cin >> n; int k; cin >> k; vector<long long int> arr(n + 1); for (int i = 1; i <= n; i++) { cin >> arr[i]; } vector<long long int> dp(n + 1, INF); dp[1] = 0; for (int i = 2; i <= n; i++) {...
insert
19
19
19
22
TLE
p03161
C++
Runtime Error
// "It does not matter how slowly you go as long as you do not stop." - // Confucius #include <bits/stdc++.h> using namespace std; /* author : Roshan_Mehta motto : Time Management,Consistency,Patience!! */ #define int long long #ifdef Local_Debug #define debug(x) cout << #x << " " << x << " " #define debug1(a) co...
// "It does not matter how slowly you go as long as you do not stop." - // Confucius #include <bits/stdc++.h> using namespace std; /* author : Roshan_Mehta motto : Time Management,Consistency,Patience!! */ #define int long long #ifdef Local_Debug #define debug(x) cout << #x << " " << x << " " #define debug1(a) co...
replace
202
203
202
203
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } #define pp pair<int, int> #define rep(i, n) ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } #define pp pair<int, int> #define rep(i, n) ...
replace
32
33
32
33
-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)
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, a, b) for (ll i = a; i < b; i++) int main() { ll n, k5; cin >> n >> k5; ll a[n], inf = 1000000009; f(i, 0, n) { cin >> a[i]; } ll dp[n]; f(k1, 0, n) { dp[k1] = inf; } dp[0] = 0; dp[1] = abs(a[1] - a[0]); f(j, 2, k5 + 1) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, a, b) for (ll i = a; i < b; i++) int main() { ll n, k5; cin >> n >> k5; ll a[n], inf = 1000000009; f(i, 0, n) { cin >> a[i]; } ll dp[n]; f(k1, 0, n) { dp[k1] = inf; } dp[0] = 0; dp[1] = abs(a[1] - a[0]); if (n > k5 + 1) { ...
replace
13
15
13
17
0
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const ll INF = 1LL << 60; vector<ll> dp(100010, INF); vector<ll> h(100010); int K; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const ll INF = 1LL << 60; vector<ll> dp(100010, INF); vector<ll> h(100010); int K; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; ...
replace
45
46
45
54
TLE
p03161
C++
Runtime Error
// SeeAlso: https://atcoder.jp/contests/dp/tasks/dp_b #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define MAX 100000 #define NIL -1 #define MOD 1000000007 typedef int _loop_int; #define rep(...
// SeeAlso: https://atcoder.jp/contests/dp/tasks/dp_b #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define MAX 100000 #define NIL -1 #define MOD 1000000007 typedef int _loop_int; #define rep(...
replace
73
74
73
74
0
p03161
C++
Time Limit Exceeded
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author ExplodingFreeze */ #include <fstream> #include <iostream> #pragma comment(linker, "/stack:200000000") #include <bits/stdc++.h> #define int long long #define f(i, a, b) for (int i = (a); i < (b); i++) #define MOD 10000...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author ExplodingFreeze */ #include <fstream> #include <iostream> #pragma comment(linker, "/stack:200000000") #include <bits/stdc++.h> #define int long long #define f(i, a, b) for (int i = (a); i < (b); i++) #define MOD 10000...
replace
30
31
30
31
TLE
p03161
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...
replace
111
112
111
115
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n, k; cin >> n >> k; vector<ll> v(n, 0); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<ll> dp(n, INT_MAX); dp[0] = 0; for (int i = 1; i < k; i++) { dp[i] = abs(v[i] - v[0]); } for (int i = k; i < n;...
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ll n, k; cin >> n >> k; vector<ll> v(n, 0); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<ll> dp(n, INT_MAX); dp[0] = 0; k = min(k, n); for (int i = 1; i < k; i++) { dp[i] = abs(v[i] - v[0]); } for (...
insert
13
13
13
14
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define lli long long int #define uli unsigned long long int #define INF 999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = n - 1; i > m; i--) #define pb(n) push_back(n) #define Sort(n) sort(n.begin(), n.end()) #define Rev(n) rever...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define uli unsigned long long int #define INF 999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = n - 1; i > m; i--) #define pb(n) push_back(n) #define Sort(n) sort(n.begin(), n.end()) #define Rev(n) rever...
replace
23
25
23
28
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main(void) { int n, k; cin >> n >> k...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main(void) { int n, k; cin >> n >> k...
replace
23
24
23
24
0
p03161
C++
Time Limit Exceeded
// edpc_b #include <bits/stdc++.h> #ifdef LOCAL #include "../cxx-prettyprint/prettyprint.hpp" #endif using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); ++(...
// edpc_b #include <bits/stdc++.h> #ifdef LOCAL #include "../cxx-prettyprint/prettyprint.hpp" #endif using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); ++(...
replace
47
48
47
48
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FastRead \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long ...
#include <bits/stdc++.h> using namespace std; #define FastRead \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long ...
delete
66
71
66
66
0
p03161
C++
Runtime Error
#include <algorithm> #include <climits> #include <cstdlib> #include <iostream> using namespace std; int main(void) { int n, k; cin >> n >> k; int h[n + 1], dp[n + 1]; for (int i = 1; i <= n; i++) cin >> h[i]; for (int i = 2; i <= n; i++) dp[i] = INT_MAX; dp[0] = dp[1] = 0; for (int i = 1; i <= n; ...
#include <algorithm> #include <climits> #include <cstdlib> #include <iostream> using namespace std; int main(void) { int n, k; cin >> n >> k; int h[n + 1], dp[n + 1]; for (int i = 1; i <= n; i++) cin >> h[i]; for (int i = 2; i <= n; i++) dp[i] = INT_MAX; dp[0] = dp[1] = 0; for (int i = 1; i <= n; ...
replace
16
18
16
19
0
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int arr[n]; int i, j; int dp[n]; for (i = 0; i < n; i++) { dp[i] = 0; cin >> arr[i]; } for (i = 1; i < n; i++) { dp[i] = INT_MAX; for (j = i - 1; j >= 0; j--) { int a1 = INT_MAX; if (i - j <= ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int arr[n]; int i, j; int dp[n]; for (i = 0; i < n; i++) { dp[i] = 0; cin >> arr[i]; } for (i = 1; i < n; i++) { dp[i] = INT_MAX; for (j = i - 1; j >= i - k && j >= 0; j--) { int a1 = abs(arr[i] - ...
replace
14
19
14
17
TLE
p03161
C++
Runtime Error
#pragma region header #include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rev(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define rev1(i, n) for (int i = (int)(n); i > 0; i--) #define pb...
#pragma region header #include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rev(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define rev1(i, n) for (int i = (int)(n); i > 0; i--) #define pb...
replace
85
86
85
86
-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)
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; if (N == 1) { cout << 0; return 0; } int h[N]; for (int i = 0; i < N; i++) { cin >> h[i]; } int val[N]; for (int i = 0; i < N; i++) { val[i] = INT_MAX; } val[0] = 0; for (int i = 1; i < N; i+...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; if (N == 1) { cout << 0; return 0; } int h[N]; for (int i = 0; i < N; i++) { cin >> h[i]; } int val[N]; for (int i = 0; i < N; i++) { val[i] = INT_MAX; } val[0] = 0; for (int i = 1; i < N; i+...
replace
24
25
24
25
-11
p03161
C++
Runtime Error
/* I_Love_Trueno Author- darklight13 Smoke_Weed_Everyday */ #define _CRT_SECURE_NO_DEPRECATE #define V__0_0__V #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define SYNC \ std::ios_base::sync_with_stdio...
/* I_Love_Trueno Author- darklight13 Smoke_Weed_Everyday */ #define _CRT_SECURE_NO_DEPRECATE #define V__0_0__V #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define SYNC \ std::ios_base::sync_with_stdio...
insert
45
45
45
49
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; vector<int> cost(n, INT_MAX); cost[0] = 0; cost[1] = abs(h[0] - h[1]); for (int i = 2; i < n; i++) { for (int j = 1; j <= k; j++) { cost[i] = mi...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; vector<int> cost(n, INT_MAX); cost[0] = 0; cost[1] = abs(h[0] - h[1]); for (int i = 2; i < n; i++) { for (int j = 1; j <= k && i - j >= 0; j++) { ...
replace
15
16
15
16
0
p03161
C++
Time Limit Exceeded
// /$$$$ /$$ /$$$$ /$$$$$$ /$$ // | $$_/ | $$ |_ $$ /$$__ $$ | $$ // | $$ /$$$$$$$| $$$$$$$ /$$$$$$ | $$|__/ \ $$ /$$$$$$$ | $$ /$$ // | $$ /$$_____/| $$__ $$ |____ $$ | $$ /$$$$$$/| $$__ $$| $$ /$$/ // | $$ | $$$$$$ | ...
// /$$$$ /$$ /$$$$ /$$$$$$ /$$ // | $$_/ | $$ |_ $$ /$$__ $$ | $$ // | $$ /$$$$$$$| $$$$$$$ /$$$$$$ | $$|__/ \ $$ /$$$$$$$ | $$ /$$ // | $$ /$$_____/| $$__ $$ |____ $$ | $$ /$$$$$$/| $$__ $$| $$ /$$/ // | $$ | $$$$$$ | ...
replace
59
62
59
63
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define inf 1000000000000000000 #define fr first #define sc second #define pb push_back #define pf push_front #define rep(i, a, n) for (ll i = a; i < n; i++) #define per(i, a, n) for (ll i = n - 1; i >= a; i--) #define pll pair<l...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define inf 1000000000000000000 #define fr first #define sc second #define pb push_back #define pf push_front #define rep(i, a, n) for (ll i = a; i < n; i++) #define per(i, a, n) for (ll i = n - 1; i >= a; i--) #define pll pair<l...
replace
26
31
26
31
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define ll long long #define MOD 1000000007 #define nl cout << endl #define rt ll Q[100005] = {0} #define mp make_pair #define test() \ ull t; ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define ll long long #define MOD 1000000007 #define nl cout << endl #define rt ll Q[100005] = {0} #define mp make_pair #define test() \ ull t; ...
delete
34
38
34
34
0
p03161
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
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int K; cin >> K; vector<int> h(N); for (int i = 0; i < N; i++) { cin >> h[i]; } vector<int> dp(N); dp[0] = h[0]; dp[1] = abs(h[0] - h[1]); for (int i = 2; i <= K; i++) { int this_min = INT_MAX; for (int j =...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int K; cin >> K; vector<int> h(N); for (int i = 0; i < N; i++) { cin >> h[i]; } vector<int> dp(N); dp[0] = h[0]; dp[1] = abs(h[0] - h[1]); for (int i = 2; i <= min(K, N - 1); i++) { int this_min = INT_MAX; ...
replace
18
19
18
19
0
p03161
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sta...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sta...
replace
62
63
62
63
0
p03161
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sta...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sta...
replace
62
63
62
63
0
p03161
C++
Runtime Error
// Code by : Abhishek Tiwari // codechef.com/users/devil_within || hackerearth.com/@devil_within #include <bits/stdc++.h> #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
// Code by : Abhishek Tiwari // codechef.com/users/devil_within || hackerearth.com/@devil_within #include <bits/stdc++.h> #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
replace
62
65
62
64
-6
p03161
C++
Runtime Error
#include <iostream> // #include <algorithm> #include <cstdlib> #include <vector> using namespace std; int main() { int N, K; vector<int> Distances; vector<int> Heights; cin >> N >> K; Distances.reserve(N); Heights.reserve(N); int i, j; int min = 2147483647; int dist; for (i = 0; i < N; i++) { c...
#include <iostream> // #include <algorithm> #include <cstdlib> #include <vector> using namespace std; int main() { int N, K; vector<int> Distances; vector<int> Heights; cin >> N >> K; Distances.reserve(N); Heights.reserve(N); int i, j; int min = 2147483647; int dist; for (i = 0; i < N; i++) { c...
insert
20
20
20
29
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int lli; int main() { lli n, k; cin >> n >> k; lli arr[n]; for (lli i = 0; i < n; i++) cin >> arr[i]; vector<lli> dp(n, INT_MAX); dp[0] = 0; dp[1] = abs(arr[0] - arr[1]); for (lli i = 2; i < n; i++) { for (lli j = 1; j <= min(n, k);...
#include <bits/stdc++.h> using namespace std; typedef long long int lli; int main() { lli n, k; cin >> n >> k; lli arr[n]; for (lli i = 0; i < n; i++) cin >> arr[i]; vector<lli> dp(n, INT_MAX); dp[0] = 0; dp[1] = abs(arr[0] - arr[1]); for (lli i = 2; i < n; i++) { for (lli j = 1; j <= min(i, k);...
replace
13
14
13
14
0
p03161
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <vector> using namespace std; int main() { const long long INF = 1ll << 60; int n, k; cin >> n >> k; long long h[100010]; for (int i = 0; i < n; i++) cin >> h[i]; long long dp[100010]; for (int i = 0; i < 100010; i...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <vector> using namespace std; int main() { const long long INF = 1ll << 60; int n, k; cin >> n >> k; long long h[100010]; for (int i = 0; i < n; i++) cin >> h[i]; long long dp[100010]; for (int i = 0; i < 100010; i...
replace
22
23
22
24
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> dis(n); for (int i = 0; i < n; i++) { cin >> dis[i]; // cout<<dis[i]<<" "; } // cout<<"\n"; vector<int> costs(n, INT_MAX); costs[0] = 0; for (int i = 1; i < n; i++) { int count = k, j = i - 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> dis(n); for (int i = 0; i < n; i++) { cin >> dis[i]; // cout<<dis[i]<<" "; } // cout<<"\n"; vector<int> costs(n, INT_MAX); costs[0] = 0; for (int i = 1; i < n; i++) { int count = k, j = i - 1; ...
replace
24
25
24
25
1
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int min_cost(int *arr, int n, int k) { int *dp = new int[n + 1]; dp[0] = 0; dp[1] = 0; dp[2] = abs(arr[1] - arr[2]); for (int i = 3; i <= n; ++i) { int temp = INT_MAX; for (int j = 1; j <= k; ++j) { temp = min(temp, abs(arr[i] - arr[i - j]) + dp[...
#include <bits/stdc++.h> using namespace std; int min_cost(int *arr, int n, int k) { int *dp = new int[n + 1]; dp[0] = 0; dp[1] = 0; dp[2] = abs(arr[1] - arr[2]); for (int i = 3; i <= n; ++i) { int temp = INT_MAX; for (int j = 1; j <= k && (i - j) > 0; ++j) { temp = min(temp, abs(arr[i] - ar...
replace
13
14
13
14
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> #include <chrono> using namespace std; using namespace std::chrono; // #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") // #pragma optimization_level 3 // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") // #...
#include <bits/stdc++.h> #include <chrono> using namespace std; using namespace std::chrono; // #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") // #pragma optimization_level 3 // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") // #...
replace
132
133
132
135
0
p03161
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long int ll; int main() { int N, K, dp[1000] = {}; cin >> N >> K; vector<int> h(...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long int ll; int main() { int N, K, dp[10000000] = {}; cin >> N >> K; vector<int...
replace
15
16
15
16
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int minimumcost(int n, int k, vector<int> &v) { vector<int> dp(n, 0); dp[0] = 0; for (int i = 1; i <= k; i++) { dp[i] = abs(v[i] - v[0]); } for (int i = k + 1; i < n; i++) { dp[i] = dp[i - k] + abs(v[i] - v[i - k]); for (int j = i - 1; j >= i - k; j-...
#include <bits/stdc++.h> using namespace std; int minimumcost(int n, int k, vector<int> &v) { if (k >= n) { return v[n - 1] - v[0]; } vector<int> dp(n, 0); dp[0] = 0; for (int i = 1; i <= k; i++) { dp[i] = abs(v[i] - v[0]); } for (int i = k + 1; i < n; i++) { dp[i] = dp[i - k] + abs(v[i] - v...
insert
4
4
4
7
0
p03161
C++
Runtime Error
#include "bits/stdc++.h" #pragma GCC optimize("Ofast") // Begin Header {{{ using namespace std; #ifndef DEBUG #define dump(...) #endif #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i) #define reps(i, b, e) ...
#include "bits/stdc++.h" #pragma GCC optimize("Ofast") // Begin Header {{{ using namespace std; #ifndef DEBUG #define dump(...) #endif #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i) #define reps(i, b, e) ...
replace
125
126
125
126
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, K; cin >> n >> K; vector<ll> v(n); vector<ll> dp(n + 1, -1); for (ll i = 0; i < n; i++) { cin >> v[i]; } dp[0] = 0; for (ll i = 1; i < n; i++) { ll add = LLONG_MAX; for (ll k = 1; k <= K; k++) { add...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, K; cin >> n >> K; vector<ll> v(n); vector<ll> dp(n + 1, -1); for (ll i = 0; i < n; i++) { cin >> v[i]; } dp[0] = 0; for (ll i = 1; i < n; i++) { ll add = LLONG_MAX; for (ll k = 1; k <= K; k++) { if ...
replace
16
17
16
18
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; vector<int> ht; cin >> n >> m; for (int i = 0; i < n; i++) { int x; cin >> x; ht.push_back(x); } long long cost[100010] = {0}; for (int i = 2; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; vector<int> ht; cin >> n >> m; for (int i = 0; i < n; i++) { int x; cin >> x; ht.push_back(x); } long long cost[100010] = {0}; for (int i = 2; i <= n; i++) { ...
replace
21
22
21
24
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int absdiff(int a, int b) { return (abs(a - b)); } int main() { int n, k; cin >> n >> k; vector<int> height; for (int i = 0; i < n; i++) { int temp; cin >> temp; height.push_back(temp); } vector<int> cost(n, 0); cost[1] = abs(height[1] - height[...
#include <bits/stdc++.h> using namespace std; int absdiff(int a, int b) { return (abs(a - b)); } int main() { int n, k; cin >> n >> k; vector<int> height; for (int i = 0; i < n; i++) { int temp; cin >> temp; height.push_back(temp); } vector<int> cost(n, 0); cost[1] = abs(height[1] - height[...
replace
19
20
19
20
0
p03161
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") #pragma GCC optimize("Ofast") #pragma GCC tar...
// --------------------<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") #pragma GCC optimize("Ofast") #pragma GCC tar...
replace
85
86
85
87
0
p03161
C++
Runtime Error
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // //...
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // // 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 // //...
replace
104
105
104
105
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define llinf 4e17 #define nllinf -4e18 #define vll vector<ll> #define sll set<ll> #define pll pair<ll, ll> #define vpll vector<pair<ll, ll>> #define repup(a, b, i) for (i = a; i <= b; i++) #define repdown(a, b, i) for (i = b; i >= a; i--) #define re...
#include <bits/stdc++.h> using namespace std; #define ll long long #define llinf 4e17 #define nllinf -4e18 #define vll vector<ll> #define sll set<ll> #define pll pair<ll, ll> #define vpll vector<pair<ll, ll>> #define repup(a, b, i) for (i = a; i <= b; i++) #define repdown(a, b, i) for (i = b; i >= a; i--) #define re...
replace
43
44
43
44
0
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) ll INF = 101010101010; int main() { int n, k; cin >> n >> k; vector<ll> h(n); vector<ll> dp(n); rep(i, n) cin >> h[i]; rep(i, n) dp[i] = INF; dp[0] = 0; for (int i = 1; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) ll INF = 101010101010; int main() { int n, k; cin >> n >> k; vector<ll> h(n); vector<ll> dp(n); rep(i, n) cin >> h[i]; rep(i, n) dp[i] = INF; dp[0] = 0; for (int i = 1; i < n; i++) ...
replace
17
19
17
19
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[1000000]; int ans(vector<int> &v, int n, int i, int k) { if (i == 0) return 0; if (dp[i] != -1) return dp[i]; int mn = INT_MAX; for (int j = i - 1; j >= i - k; j--) { int p = ans(v, n, j, k) + abs(v[j] - v[i]); mn = min(p, mn); } return dp...
#include <bits/stdc++.h> using namespace std; int dp[1000000]; int ans(vector<int> &v, int n, int i, int k) { if (i == 0) return 0; if (dp[i] != -1) return dp[i]; int mn = INT_MAX; for (int j = i - 1; j >= max(0, i - k); j--) { int p = ans(v, n, j, k) + abs(v[j] - v[i]); mn = min(p, mn); } r...
replace
9
10
9
10
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; int h[N]; int dp[N]; for (int i = 0; i < N; i++) { cin >> h[i]; dp[i] = INT_MAX; } dp[0] = 0; for (int i = 0; i < N; i++) { for (int k = 1; k <= K; k++) { if (dp[i + k] > dp[i] + abs(h[i] - h[i + k]...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; int h[N + K]; int dp[N + K]; for (int i = 0; i < N; i++) { cin >> h[i]; dp[i] = INT_MAX; } dp[0] = 0; for (int i = 0; i < N; i++) { for (int k = 1; k <= K; k++) { if (dp[i + k] > dp[i] + abs(h[i] - ...
replace
7
9
7
9
0
p03161
C++
Runtime Error
/* * Problem URL: https://atcoder.jp/contests/dp/tasks/dp_b */ #include <bits/stdc++.h> #include <cmath> #include <sstream> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORD(i, a, b) for (int i = (a - 1); i >= (b); i--) using namespace std; #define mp make_pair #define pb push_back #define ff first ...
/* * Problem URL: https://atcoder.jp/contests/dp/tasks/dp_b */ #include <bits/stdc++.h> #include <cmath> #include <sstream> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORD(i, a, b) for (int i = (a - 1); i >= (b); i--) using namespace std; #define mp make_pair #define pb push_back #define ff first ...
replace
35
38
35
37
0
p03161
C++
Runtime Error
// Resting_Prince #include <bits/stdc++.h> #define mod 1000000007 #define inf 1e18 #define PI 3.141592653589 #define fi first #define se second #define sv(v) \ sort(all(v)); \ reverse(all(...
// Resting_Prince #include <bits/stdc++.h> #define mod 1000000007 #define inf 1e18 #define PI 3.141592653589 #define fi first #define se second #define sv(v) \ sort(all(v)); \ reverse(all(...
replace
26
27
26
27
0
p03161
C++
Runtime Error
#include <algorithm> #include <climits> #include <cstring> #include <fstream> #include <iostream> #include <math.h> #include <unordered_map> #include <vector> using namespace std; #define ll long long #define w(x) \ int x; ...
#include <algorithm> #include <climits> #include <cstring> #include <fstream> #include <iostream> #include <math.h> #include <unordered_map> #include <vector> using namespace std; #define ll long long #define w(x) \ int x; ...
delete
39
47
39
39
-11
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int main() { int n; cin >> n; int k; cin >> k; vector<int> h(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; i++) { for (int j = i + 1; j <= i + k; j++) { i...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int main() { int n; cin >> n; int k; cin >> k; vector<int> h(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; i++) { for (int j = i + 1; j <= i + k; j++) { i...
replace
16
17
16
17
0
p03161
C++
Runtime Error
#include <algorithm> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, n) for (int i = 1; i <= (n); i++) #define J...
#include <algorithm> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, n) for (int i = 1; i <= (n); i++) #define J...
insert
33
33
33
35
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, n, m) for (int i = n; i < m; i++) #define ll long long int using namespace std; int main() { int n, k; int h[10005]; int dp[10005] = {}; cin >> n >> k; REP(i, n) { cin >> h[i]; } REP(i, n) { int result = 1110001110...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, n, m) for (int i = n; i < m; i++) #define ll long long int using namespace std; int main() { int n, k; int h[100000]; int dp[100000] = {}; cin >> n >> k; REP(i, n) { cin >> h[i]; } REP(i, n) { int result = 11100011...
replace
10
12
10
12
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define lli long long int #define uli unsigned long long int #define INF 99999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = m - 1; i >= n; i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(), N.end()), N.end())...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define uli unsigned long long int #define INF 99999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = m - 1; i >= n; i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(), N.end()), N.end())...
replace
31
32
31
32
0
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; const ll INF = 10e9; int solve(int n, int k, vector<int> h) { vector<int> dp(n, INF); dp[0] = 0; for (int i = 0; i < n; i++) { for (int j = 0; j <= i + k; j++) { if (j < n) { dp[j] ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; const ll INF = 10e9; int solve(int n, int k, vector<int> h) { vector<int> dp(n, INF); dp[0] = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j <= i + k; j++) { if (j < n) { dp...
replace
10
11
10
11
TLE
p03161
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
55
58
55
58
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long dp[10000]; int main(void) { int N, K; cin >> N >> K; long long h[N + 1]; for (int i = 1; i <= N; i++) cin >> h[i]; // 現在地から+1 +2 ..+Kまで移動することが出来る // dp[x]はxまでいくのにかかる最小のコスト // 初期コストのセット for (int i = 1; i <= K + 1; i++) { dp[i] = abs(h[1] - h...
#include <bits/stdc++.h> using namespace std; long long dp[100001]; int main(void) { int N, K; cin >> N >> K; long long h[N + 1]; for (int i = 1; i <= N; i++) cin >> h[i]; // 現在地から+1 +2 ..+Kまで移動することが出来る // dp[x]はxまでいくのにかかる最小のコスト // 初期コストのセット for (int i = 1; i <= K + 1; i++) { dp[i] = abs(h[1] - ...
replace
2
3
2
3
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using VI = vector<ll>; using VD = vector<ld>; using VVI = vector<VI>; using VC = vector<char>; using VVC = vector<VC>; using VS = vector<string>; using PLL = pair<ll, ll>; using PLD = pair<ld, ld>; using VPLL = vector<PLL>; ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using VI = vector<ll>; using VD = vector<ld>; using VVI = vector<VI>; using VC = vector<char>; using VVC = vector<VC>; using VS = vector<string>; using PLL = pair<ll, ll>; using PLD = pair<ld, ld>; using VPLL = vector<PLL>; ...
replace
84
85
84
85
0
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long const long long INF = 10000000000; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } ret...
#include <bits/stdc++.h> using namespace std; #define int long long const long long INF = 10000000000; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } ret...
insert
32
32
32
34
0
p03161
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define pb push_back #define all(v) v.begin(), v.end() #define mp make_pair #define ff first #define ss second #define MAXN 1000005 #define endl "\n" using namespace std; vector<ll> v; ll dp[100003]; ll a, n, k; ll rec(int i) { if (i == n - 1) return 0; ll ans = LLO...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define all(v) v.begin(), v.end() #define mp make_pair #define ff first #define ss second #define MAXN 1000005 #define endl "\n" using namespace std; vector<ll> v; ll dp[100003]; ll a, n, k; ll rec(int i) { if (i == n - 1) return 0; if (dp[i] !=...
insert
16
16
16
18
TLE
p03161
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k, t; cin >> n >> k; vector<int> input(n, 0); vector<int> score(n, 0); for (int i = 0; i < n; i++) { cin >> t; input[i] = t; } for (int i = 1; i < k; i++) { t = INT_MAX; for (int j = 1; j <= i; j++) { t = min(t, a...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, t; cin >> n >> k; vector<int> input(n, 0); vector<int> score(n, 0); for (int i = 0; i < n; i++) { cin >> t; input[i] = t; } for (int i = 1; i < k && i < n; i++) { t = INT_MAX; for (int j = 1; j <= i; j++) { t =...
replace
16
17
16
17
0