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;
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define int long ... | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define int long ... | delete | 84 | 88 | 84 | 84 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
typedef pair<int, int> P;
int dp[10000] = {}, h[100001] = {};
int main() {
int n, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> h[i];
if (i == 0)
dp[i] = 0;
else if (i == 1)
... | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
typedef pair<int, int> P;
int dp[100001] = {}, h[100001] = {};
int main() {
int n, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> h[i];
if (i == 0)
dp[i] = 0;
else if (i == 1)
... | replace | 7 | 8 | 7 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define mod 1000000007
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define T(a) ... | #include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define mod 1000000007
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define T(a) ... | replace | 144 | 146 | 144 | 150 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
int h[10000];
int dp[10000];
for (i = 0; i < n; i++)
cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (i = 2; i < n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
vector<int> h;
h.resize(n);
vector<int> dp(n);
for (i = 0; i < n; i++)
cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[0] - h[1]);
for (i = 2; i < n; i++) {
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + a... | replace | 5 | 7 | 5 | 8 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define ft first
#define sc second
#define ppb pop_back
#define sz size
#define forn(i, a, n) for (i = a; i < n; i++)
#define M 1000000007
#define inf 2e18
int main() {
#ifndef ONLINE_JUDGE
freopen("inpu... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define ft first
#define sc second
#define ppb pop_back
#define sz size
#define forn(i, a, n) for (i = a; i < n; i++)
#define M 1000000007
#define inf 2e18
int main() {
ios_base::sync_with_stdio(false);
... | delete | 15 | 19 | 15 | 15 | -11 | |
p03160 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
const long long INF = 1LL << 60;
using namespace std;
int main() {
int N;
cin >> N;
vector<int> h(N);
for (int i = 0; i < N; i++) {
cin >> h.at(i);
}
long long dp[10010];
for (int i = 0; i < ... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
const long long INF = 1LL << 60;
using namespace std;
int main() {
int N;
cin >> N;
vector<int> h(N);
for (int i = 0; i < N; i++) {
cin >> h.at(i);
}
long long dp[100100];
for (int i = 0; i <... | replace | 16 | 18 | 16 | 18 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vi>
#define forr(i, k, n) for (int i = k; i < n; i++)
#define iforr(i, k, n) for (int i = n - 1; i >= k; i--)
#define rep(i, n) forr(i, 0, n)
#define irep(i, n) iforr(i, 0, n)
#define aut(i, arr) for (auto &i : arr)
#define all(arr) arr.begin(), arr.end... | #include <bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vi>
#define forr(i, k, n) for (int i = k; i < n; i++)
#define iforr(i, k, n) for (int i = n - 1; i >= k; i--)
#define rep(i, n) forr(i, 0, n)
#define irep(i, n) iforr(i, 0, n)
#define aut(i, arr) for (auto &i : arr)
#define all(arr) arr.begin(), arr.end... | replace | 37 | 38 | 37 | 38 | -6 | terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
|
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int h[10000];
int dp[100000];
int main() {
int N;
cin >> N;
copy_n(istream_iterator<int>(cin), N, h);
memset(dp, N, 99999);
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; ++i)
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] +... | #include <bits/stdc++.h>
using namespace std;
int h[100000];
int dp[100000];
int main() {
int N;
cin >> N;
copy_n(istream_iterator<int>(cin), N, h);
memset(dp, N, 99999);
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; ++i)
dp[i] =
min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define ve vector
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define ve vector
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ... | delete | 27 | 34 | 27 | 27 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
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;
cin >> n;
ll a[n];
for (i = 0; i < n; i++)
cin >> a[i];
l... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll i, n;
cin >> n;
ll a[n];
for (i = 0; i < n; i++)
cin >> a[i];
ll dp[n];
dp[0] = 0;
for (i = 1; i < n; i++) {
if (i >= 2)
dp[i] = min(dp[i - 1] + abs(a[... | delete | 6 | 10 | 6 | 6 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cer... | #include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cer... | replace | 70 | 75 | 70 | 75 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define mod 1000000007
#de... | #include <bits/stdc++.h>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define mod 1000000007
#de... | delete | 26 | 32 | 26 | 26 | -11 | |
p03160 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define bac(i, a, b) for (ll i = b - 1; i <= a; i--)
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define mod 1000000007
vi v(100000, -1);
int result(vi ve, int indx, int size) {
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define bac(i, a, b) for (ll i = b - 1; i <= a; i--)
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define mod 1000000007
vi v(100000, -1);
int result(vi &ve, int indx, int size) {
... | replace | 13 | 14 | 13 | 14 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long int
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define FORD(i, a, ... | #include <bits/stdc++.h>
#define int long long int
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define FORD(i, a, ... | delete | 18 | 25 | 18 | 18 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define PB push_back
#define F fir... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define PB push_back
#define F fir... | replace | 34 | 36 | 34 | 36 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | #include <bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | replace | 15 | 19 | 15 | 21 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define vi vector<ll>
const int INF = 1e9;
const int N = 100005;
vi h(N, 0);
vi dp(N, 0);
void solve()... | #include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define vi vector<ll>
const int INF = 1e9;
const int N = 100005;
vi h(N, 0);
vi dp(N, 0);
void solve()... | replace | 31 | 39 | 31 | 39 | TLE | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<ll>
#define sz(x) ((int)(x).size())
#define pll pair<long long, long long>
#define mp make_pair
#define F first
#define S second
#define T ... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<ll>
#define sz(x) ((int)(x).size())
#define pll pair<long long, long long>
#define mp make_pair
#define F first
#define S second
#define T ... | delete | 40 | 45 | 40 | 40 | 0 |
Time elapsed: 34ms
|
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 MOD 1000000007
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define mi map<int, int>
#define umi unordered_map<int, int>
#define pii pair<int, in... | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define mi map<int, int>
#define umi unordered_map<int, int>
#define pii pair<int, in... | replace | 30 | 32 | 30 | 31 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<int> h(N);
for (int i = 0; i < N; i++)
cin >> h[i];
vector<int> dp(100, 0);
dp[0] = 0;
dp[1] = dp[0] + abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
dp[i] +=
min(dp[i - 1] + abs... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<int> h(N);
for (int i = 0; i < N; i++)
cin >> h[i];
vector<int> dp(100'000, 0);
dp[0] = 0;
dp[1] = dp[0] + abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
dp[i] +=
min(dp[i - 1] +... | replace | 12 | 13 | 12 | 13 | 0 | |
p03160 | C++ | Runtime Error | // Main maut ko takiya, aur kafan ko chaadar banakar audhta hoon!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
#d... | // Main maut ko takiya, aur kafan ko chaadar banakar audhta hoon!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
#d... | replace | 136 | 141 | 136 | 141 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#define pb push_back
#define rep(a, b, c) for (int a = (int)b; a < (int)c; a++)
#define repk(a, b, c, k) for (int a = (int)b; a < (int)c; a += (int)k)
#define comeback \
std::ios_base::sync_with_stdio(false); ... | #include <bits/stdc++.h>
#define pb push_back
#define rep(a, b, c) for (int a = (int)b; a < (int)c; a++)
#define repk(a, b, c, k) for (int a = (int)b; a < (int)c; a += (int)k)
#define comeback \
std::ios_base::sync_with_stdio(false); ... | replace | 27 | 32 | 27 | 33 | -11 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int dp[100009], h[100009];
int i, j, n;
cin >> n;
for (i = 0; i < n; i++)
cin >> h[i];
dp[0] = 0;
if (n >= 2)
dp[1] = abs(h[1] - h[0]);
for (i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i... | #include <bits/stdc++.h>
using namespace std;
int main() {
int dp[100009], h[100009];
int i, j, n;
cin >> n;
for (i = 0; i < n; i++)
cin >> h[i];
dp[0] = 0;
if (n >= 2)
dp[1] = abs(h[1] - h[0]);
for (i = 2; i < n; i++) {
dp[i] =
min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i... | replace | 15 | 16 | 15 | 16 | 30 | |
p03160 | C++ | Runtime Error | // AnkitCode99 here....
#include <bits/stdc++.h>
#define endl "\n"
typedef long long int ll;
#define MOD 1000000007
#define mp make_pair
#define pll pair<ll, ll>
#define pb push_back
// max xor btw range of two numbers..
#define max_XOR(a, b) (1 << int(log2(a ^ b) + 1)) - 1
#define vl vector<ll>
#define inf ll(1e18)
#d... | // AnkitCode99 here....
#include <bits/stdc++.h>
#define endl "\n"
typedef long long int ll;
#define MOD 1000000007
#define mp make_pair
#define pll pair<ll, ll>
#define pb push_back
// max xor btw range of two numbers..
#define max_XOR(a, b) (1 << int(log2(a ^ b) + 1)) - 1
#define vl vector<ll>
#define inf ll(1e18)
#d... | delete | 47 | 51 | 47 | 47 | 0 | |
p03160 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;
int main() {
ios_base::sync_with_stdio(fa... | #include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;
int main() {
ios_base::sync_with_stdio(fa... | replace | 14 | 18 | 14 | 15 | -11 | |
p03161 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespac... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespac... | replace | 43 | 48 | 43 | 46 | -11 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define MAX 100005
using namespace std;
const int INF = 1e9 + 5;
ll arr[MAX];
vector<ll> dp(MAX, INF);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> arr[i];
dp[1] = 0;
dp[2] = ... | #include <bits/stdc++.h>
#define ll long long
#define MAX 100005
using namespace std;
const int INF = 1e9 + 5;
ll arr[MAX];
vector<ll> dp(MAX, INF);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> arr[i];
dp[1] = 0;
dp[2] = ... | replace | 20 | 23 | 20 | 25 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
int _min;
cin >> n >> k;
vector<int> h(n);
vector<int> dp(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
};
if (n <= k + 1) {
cout << abs(h.at(n - 1) - h.at(0)) << endl;
exit(1);
};
for (int i = 0; i <= k; i++) {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
int _min;
cin >> n >> k;
vector<int> h(n);
vector<int> dp(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
};
if (n <= k + 1) {
cout << abs(h.at(n - 1) - h.at(0)) << endl;
} else {
for (int i = 0; i <= k; i++) {
... | replace | 15 | 29 | 15 | 28 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for... | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for... | replace | 35 | 36 | 35 | 36 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define pb push_back
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define deb(x) cout << #x << "="... | #include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define pb push_back
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define deb(x) cout << #x << "="... | replace | 53 | 54 | 53 | 54 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define int long long
#define sz(c) c.size()
#define fr first
#define sc second
#define pb push_back
#define sz(c) c.size()
#define ppb pop_back
#define all(a) (a).begin(), (a).end()
#define rep(i, a, n) for (int i = a; i < n; i++)
#define U 1000000007
#define N 100005
#de... | #include <bits/stdc++.h>
#define ll long long
#define int long long
#define sz(c) c.size()
#define fr first
#define sc second
#define pb push_back
#define sz(c) c.size()
#define ppb pop_back
#define all(a) (a).begin(), (a).end()
#define rep(i, a, n) for (int i = a; i < n; i++)
#define U 1000000007
#define N 100005
#de... | replace | 28 | 30 | 28 | 32 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) for (int i = 0; i < n; i++)
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) ... | #include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) for (int i = 0; i < n; i++)
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) ... | replace | 28 | 29 | 28 | 29 | 0 | |
p03161 | C++ | Runtime Error | #include <iostream>
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;
}
using namespace std;
const int INF = 1e9;
int main() {
int N, K;
... | #include <iostream>
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;
}
using namespace std;
const int INF = 1e9;
int main() {
int N, K;
... | replace | 26 | 27 | 26 | 27 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int N, K;
int H[100005];
int dp[100001];
int main() {
cin >> N >> K;
H[0] = INT32_MAX; // to avoid RTE
for (int i = 1; i <= N; i++)
cin >> H[i];
for (int i = 0; i <= N; i++)
dp[i] = INT32_MAX;
int ans = 0;
dp[N] = 0;... | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int N, K;
int H[100005];
int dp[100001];
int main() {
cin >> N >> K;
H[0] = INT32_MAX; // to avoid RTE
for (int i = 1; i <= N; i++)
cin >> H[i];
for (int i = 0; i <= N; i++)
dp[i] = INT32_MAX;
int ans = 0;
dp[N] = 0;... | insert | 25 | 25 | 25 | 27 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
// your code goes here
ll n, k;
cin >> n;
cin >> k;
ll arr[100001], dp[100001], i, ans;
for (i = 0; i < n; i++) {
cin >> arr[i];
}
dp[0] = 0;
for (i = 1; i < 100001; i++) {
dp[i] = 1e9;
}
for (i = 0; i < n... | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
// your code goes here
ll n, k;
cin >> n;
cin >> k;
ll arr[100001], dp[10000001], i, ans;
for (i = 0; i < n; i++) {
cin >> arr[i];
}
dp[0] = 0;
for (i = 1; i < 100001; i++) {
dp[i] = 1e9;
}
for (i = 0; i <... | replace | 9 | 10 | 9 | 10 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
cin >> n >> k;
int array[n];
for (int x = 0; x < n; x++) {
cin >> array[x];
}
int dp[n];
dp[0] = 0;
for (int x = 0; x <= k; x++) {
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
cin >> n >> k;
int array[n];
for (int x = 0; x < n; x++) {
cin >> array[x];
}
int dp[n];
dp[0] = 0;
for (int x = 0; x <= k && x < n; x... | replace | 16 | 17 | 16 | 17 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
int k;
cin >> k;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
vector<int> dp(n, INT_MAX);
dp[0] = 0;
dp[1] = abs(arr[1] - arr[0]);
for (int i = 2; i < n; i++) {
for (int j = 1; j <= k; j++) {... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
int k;
cin >> k;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
vector<int> dp(n, INT_MAX);
dp[0] = 0;
dp[1] = abs(arr[1] - arr[0]);
for (int i = 2; i < n; i++) {
for (int j = 1; j <= k; j++) {... | replace | 18 | 19 | 18 | 19 | 0 | |
p03161 | C++ | Runtime Error |
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(), (v).end()
#define pb push_back
ll power(ll a, ll b) { // a^b
ll res = 1;
while (b > 0) {
if (b & 1) {
res = (res * a);
b--;... |
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(), (v).end()
#define pb push_back
ll power(ll a, ll b) { // a^b
ll res = 1;
while (b > 0) {
if (b & 1) {
res = (res * a);
b--;... | replace | 36 | 37 | 36 | 37 | 0 | |
p03161 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
struct _ {
ios_base::Init i;
_() {
cin.sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(10);
}
} ___;
#define trace(...) __f(#... | #include "bits/stdc++.h"
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
struct _ {
ios_base::Init i;
_() {
cin.sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(10);
}
} ___;
#define trace(...) __f(#... | replace | 57 | 61 | 57 | 61 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()
const long long INF ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()
const long long INF ... | replace | 33 | 35 | 33 | 35 | 0 | |
p03161 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
const int INF = 1e9 + 5;
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> c(n);
for (int &x : c)
cin >> x;
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= i + k; +... | #include <bits/stdc++.h>
const int INF = 1e9 + 5;
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> c(n);
for (int &x : c)
cin >> x;
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= i + k; +... | replace | 14 | 15 | 14 | 15 | TLE | |
p03161 | C++ | Runtime Error | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int dy[4] = {-1, 0, +1, 0};
int dx[4] = {0, +1, 0, -1};
const long long INF = 1LL << 60;
bool greaterSecond(const pair<int,... | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int dy[4] = {-1, 0, +1, 0};
int dx[4] = {0, +1, 0, -1};
const long long INF = 1LL << 60;
bool greaterSecond(const pair<int,... | replace | 36 | 38 | 36 | 38 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define tc \
int t; \
cin >> t; ... | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define tc \
int t; \
cin >> t; ... | insert | 29 | 29 | 29 | 31 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000000;
// long long
using ll = long long;
// 出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// be... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000000;
// long long
using ll = long long;
// 出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// be... | insert | 63 | 63 | 63 | 65 | 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> dp(N, 1e9 + 7);
dp[0] = 0;
for (int i = 1; i < N; i++) {
for (int j = 1; j < K + 1; j++) {
if (j - i < 0)
break;
... | #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> dp(N, 1e9 + 7);
dp[0] = 0;
for (int i = 1; i < N; i++) {
for (int j = 1; j < K + 1; j++) {
if (i - j < 0)
break;
... | replace | 17 | 18 | 17 | 18 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int dp[100'000 + 5]; /// dp[i] = min cost to get from 0 to i
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
vector<int> input(n);
for (int i = 0; i < n; i++)
cin >> input[i];
dp[0] = 0;
for (int i = 1; ... | #include <bits/stdc++.h>
using namespace std;
int dp[100'000 + 5]; /// dp[i] = min cost to get from 0 to i
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
vector<int> input(n);
for (int i = 0; i < n; i++)
cin >> input[i];
dp[0] = 0;
for (int i = 1; ... | replace | 22 | 23 | 22 | 23 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
#define pb p... | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
#define pb p... | replace | 83 | 87 | 83 | 84 | 0 | |
p03161 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
temp... | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for (ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
temp... | replace | 39 | 42 | 39 | 40 | TLE | |
p03161 | C++ | Runtime Error | // https://atcoder.jp/contests/dp/tasks/dp_b
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PL... | // https://atcoder.jp/contests/dp/tasks/dp_b
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PL... | replace | 48 | 49 | 48 | 49 | 0 | |
p03161 | C++ | Runtime Error | #include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int num;
int jump;
cin >> num >> jump;
vector<int> v;
int... | #include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int num;
int jump;
cin >> num >> jump;
vector<int> v;
int... | replace | 27 | 28 | 27 | 28 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
int main() {
int N, K;
cin >> N >> K;
vector<int> dp(N), c(N);
rep(i, 0, N) cin >> c[i];
dp[0] = 0;
rep(i, 1, K) dp[i] = abs(c[0] - c[i]);
rep(i, K, N) {
dp[i] = dp[i - 1] + abs(c[i - 1] - c[i]... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
int main() {
int N, K;
cin >> N >> K;
vector<int> dp(100005), c(N);
rep(i, 0, N) cin >> c[i];
dp[0] = 0;
rep(i, 1, K) dp[i] = abs(c[0] - c[i]);
rep(i, K, N) {
dp[i] = dp[i - 1] + abs(c[i - 1] -... | replace | 6 | 7 | 6 | 7 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
// c++ templte for
// help............................................................................................................................................
typedef long long ll;
// template<typename... T>
// void print1(T... t){
//((cout<<t<<" "),...);
//}
//... | #include <bits/stdc++.h>
using namespace std;
// c++ templte for
// help............................................................................................................................................
typedef long long ll;
// template<typename... T>
// void print1(T... t){
//((cout<<t<<" "),...);
//}
//... | replace | 69 | 70 | 69 | 70 | 0 | |
p03161 | C++ | Runtime Error | /* Author : Harshit Jain a.k.a. iharshit009 */
#include <bits/stdc++.h>
#define vi vector<int>
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x), greater<int>())
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define int long long
#defin... | /* Author : Harshit Jain a.k.a. iharshit009 */
#include <bits/stdc++.h>
#define vi vector<int>
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x), greater<int>())
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define int long long
#defin... | replace | 34 | 35 | 34 | 37 | 0 | Time taken by function: 1170 milliseconds
|
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;
const int INF = 1001001001;
int main() {
int n, k;
cin >> n >> k;
vector<int> h(n);
rep(i, n) cin >> h[i];
vector<int> dp(n + 1, INF);
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i <= n; ++i)... | #include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;
const int INF = 1001001001;
int main() {
int n, k;
cin >> n >> k;
vector<int> h(n);
rep(i, n) cin >> h[i];
vector<int> dp(n + 1, INF);
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i <= n; ++i)... | replace | 19 | 20 | 19 | 23 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N, K;
cin >> N >> K;
vector<ll> h(N);
vector<ll> dp(10000, 1000000000);
for (int i = 0; i < N; i++)
cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
for (int j = 1; j <= K; j++... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N, K;
cin >> N >> K;
vector<ll> h(N);
vector<ll> dp(100000, 1000000000);
for (int i = 0; i < N; i++)
cin >> h[i];
dp[0] = 0;
dp[1] = abs(h[1] - h[0]);
for (int i = 2; i < N; i++) {
for (int j = 1; j <= K; j+... | replace | 10 | 11 | 10 | 11 | 0 | |
p03161 | C++ | Runtime Error | // #############################################################################
//----------------------------Karma is Real------------------------------------
#include "bits/stdc++.h"
// #############################################################################
// Macros
#define MOD 1000000007
#define eb emplace_b... | // #############################################################################
//----------------------------Karma is Real------------------------------------
#include "bits/stdc++.h"
// #############################################################################
// Macros
#define MOD 1000000007
#define eb emplace_b... | delete | 23 | 27 | 23 | 23 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03161 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<ll>
#define sz(x) ((int)(x).size())
#define pll pair<long long, long long>
#define mp make_pair
#define F first
#define S second
#define T ... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<ll>
#define sz(x) ((int)(x).size())
#define pll pair<long long, long long>
#define mp make_pair
#define F first
#define S second
#define T ... | replace | 47 | 48 | 47 | 48 | TLE | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int b[n];
memset(b, 0x3f, 4 * n);
... | #include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int b[n];
memset(b, 0x3f, 4 * n);
... | replace | 18 | 19 | 18 | 19 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define vi vector<ll>
const int INF = 1e9;
const int N = 100005;
vi h(N, 0);
vi dp(N, INF);
void solve... | #include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define vi vector<ll>
const int INF = 1e9;
const int N = 100005;
vi h(N, 0);
vi dp(N, INF);
void solve... | replace | 32 | 40 | 32 | 40 | TLE | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dp(ll i, ll k);
int n, k;
vector<ll> ans(10010, 0);
vector<ll> field(10010, 0);
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> field.at(i);
}
ans.at(0) = 0;
ans.at(1) = abs(field.at(1) - field.at(0));
for (int... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dp(ll i, ll k);
int n, k;
vector<ll> ans(100010, 0);
vector<ll> field(100010, 0);
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> field.at(i);
}
ans.at(0) = 0;
ans.at(1) = abs(field.at(1) - field.at(0));
for (i... | replace | 8 | 10 | 8 | 10 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, K;
cin >> N >> K;
std::vector<int> v(N);
for (int i = 0; i < N; i++)
cin >> v[i];
std::vector<int> dp(N * 2, 1e9);
dp[0] = 0;
for (int i = 0; i < N; i++)
for (int j = 0; j < K; j++)
dp[i + j + 1] = mi... | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, K;
cin >> N >> K;
std::vector<int> v(N * 2, 1e9);
for (int i = 0; i < N; i++)
cin >> v[i];
std::vector<int> dp(N * 2, 1e9);
dp[0] = 0;
for (int i = 0; i < N; i++)
for (int j = 0; j < K; j++)
dp[i + j ... | replace | 7 | 8 | 7 | 8 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repA(i, a, n) for (int i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb p... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repA(i, a, n) for (int i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb p... | replace | 25 | 29 | 25 | 29 | -6 | terminate called after throwing an instance of 'std::__ios_failure'
what(): basic_ios::clear: iostream error
|
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define loop1(x, s, e) for (int x = s; x != e; x += 1 - 2 * (s > e))
#define input_matrix(a, m, n) \
for (int i = 0; i < m; i++) \
... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define loop1(x, s, e) for (int x = s; x != e; x += 1 - 2 * (s > e))
#define input_matrix(a, m, n) \
for (int i = 0; i < m; i++) \
... | replace | 32 | 34 | 32 | 34 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using indexed_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(v) ((v).begin()),... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using indexed_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(v) ((v).begin()),... | replace | 32 | 34 | 32 | 34 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define w(x) \
int x; \
cin >> x; ... | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define w(x) \
int x; \
cin >> x; ... | delete | 72 | 77 | 72 | 72 | -11 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define INF (int)(1e9)
// Relevant constraints
// 2 <= N <= 10^5
// 1 <= K <= 100
// 2 secs
// Generalized version of frog1
// to K possible steps instead of 2
// Naturally, this turns the complexity
// required from O(n) to O(nK)
// This is acceptable for our constrain... | #include <bits/stdc++.h>
using namespace std;
#define INF (int)(1e9)
// Relevant constraints
// 2 <= N <= 10^5
// 1 <= K <= 100
// 2 secs
// Generalized version of frog1
// to K possible steps instead of 2
// Naturally, this turns the complexity
// required from O(n) to O(nK)
// This is acceptable for our constrain... | insert | 35 | 35 | 35 | 38 | 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> dp(n + 1, 1e9 + 5);
dp[1] = 0;
for (int i = 1; i < n + 1; i++) {
for (auto j = i + 1; j < i + k + 1; i++) {
if (j <= n) {
... | #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> dp(n + 1, 1e9 + 5);
dp[1] = 0;
for (int i = 1; i < n + 1; i++) {
for (auto j = i + 1; j < i + k + 1; j++) {
if (j <= n) {
... | replace | 12 | 13 | 12 | 13 | -11 | |
p03161 | C++ | Runtime Error | #include <iostream>
using namespace std;
int climb_dp(int *h, int n, int k) {
int dp[n];
// Initialise states
dp[0] = 0;
for (int j = 1; j <= k; j++)
dp[j] = abs(h[j] - h[0]);
// Calculate the most optimal state for i
// building upon previous optimal states
for (int i = 2; i < n; i++) {
int mi... | #include <iostream>
using namespace std;
int climb_dp(int *h, int n, int k) {
int dp[n];
// Initialise states
dp[0] = 0;
for (int j = 1; j <= k; j++)
dp[j] = abs(h[j] - h[0]);
// Calculate the most optimal state for i
// building upon previous optimal states
for (int i = 2; i < n; i++) {
int mi... | insert | 28 | 28 | 28 | 31 | 0 | |
p03161 | C++ | Runtime Error | #include <climits>
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n;
cin >> k;
int h[n];
int dp[n];
dp[0] = 0;
for (int i = 0; i < n; i++) {
cin >> h[i];
if (i == 0)
dp[0] = 0;
else
dp[i] = INT_MAX;
}
for (int i = 0; i < n; i++) {
for (int j = 1; j... | #include <climits>
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n;
cin >> k;
int h[n];
int dp[n];
dp[0] = 0;
for (int i = 0; i < n; i++) {
cin >> h[i];
if (i == 0)
dp[0] = 0;
else
dp[i] = INT_MAX;
}
for (int i = 0; i < n; i++) {
for (int j = 1; j... | replace | 20 | 21 | 20 | 21 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define INF 1e9 + 5
int main() {
int n, k;
cin >> n >> k;
vector<int> hights(n + 1, 0);
for (int i = 1; i <= n; i++) {
cin >> hights[i];
}
vector<int> dp(n + 1, INF);
dp[1] = 0;
for (int i = 2; i <= n; i++) {
for (int j = i - k; j <= i - 1; j++) {
... | #include <bits/stdc++.h>
using namespace std;
#define INF 1e9 + 5
int main() {
int n, k;
cin >> n >> k;
vector<int> hights(n + 1, 0);
for (int i = 1; i <= n; i++) {
cin >> hights[i];
}
vector<int> dp(n + 1, INF);
dp[1] = 0;
for (int i = 2; i <= n; i++) {
for (int j = i - 1; j >= max(1, i - k);... | replace | 15 | 16 | 15 | 16 | 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);
for (ll i = 0; i < n; i++)
cin >> v[i];
vector<ll> ans(n);
ans[0] = 0;
for (ll i = 1; i < n; i++) {
ans[i] = ans[i - 1] + abs(v[i] - v[i - 1]);
for (ll j = 1; j <= k; j... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> v(n);
for (ll i = 0; i < n; i++)
cin >> v[i];
vector<ll> ans(n);
ans[0] = 0;
for (ll i = 1; i < n; i++) {
ans[i] = ans[i - 1] + abs(v[i] - v[i - 1]);
for (ll j = 1; j <= k &&... | replace | 17 | 18 | 17 | 18 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define lc "\n"
#define fast_io \
ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0)
#... | #include <bits/stdc++.h>
using namespace std;
#define lc "\n"
#define fast_io \
ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0)
#... | replace | 43 | 44 | 43 | 44 | 0 | |
p03161 | C++ | Runtime Error | #include "bits/stdc++.h"
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
const int MAXN = 1e5 + 10;
const int INF = 2 * 1e9;
int dp[MAXN];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin... | #include "bits/stdc++.h"
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
const int MAXN = 1e5 + 10;
const int INF = 2 * 1e9;
int dp[MAXN];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin... | replace | 23 | 24 | 23 | 24 | 0 | |
p03161 | C++ | Time Limit Exceeded | // #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int, null_type, less<int>, rb_tree_tag,
t... | // #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int, null_type, less<int>, rb_tree_tag,
t... | replace | 41 | 45 | 41 | 43 | TLE | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
int main() {
int n, k;
cin >> n >> k;
vector<int> h(100100);
rep(i, n) cin >> h[i];
vector<int> dp(100100, INF);
dp[0] = 0;
for (int i = 1; i < n; i++) {
fo... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
int main() {
int n, k;
cin >> n >> k;
vector<int> h(100100);
rep(i, n) cin >> h[i];
vector<int> dp(100100, INF);
dp[0] = 0;
for (int i = 1; i < n; i++) {
fo... | replace | 16 | 17 | 16 | 19 | 0 | |
p03161 | C++ | Runtime Error | /*------U Have To DO It------*/
/* BY-> RicoProg */
/* ___
__|__|
| |___ */
#include <bits/stdc++.h>
using namespace std;
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define beg(i, n) for (... | /*------U Have To DO It------*/
/* BY-> RicoProg */
/* ___
__|__|
| |___ */
#include <bits/stdc++.h>
using namespace std;
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define beg(i, n) for (... | replace | 43 | 44 | 43 | 47 | 0 | |
p03161 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int h[100005], k;
vector<int> mem(100005, -1);
int dp(int n);
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> h[i];
}
cout <<... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int h[100005], k;
vector<int> mem(100005, -1);
int dp(int n);
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> h[i];
}
cout <<... | replace | 30 | 31 | 30 | 31 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
#define fi first
#define se second
set<string> c;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll inf = 100000000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
#define fi first
#define se second
set<string> c;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll inf = 100000000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(... | replace | 13 | 14 | 13 | 14 | 0 | |
p03161 | C++ | Runtime Error | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> height(n);
for (int i = 0; i < n; i++)
cin >> height[i];
vector<int> minCost(n);
minCost[0] = 0;
minCost[1] = abs(height[0] - height[1]);
for (int i = 2; i < n; i++) {
... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> height(n);
for (int i = 0; i < n; i++)
cin >> height[i];
vector<int> minCost(n);
minCost[0] = 0;
minCost[1] = abs(height[0] - height[1]);
for (int i = 2; i < n; i++) {
... | replace | 17 | 18 | 17 | 18 | 0 | |
p03161 | C++ | Time Limit Exceeded | #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];
}
const int INF = 1e9 + 10;
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j <= min(n - 1, i + k); j++) {
d... | #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];
}
const int INF = 1e9 + 10;
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= min(n - 1, i + k); j++) {
... | replace | 15 | 16 | 15 | 16 | TLE | |
p03161 | C++ | Runtime Error | // Author - Sumit
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ps push
#define pb push_back
#define INF 1000000005
#define MOD 1000000007
#define mp make_pair
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define all(v)... | // Author - Sumit
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ps push
#define pb push_back
#define INF 1000000005
#define MOD 1000000007
#define mp make_pair
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define all(v)... | delete | 62 | 67 | 62 | 62 | -11 | |
p03161 | C++ | Time Limit Exceeded | /*राधे कृष्णा*/ /*राधे कृष्णा*/ /*राधे कृष्णा*/ /*राधे कृष्णा*/
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <string>
#include <vector>
using namespace std;
#define fastio ... | /*राधे कृष्णा*/ /*राधे कृष्णा*/ /*राधे कृष्णा*/ /*राधे कृष्णा*/
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <string>
#include <vector>
using namespace std;
#define fastio ... | replace | 44 | 47 | 44 | 47 | TLE | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void cc_env() {
#ifndef ONLINE_JUDGE
freopen("input", "r", stdin);
freopen("output", "w", stdout);
//
#endif
}
void self_min(int &a, int b) { a = min(a, b); }
int main() {
cc_env();
int n, k;
cin >> n >> k;
vector<int> height(n);
for (int i = 0; i < n; i+... | #include <bits/stdc++.h>
using namespace std;
void cc_env() {
#ifndef ONLINE_JUDGE
freopen("input", "r", stdin);
freopen("output", "w", stdout);
//
#endif
}
void self_min(int &a, int b) { a = min(a, b); }
int main() {
// cc_env();
int n, k;
cin >> n >> k;
vector<int> height(n);
for (int i = 0; i < n;... | replace | 14 | 15 | 14 | 15 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, k;
vector<ll> arr, dp;
void init() {
for (ll i = 0; i < n; i++)
dp[i] = -1;
}
ll solve(ll i) {
if (dp[i] != -1)
return dp[i];
if (i <= 0)
return 0;
else {
ll z = 1000000000;
for (ll j = 1; j <= k; j++) {
z = ... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, k;
vector<ll> arr, dp;
void init() {
for (ll i = 0; i < n; i++)
dp[i] = -1;
}
ll solve(ll i) {
if (dp[i] != -1)
return dp[i];
if (i <= 0)
return 0;
else {
ll z = 1000000000;
for (ll j = 1; j <= k; j++) {
if (... | replace | 22 | 23 | 22 | 24 | 0 | |
p03161 | C++ | Runtime Error | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long ... | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long ... | replace | 31 | 33 | 31 | 33 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int N, K;
cin >> N >> K;
int h[10000];
ll dp[10000];
for (int i = 0; i < N; i++)
cin >> h[i];
dp[0] = 0;
for (int i = 1; i < N; i++) {
dp[i] = INT64_MAX;
for (int j = 1; (i - j) >... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int N, K;
cin >> N >> K;
int h[100000];
ll dp[100000];
for (int i = 0; i < N; i++)
cin >> h[i];
dp[0] = 0;
for (int i = 1; i < N; i++) {
dp[i] = INT64_MAX;
for (int j = 1; (i - j)... | replace | 9 | 11 | 9 | 11 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl '\n'
#define h... | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl '\n'
#define h... | replace | 37 | 43 | 37 | 38 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, x, n) for (ll i = x; i <= n; ++i)
#define REP(i, x) for (ll i = 0; i < x; ++i)
#define FORD(i, x, n) for (ll i = x; i >= n; --i)
const int INF = 1e9;
ll n;
ll h[2 * (10 ^ 5)];
ll k;
int main() {
cin >> n >> k;
FOR(i, 1, n) cin >> h... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, x, n) for (ll i = x; i <= n; ++i)
#define REP(i, x) for (ll i = 0; i < x; ++i)
#define FORD(i, x, n) for (ll i = x; i >= n; --i)
const int INF = 1e9;
ll n;
vector<ll> h(2000000);
ll k;
int main() {
cin >> n >> k;
FOR(i, 1, n) cin >... | replace | 10 | 11 | 10 | 11 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll, ll>
#define mod 1000000007
#define pll pair<ll, ll>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define rep1(i, n) fo... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll, ll>
#define mod 1000000007
#define pll pair<ll, ll>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define rep1(i, n) fo... | replace | 59 | 62 | 59 | 64 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;... | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;... | insert | 39 | 39 | 39 | 41 | 0 | |
p03161 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#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(x) (x).begin(), (x).end() // 昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ... | #include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#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(x) (x).begin(), (x).end() // 昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ... | replace | 31 | 37 | 31 | 37 | TLE | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long int>
#define vC vector<char>
#define FastIO \
ios::sync_with_stdio(false); ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long int>
#define vC vector<char>
#define FastIO \
ios::sync_with_stdio(false); ... | replace | 31 | 32 | 31 | 32 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios::sync_with_stdio(false); \
cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x)) + 1
#define mod 1000000007
#define L_MAX 1e18... | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios::sync_with_stdio(false); \
cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x)) + 1
#define mod 1000000007
#define L_MAX 1e18... | replace | 55 | 59 | 55 | 69 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define IFOR(i, m, n) for (int i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(v) v.begin(), v.end... | #include <bits/stdc++.h>
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define IFOR(i, m, n) for (int i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(v) v.begin(), v.end... | replace | 41 | 42 | 41 | 46 | -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 <algorithm>
#include <cstdio>
using namespace std;
int n, m, i, j, k, a, b, c, dp[500000], cc[500000];
int main() {
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &cc[i]);
for (int i = 2; i <= n; i++)
dp[i] = 9999999999;
for (int i = 1; i < n; i++) {
for (int j = i + 1; j <... | #include <algorithm>
#include <cstdio>
using namespace std;
int n, m, i, j, k, a, b, c, dp[500000], cc[500000];
int main() {
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &cc[i]);
for (int i = 2; i <= n; i++)
dp[i] = 9999999999;
for (int i = 1; i < n; i++) {
for (int j = i + 1; j <... | replace | 11 | 12 | 11 | 12 | -11 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n], dp[n];
for (int i = 0; i < n; i++)
dp[i] = 1000000000;
for (int i = 0; i < n; i++)
cin >> a[i];
if (n > 2)
dp[0] = 0;
else {
cout << abs(a[1] - a[0]);
return 0;
}
for (int i = 0; i < n; i+... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n], dp[n];
for (int i = 0; i < n; i++)
dp[i] = 1000000000;
for (int i = 0; i < n; i++)
cin >> a[i];
if (n > 2)
dp[0] = 0;
else {
cout << abs(a[1] - a[0]);
return 0;
}
for (int i = 0; i < n; i+... | replace | 17 | 18 | 17 | 19 | -11 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;
int main() {
int n, k;
cin >> n >> k;
vector<int> h(n);
for (int &x : h)
cin >> x;
vector<int> dp(n, INF);
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= i + k; i++) {
if (j < n) {... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;
int main() {
int n, k;
cin >> n >> k;
vector<int> h(n);
for (int &x : h)
cin >> x;
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) {... | replace | 13 | 14 | 13 | 14 | -11 | |
p03161 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
int n, K;
cin >> n >> K;
vector<int> ht(n + 1, 0);
... | #include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
int n, K;
cin >> n >> K;
vector<int> ht(n + 1, 0);
... | replace | 27 | 28 | 27 | 28 | 0 | |
p03161 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
#define test(t) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
#define test(t) ... | replace | 52 | 55 | 52 | 54 | 0 | |
p03161 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
template <typename T> void vc(T t) { std::cout << t << " "; }
template <typename T, typename... Args> void vc(T t, Args... args) {
// recursive variadic function
std::cout... | #include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
template <typename T> void vc(T t) { std::cout << t << " "; }
template <typename T, typename... Args> void vc(T t, Args... args) {
// recursive variadic function
std::cout... | replace | 31 | 32 | 31 | 32 | -11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.