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
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define maxn 100 using namespace std; long long num[maxn]; long long dp[maxn][maxn]; int n; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; ++i) cin >> num[i]; for (int i = n; i >= 1; --i) { for (int j = i; j <= n; ++j) { dp[i][j] = max(num[i]...
#include <bits/stdc++.h> #define maxn 3005 using namespace std; long long num[maxn]; long long dp[maxn][maxn]; int n; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; ++i) cin >> num[i]; for (int i = n; i >= 1; --i) { for (int j = i; j <= n; ++j) { dp[i][j] = max(num[i...
replace
1
2
1
2
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ull unsigned long long int #define Endl endl #define mod 1000000007 #define mkp make_pair #define pb push_back #define cin(n) scanf("%d", &n) #define cout(n) printf("%d ", n) #define sf(n) scanf("%d", &n) #define pf(n) printf("%d ", n) #defi...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ull unsigned long long int #define Endl endl #define mod 1000000007 #define mkp make_pair #define pb push_back #define cin(n) scanf("%d", &n) #define cout(n) printf("%d ", n) #define sf(n) scanf("%d", &n) #define pf(n) printf("%d ", n) #defi...
replace
50
54
50
51
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define FASTIO #define endl \ "\n" // Since endl forces a buffer flush which slows down large I/O // operations. #define ff first #define ss second #define pb push_back #define input(c, n) ...
#include <bits/stdc++.h> #define FASTIO #define endl \ "\n" // Since endl forces a buffer flush which slows down large I/O // operations. #define ff first #define ss second #define pb push_back #define input(c, n) ...
replace
55
57
55
56
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int ll dp[3000][3000]; ll topdown(ll *arr, ll l, ll r) { if (l > r) { dp[l][r] = 0; return 0; } if (dp[l][r] != -1) { return dp[l][r]; } ll op1 = arr[l] + min(topdown(arr, l + 1, r - 1), topdown(arr, l + 2, r)); ll op2 = arr[r...
#include <bits/stdc++.h> using namespace std; #define ll long long int ll dp[4000][4000]; ll topdown(ll *arr, ll l, ll r) { if (l > r) { dp[l][r] = 0; return 0; } if (dp[l][r] != -1) { return dp[l][r]; } ll op1 = arr[l] + min(topdown(arr, l + 1, r - 1), topdown(arr, l + 2, r)); ll op2 = arr[r...
replace
5
6
5
6
0
p03171
C++
Runtime Error
/* Abhijith */ #include <bits/stdc++.h> #include <cmath> #include <iomanip> #define lld long long int #define ld long double #define mod 1000000007 #define all(v) (v).begin(), (v).end() #define rep(i, a, b) for (lld i = a; i <= b; i++) #define repr(i, a, b) for (lld i = a; i >= b; i--) #define pb push_back #define m...
/* Abhijith */ #include <bits/stdc++.h> #include <cmath> #include <iomanip> #define lld long long int #define ld long double #define mod 1000000007 #define all(v) (v).begin(), (v).end() #define rep(i, a, b) for (lld i = a; i <= b; i++) #define repr(i, a, b) for (lld i = a; i >= b; i--) #define pb push_back #define m...
replace
38
41
38
52
-11
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <functional> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int &t : a) cin >> t; long long inv = 10000000000000LL; vector<vector<long long>> T(N, vector<long long>(N, inv)); function<long long(int, int)...
#include <algorithm> #include <functional> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int &t : a) cin >> t; long long inv = 10000000000000LL; vector<vector<long long>> T(N, vector<long long>(N, inv)); function<long long(int, int)...
replace
22
23
22
23
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define vi vector<int> #define vvi vector<vector<int>> #define FASTIO \ ios_base::sync_with_stdio(NULL); \ cin.tie(NULL); #define FOR(i, n) for ...
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define vi vector<int> #define vvi vector<vector<int>> #define FASTIO \ ios_base::sync_with_stdio(NULL); \ cin.tie(NULL); #define FOR(i, n) for ...
replace
47
49
47
49
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) using namespace ...
#include <bits/stdc++.h> #define ll long long #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) using namespace ...
replace
37
38
37
38
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define n_l '\n' template <typename T, size_t N> int SIZE(const T (&t)[N]) { return N; } template <typename T> int SIZE(const T &t) { return t.size(); } string to_string(...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define n_l '\n' template <typename T, size_t N> int SIZE(const T (&t)[N]) { return N; } template <typename T> int SIZE(const T &t) { return t.size(); } string to_string(...
delete
81
85
81
81
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define fi first #define si second #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define fi first #define si second #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie...
replace
57
58
57
58
0
p03171
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<long long> a(N); for (int i = 0; i < N; ++i) cin >> a[i]; // dp[i][j]: Taro のターンで数列が a[i]~a[j] のときの X-Y long long dp[300][300] = {}; for (int i = 0; i < N; ++i) dp[i][i] = a[i]; for (int i = N - 2; ...
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<long long> a(N); for (int i = 0; i < N; ++i) cin >> a[i]; // dp[i][j]: Taro のターンで数列が a[i]~a[j] のときの X-Y long long dp[3000][3000] = {}; for (int i = 0; i < N; ++i) dp[i][i] = a[i]; for (int i = N - 2...
replace
12
13
12
13
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define eb emplace_back #define fi first #define se second #define ALL(a) begin(a), end(a) #define SZ(a) ((int)(a).size()) #define REP(a, b) for (int a = 0; a < (b); a++) #define FOR(a, b, c) for (int a = (b); a <= (c); a++) #defi...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define eb emplace_back #define fi first #define se second #define ALL(a) begin(a), end(a) #define SZ(a) ((int)(a).size()) #define REP(a, b) for (int a = 0; a < (b); a++) #define FOR(a, b, c) for (int a = (b); a <= (c); a++) #defi...
insert
56
56
56
57
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define RREP(i, m, n) for (int i = (int)(n - 1); i >= m; i--) #define rep(i, n) REP(i, 0, n) #define rrep(i, n) RREP(i, 0, n) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define au...
#include <bits/stdc++.h> using namespace std; #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define RREP(i, m, n) for (int i = (int)(n - 1); i >= m; i--) #define rep(i, n) REP(i, 0, n) #define rrep(i, n) RREP(i, 0, n) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define au...
delete
91
92
91
91
TLE
p03171
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define REPP(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, a) for (int i ...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define REPP(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, a) for (int i ...
replace
30
31
30
31
0
p03171
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
58
62
58
58
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; void rwFile() { freopen("INP.inp", "r", stdin); freopen("OUT.out", "w", stdout); } long long arr[3001]; long long res[3001][3001]; void findRes(int a, int b) { if (a == b) { res[a][b] = arr[a]; return; } findRes(a, b - 1); findRes(a + 1, b); res[a]...
#include <bits/stdc++.h> using namespace std; void rwFile() { freopen("INP.inp", "r", stdin); freopen("OUT.out", "w", stdout); } long long arr[3001]; long long res[3001][3001]; void findRes(int a, int b) { if (res[a][b] != 0) return; if (a == b) { res[a][b] = arr[a]; return; } findRes(a, b -...
insert
13
13
13
15
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long const long double EPS = 1e-8; const long double PI = acos(-1); const int N = 3e3 + 2; const int mod = 1e5 + 7; ll mem[N][N][2]; int arr[N]; int n, k; ll solve(int i = 0, int j = n - 1, int player = 0) { if (i > j) return 0; // if (~mem[i][j...
#include <bits/stdc++.h> using namespace std; #define ll long long const long double EPS = 1e-8; const long double PI = acos(-1); const int N = 3e3 + 2; const int mod = 1e5 + 7; ll mem[N][N][2]; int arr[N]; int n, k; ll solve(int i = 0, int j = n - 1, int player = 0) { if (i > j) return 0; if (~mem[i][j][play...
replace
15
16
15
17
TLE
p03171
C++
Runtime Error
#include <algorithm> #include <array> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespa...
#include <algorithm> #include <array> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespa...
replace
36
37
36
37
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define Elhabashy \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); void input() ...
#include <bits/stdc++.h> using namespace std; #define Elhabashy \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); void input() ...
replace
11
12
11
12
0
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <...
replace
63
64
63
65
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 305, MOD = 1e9 + 7; const long long INF = 9e18; int n, a[N]; long long dp[N][N][2]; long long rec(int l, int r, bool turn) { if (l > r) { return 0; } if (dp[l][r][turn] != -INF) { return dp[l][r][turn]; } dp[l][r][turn] = max(a[l] - ...
#include <bits/stdc++.h> using namespace std; const int N = 3005, MOD = 1e9 + 7; const long long INF = 9e18; int n, a[N]; long long dp[N][N][2]; long long rec(int l, int r, bool turn) { if (l > r) { return 0; } if (dp[l][r][turn] != -INF) { return dp[l][r][turn]; } dp[l][r][turn] = max(a[l] -...
replace
3
4
3
4
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define maxn (int)3010 #define int long long int tab[maxn], dp[maxn][maxn][3], n; bool odw[maxn][maxn][3]; int rob(int start, int stop, int kto) { if (odw[start][stop][kto]) return dp[start][stop][kto]; // printf("Przedzial %lld %lld %lld\n", start, stop, kto); i...
#include <bits/stdc++.h> using namespace std; #define maxn (int)3010 #define int long long int tab[maxn], dp[maxn][maxn][3], n; bool odw[maxn][maxn][3]; int rob(int start, int stop, int kto) { if (odw[start][stop][kto]) return dp[start][stop][kto]; odw[start][stop][kto] = true; // printf("Przedzial %lld %lld...
insert
10
10
10
11
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; const ld PI = acos(-1); const ld EPS = 0.0000000001; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repd(i, n) for (ll i =...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; const ld PI = acos(-1); const ld EPS = 0.0000000001; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repd(i, n) for (ll i =...
insert
31
31
31
33
-6
munmap_chunk(): invalid pointer
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long int lli; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); lli n, i, j, size, l, r, rv, lv; cin >> n; lli a[n]; lli maximize[n][n]; for (i = 0; i < n; ++i) { cin >> a[i]; maximize[i][i] = a[i]; }...
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long int lli; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); lli n, i, j, size, l, r, rv, lv; cin >> n; lli a[n]; lli maximize[n][n]; for (i = 0; i < n; ++i) { cin >> a[i]; maximize[i][i] = a[i]; }...
replace
39
45
39
43
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll solve(vector<vector<ll>> &dp, vector<ll> &a, int head, int tail) { if (head >= tail) { return dp[head][tail] = a[head]; } ll best = max(-solve(dp, a, head, tail - 1) + a[tail], -solve(dp, a, head + 1, tail) + a[head]); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll solve(vector<vector<ll>> &dp, vector<ll> &a, int head, int tail) { if (head >= tail) { return dp[head][tail] = a[head]; } if (dp[head][tail] != 0) return dp[head][tail]; ll best = max(-solve(dp, a, head, tail - 1) + a[tail], ...
insert
8
8
8
10
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define int long long int #define pb push_back // #define M 1000000007 #define inf 10000000000 #define ff first #define ss second #define deb(x) cout < #x < "...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define int long long int #define pb push_back // #define M 1000000007 #define inf 10000000000 #define ff first #define ss second #define deb(x) cout < #x < "...
replace
47
48
47
48
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i, s, l) for (lli i = s; i < l; i++) #define DEBUG 0 #define INF (1LL << 50) lli dp[3010][3010]; lli vis[3010][3010]; lli n; vector<lli> a; lli f(lli l, lli r) { if (l > r) return 0; if (vis[l][r]) return dp[l][r]; ll...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i, s, l) for (lli i = s; i < l; i++) #define DEBUG 0 #define INF (1LL << 50) lli dp[3010][3010]; lli vis[3010][3010]; lli n; vector<lli> a; lli f(lli l, lli r) { if (l > r) return 0; if (vis[l][r]) return dp[l][r]; ll...
insert
31
31
31
32
TLE
p03171
C++
Runtime Error
/****************************************** * AUTHOR : HRITIK AGGARWAL * ******************************************/ #include <bits/stdc++.h> using namespace std; #define ll long long #define N 100005 #define MOD 1000000007 #define dd double #define vi vector<int> #define vll vector<ll> #define forr(i, n) for (int i ...
/****************************************** * AUTHOR : HRITIK AGGARWAL * ******************************************/ #include <bits/stdc++.h> using namespace std; #define ll long long #define N 100005 #define MOD 1000000007 #define dd double #define vi vector<int> #define vll vector<ll> #define forr(i, n) for (int i ...
replace
41
43
41
43
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 3; long long dp[N][N][2]; int a[N]; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; dp[i][i][0] = dp[i][i][1] = a[i]; } for (int len = 1; len < n; ++len) for (int st = 0; (st + len) < n; ++st) { int ed...
#include <bits/stdc++.h> using namespace std; const int N = 3e3 + 3; long long dp[N][N][2]; int a[N]; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; dp[i][i][0] = dp[i][i][1] = a[i]; } for (int len = 1; len < n; ++len) for (int st = 0; (st + len) < n; ++st) { int ed...
replace
2
3
2
3
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < n; i++) #define debug(n, v) \ cout << #v << ":"; \ for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < n; i++) #define debug(n, v) \ cout << #v << ":"; \ for (int i = 0; i < n; i++) ...
insert
37
37
37
38
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define rrep1(i, n) for (int i = (n); i > 0; i--) #define ll long long #define pi pair<int, int> #define pll pair<ll, ll> #define MOD 10000000...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define rrep1(i, n) for (int i = (n); i > 0; i--) #define ll long long #define pi pair<int, int> #define pll pair<ll, ll> #define MOD 10000000...
replace
16
17
16
17
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vl; typedef pair<ll, ll> pll; #define MOD 1000000007 #define INF 1000000000 #define mp make_pair #define pb push_back #define ss second #define ff first #define endl '\n' #define pl cout << endl; #define tc ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vl; typedef pair<ll, ll> pll; #define MOD 1000000007 #define INF 1000000000 #define mp make_pair #define pb push_back #define ss second #define ff first #define endl '\n' #define pl cout << endl; #define tc ...
replace
36
37
36
37
0
p03171
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; #define show(x) cerr << #x << " = " << x << endl; #define input_from_file freopen("input.txt", "r", stdin) #define output_to_file freopen("output.txt", "w", stdout) #define fastio ios_base::sync_with_stdio(0) #define endl '\n' const int N = 3e3 + 1; long long dp[N][N][2],...
#include "bits/stdc++.h" using namespace std; #define show(x) cerr << #x << " = " << x << endl; #define input_from_file freopen("input.txt", "r", stdin) #define output_to_file freopen("output.txt", "w", stdout) #define fastio ios_base::sync_with_stdio(0) #define endl '\n' const int N = 3e3 + 5; long long dp[N][N][2],...
replace
9
10
9
10
-11
p03171
C++
Runtime Error
// fahadmd16(IIEST Shibpur) #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pf push_front #define eb emplace_back #define mp make_pair #define ff first #define ss second #define db double #define pll pair<ll, ll> #define ALL(a) (a).begin(), (a).end() #define endl "\n" #...
// fahadmd16(IIEST Shibpur) #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pf push_front #define eb emplace_back #define mp make_pair #define ff first #define ss second #define db double #define pll pair<ll, ll> #define ALL(a) (a).begin(), (a).end() #define endl "\n" #...
replace
124
128
124
125
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(a, n) for (ll a = 0; a < (n); ++a) #define _GLIBCXX_DEBUG using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef vector<vector<ll>> Graph; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
#include <bits/stdc++.h> #define rep(a, n) for (ll a = 0; a < (n); ++a) #define _GLIBCXX_DEBUG using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef vector<vector<ll>> Graph; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
insert
28
28
28
30
TLE
p03171
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; // vector push_back push front top empty pop make_pair long long insert begin // ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; // vector push_back push front top empty pop make_pair long long insert begin // ...
insert
77
77
77
79
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; ll dp[3005][3005]; bool solved[3005][3005]; int l[3005]; int n; ll solve(int lhs, int rhs) { if (lhs == rhs) { return l[lhs]; } if (solved[lhs][rhs]) return dp[lhs][rhs]; dp[lhs][rhs] = max(l[lhs] -...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; ll dp[3005][3005]; bool solved[3005][3005]; int l[3005]; int n; ll solve(int lhs, int rhs) { if (lhs == rhs) { return l[lhs]; } if (solved[lhs][rhs]) return dp[lhs][rhs]; solved[lhs][rhs] = true; dp[lhs...
insert
18
18
18
19
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ops cout << "ops" << endl; #define freopens \ freopen("cowpatibility.in", "r", stdin); \ freopen("cowpatibility.out", "w", stdout); #define fast ...
#include <bits/stdc++.h> using namespace std; #define ops cout << "ops" << endl; #define freopens \ freopen("cowpatibility.in", "r", stdin); \ freopen("cowpatibility.out", "w", stdout); #define fast ...
replace
54
55
54
55
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define pii pair<int, int> #define pll pair<ll, ll> #define sc scanf #define scin(x) sc("%d", &(x)) #define scln(x) sc("%lld", &(x)) #define pf printf #define ms(a, b) memset(a, b, sizeof(a)) #define pb(a) push_back(a) #define mp make...
#include <bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define pii pair<int, int> #define pll pair<ll, ll> #define sc scanf #define scin(x) sc("%d", &(x)) #define scln(x) sc("%lld", &(x)) #define pf printf #define ms(a, b) memset(a, b, sizeof(a)) #define pb(a) push_back(a) #define mp make...
replace
151
157
151
156
0
p03171
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; int n; int a[3005]; const ll INF = 1e18; // dp[i][j] 区間[i,j)におけるX-Yの値 ll dp[3005][3005]; ll solve(int i, int j) { if (dp[i][j] >= 0) return dp[i][j]; if (j - i == 0) return dp[i][j] = 0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int n; int a[3005]; const ll INF = 1e18; // dp[i][j] 区間[i,j)におけるX-Yの値 ll dp[3005][3005]; ll solve(int i, int j) { if (dp[i][j] != -INF) return dp[i][j]; if (j - i == 0) return dp[i][j] = 0;...
replace
13
14
13
14
TLE
p03171
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; #define fi first #define se second #define pb push_back #define int long long #define all(x) (x).begin(), (x).end() using LL = long long; using LD = long double; using pii = pair<int, int>; using vii = vector<pii>; const int INF = 1e18; const int MOD = 1e9 + 7; const int...
#include "bits/stdc++.h" using namespace std; #define fi first #define se second #define pb push_back #define int long long #define all(x) (x).begin(), (x).end() using LL = long long; using LD = long double; using pii = pair<int, int>; using vii = vector<pii>; const int INF = 1e18; const int MOD = 1e9 + 7; const int...
replace
16
17
16
17
0
p03171
C++
Runtime Error
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful ----- #include <bits/stdc++.h> using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<siz...
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful ----- #include <bits/stdc++.h> using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<siz...
replace
88
89
88
89
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long *a = new long long[n]; for (int i = 0; i < n; i++) cin >> a[i]; long long dp[n][n]; // memset(dp,0,sizeof(dp)); for (int l = n - 1; l >= 0; l--) { for (int r = l; r < n; r++) { if (l == r) dp[l][r] ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long *a = new long long[n]; for (int i = 0; i < n; i++) cin >> a[i]; long long dp[n][n]; // memset(dp,0,sizeof(dp)); for (int l = n - 1; l >= 0; l--) { for (int r = l; r < n; r++) { if (l == r) dp[l][r] ...
replace
14
15
14
16
0
p03171
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; long long int grr[3000][3000]; long long int compute(long long int arr[], long long int start, ...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; long long int grr[3005][3005]; long long int compute(long long int arr[], long long int start, ...
replace
12
13
12
13
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; ll dp[3001][3001]; ll fun(int x, int y, int *a) { if (x > y) return 0; if (x == y) return a[x]; if (dp[x][y] > -1) return dp[x][y]; ll X = a[x] + min(fun(x + 2, y, a), fun(x + 1, y - 1, a)); ll Y = a[y] + min(fu...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; ll dp[3001][3001]; ll fun(int x, int y, int *a) { if (x > y) return 0; if (x == y) return a[x]; if (dp[x][y] > -1) return dp[x][y]; ll X = a[x] + min(fun(x + 2, y, a), fun(x + 1, y - 1, a)); ll Y = a[y] + min(fu...
replace
15
16
15
16
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #ifdef _PRINTDEBUG #include "lib/printdebug.hpp" #else #define printdebug(...) 1 #endif #define I_1000000007 (1000000007) #define I_998244353 (998244353) #define I_INF (1 << 28) #define L_INF (1LL << 60) #define rep(i, n) REP(i, 0, (n)) #define repc(i, n) REPC(i, 0, (n)) #define REP(i, n, m) f...
#include <bits/stdc++.h> #ifdef _PRINTDEBUG #include "lib/printdebug.hpp" #else #define printdebug(...) 1 #endif #define I_1000000007 (1000000007) #define I_998244353 (998244353) #define I_INF (1 << 28) #define L_INF (1LL << 60) #define rep(i, n) REP(i, 0, (n)) #define repc(i, n) REPC(i, 0, (n)) #define REP(i, n, m) f...
replace
46
47
46
47
TLE
p03171
C++
Runtime Error
/*input 4 10 80 90 30 */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; #pragma GCC o...
/*input 4 10 80 90 30 */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; #pragma GCC o...
replace
42
44
42
44
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const int INF = 1e9 + 5; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key const int mxs = 302; int main() { ll dp[mxs...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const int INF = 1e9 + 5; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key const int mxs = 3002; int main() { ll dp[mx...
replace
14
15
14
15
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define FORR(i, a, b) for (ll i = (a); i > (b); --i) #define REP(i, n) for (ll i = 0; i < (n); ++i) #define REPR(i, n) for (ll i = n; i >= 0; i--) #define FOREACH(x, a) fo...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define FORR(i, a, b) for (ll i = (a); i > (b); --i) #define REP(i, n) for (ll i = 0; i < (n); ++i) #define REPR(i, n) for (ll i = n; i >= 0; i--) #define FOREACH(x, a) fo...
replace
75
77
75
77
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n; vector<long long> v; pair<long long, long long> dp[3000][3000][2]; pair<long long, long long> slv(int i = 0, int j = n - 1, int f = 0) { if (i > j) return {0, 0}; if (dp[i][j][f].first != 0ll && dp[i][j][f].second != 0ll) return dp[i][j][f]; if (f == 0...
#include <bits/stdc++.h> using namespace std; int n; vector<long long> v; pair<long long, long long> dp[3000][3000][2]; pair<long long, long long> slv(int i = 0, int j = n - 1, int f = 0) { if (i > j) return {0, 0}; if (dp[i][j][f].first != 0ll && dp[i][j][f].second != 0ll) return dp[i][j][f]; if (f == 0...
insert
37
37
37
76
TLE
p03171
C++
Runtime Error
// fest #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define y1 dasdasfasfas #define x1 wqdadfasfasfas #define All(c) c.begin(), c.end() #define SZ(A) (int((A).size())) #define umap unordered_map #define __ fflush(stdout) #define FILENAME "" typedef long long ll; typedef long double ...
// fest #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define y1 dasdasfasfas #define x1 wqdadfasfasfas #define All(c) c.begin(), c.end() #define SZ(A) (int((A).size())) #define umap unordered_map #define __ fflush(stdout) #define FILENAME "" typedef long long ll; typedef long double ...
replace
31
32
31
32
0
p03171
C++
Runtime Error
// I am Varun Das from Jadavpur University #include <bits/stdc++.h> #define mod 1000000007 #define ll long long #define dbg(x) cerr << #x << " = " << x << endl #define INF LLONG_MAX #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a, b) for (int i = a; i >= b; i--) using namespace std; int main() { #if...
// I am Varun Das from Jadavpur University #include <bits/stdc++.h> #define mod 1000000007 #define ll long long #define dbg(x) cerr << #x << " = " << x << endl #define INF LLONG_MAX #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a, b) for (int i = a; i >= b; i--) using namespace std; int main() { #if...
replace
20
21
20
21
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (int i = 0; i < (int)n; i++) const ll INF = (1LL << 60); const int MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } templa...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (int i = 0; i < (int)n; i++) const ll INF = (1LL << 60); const int MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } templa...
insert
34
34
34
36
TLE
p03171
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <s...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <s...
replace
47
48
47
48
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define sanyes \ ios_base::sync_with_stdio(0), cout.tie(0); \ cin.tie(0); #define llong long long #define pb push_back #define bpc __builtin_popcount const llong mxn = 1e5 + 7; const llong mod...
#include <bits/stdc++.h> #define sanyes \ ios_base::sync_with_stdio(0), cout.tie(0); \ cin.tie(0); #define llong long long #define pb push_back #define bpc __builtin_popcount const llong mxn = 1e5 + 7; const llong mod...
replace
17
18
17
18
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define f first #define s second #define mp make_pair #define inlld(x) scanf("%lld", &x) #define ind(x) scanf("%d", &x) #define inlld2(x, y) scanf("%lld%lld", &x, &y) #define inlld3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z) #define ind2(x, y) scanf("%d%d", &x, &y) #define ...
#include <bits/stdc++.h> #define pb push_back #define f first #define s second #define mp make_pair #define inlld(x) scanf("%lld", &x) #define ind(x) scanf("%d", &x) #define inlld2(x, y) scanf("%lld%lld", &x, &y) #define inlld3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z) #define ind2(x, y) scanf("%d%d", &x, &y) #define ...
replace
12
13
12
13
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, a[3009], dp[3009][3009]; ll best(ll l, ll r, bool b) { if (l > r) return 0; ll &ret = dp[l][r]; if (ret < 1e4) return ret; if (b) return ret = min(best(l + 1, r, 0) - a[l], best(l, r - 1, 0) - a[r]); return ret = max(best(l ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, a[3009], dp[3009][3009]; ll best(ll l, ll r, bool b) { if (l > r) return 0; ll &ret = dp[l][r]; if (ret < 1e14) return ret; if (b) return ret = min(best(l + 1, r, 0) - a[l], best(l, r - 1, 0) - a[r]); return ret = max(best(l...
replace
8
9
8
9
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; #define w(x) \ int x; \ cin >> x; \ while (x...
#include <bits/stdc++.h> #define ll long long using namespace std; #define w(x) \ int x; \ cin >> x; \ while (x...
replace
8
9
8
9
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, x, n) for (int i = x; i < (int)(n); ++i) const int N = 3000; int n, k, a[100]; ll dp[N][N][2]; ll cal(int i, int j, bool p) { if (i > j) return 0; if (dp[i][j][p] != -1) return dp[i][j][p]; if (p == 0) return dp[i][j][p] ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, x, n) for (int i = x; i < (int)(n); ++i) const int N = 3000; int n, k, a[N]; ll dp[N][N][2]; ll cal(int i, int j, bool p) { if (i > j) return 0; if (dp[i][j][p] != -1) return dp[i][j][p]; if (p == 0) return dp[i][j][p] = ...
replace
5
6
5
6
-11
p03171
C++
Runtime Error
#define taskname "" #include <algorithm> #include <iostream> using namespace std; #define long long long const int N = 2e3 + 10; int n, a[N]; long f[N][N]; int main() { // freopen(taskname".INP", "r", stdin); // freopen(taskname".OUT", "w", stdout); cin.tie(nullptr); ios_base::sync_with_stdio(false);...
#define taskname "" #include <algorithm> #include <iostream> using namespace std; #define long long long const int N = 3e3 + 10; int n, a[N]; long f[N][N]; int main() { // freopen(taskname".INP", "r", stdin); // freopen(taskname".OUT", "w", stdout); cin.tie(nullptr); ios_base::sync_with_stdio(false);...
replace
8
9
8
9
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const int N = 3e3 + 10; pll dp[N][N]; int a[N]; pll rec(int l, int r) { if (l == r) { return {a[l], 0}; } else { pll f = {0, 0}; if (dp[l][r] != f) return dp[l][r]; int x = a[l], y = a[r]; pl...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const int N = 3e3 + 10; pll dp[N][N]; int a[N]; pll rec(int l, int r) { if (l == r) { return {a[l], 0}; } else { pll f = {0, 0}; if (dp[l][r] != f) return dp[l][r]; int x = a[l], y = a[r]; pl...
replace
28
29
28
31
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; ll const INF = 1LL << 60; #define p_ary(ary, a, b, i) \ do { \ cout << "["; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; ll const INF = 1LL << 60; #define p_ary(ary, a, b, i) \ do { \ cout << "["; ...
replace
31
32
31
32
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; int n; int a[3005]; ll dp[3005][3005]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = n - 1; i >= 0; i--) { for (int j = i; j < n; j++) { if (dp[i] == dp[j]) dp[i][j] = a[i]; else ...
#include <bits/stdc++.h> #define ll long long using namespace std; int n; int a[3005]; ll dp[3005][3005]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = n - 1; i >= 0; i--) { for (int j = i; j < n; j++) { if (dp[i] == dp[j]) dp[i][j] = a[i]; else ...
replace
16
17
16
17
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ld long double #define endl '\n' #define vll vector<ll> #define vvll vector<vll> #define Cout(x) cout << #x << " " << x << endl #define pll pair<ll, ll> #define vpll vector<pll> #define mp make_pair #define pb push_back #define MOD 1000000007 #define in...
#include <bits/stdc++.h> #define ll long long #define ld long double #define endl '\n' #define vll vector<ll> #define vvll vector<vll> #define Cout(x) cout << #x << " " << x << endl #define pll pair<ll, ll> #define vpll vector<pll> #define mp make_pair #define pb push_back #define MOD 1000000007 #define in...
delete
178
182
178
178
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD (int)1e9 + 7 #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i > b; --i) #define vi vector<int> #define vl vector<ll> #define ld long double #define vvi vector<vector<int>> #define vvl vector<vector...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD (int)1e9 + 7 #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i > b; --i) #define vi vector<int> #define vl vector<ll> #define ld long double #define vvi vector<vector<int>> #define vvl vector<vector...
replace
61
62
61
62
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pb push_back #define pf push_front #define pof pop_front #define pob pop_back #define mp make_pair #define pll pair<ll, ll> #define pii pair<int, int> #define all(s) s.begin(), s.end() #define vll vector<ll> #defi...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pb push_back #define pf push_front #define pof pop_front #define pob pop_back #define mp make_pair #define pll pair<ll, ll> #define pii pair<int, int> #define all(s) s.begin(), s.end() #define vll vector<ll> #defi...
insert
64
64
64
66
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #ifdef DEMETRIO #define deb(...) fprintf(stderr, __VA_ARGS__) #define deb1(x) cerr << #x << " = " << x << endl #else #define deb(...) 0 #define deb1(x) 0 #endif #define pb push_back #define mp make_pair #define fst first #define snd second #define fore(i, a, b) for (int i = a, ThxDem = b; i < T...
#include <bits/stdc++.h> #ifdef DEMETRIO #define deb(...) fprintf(stderr, __VA_ARGS__) #define deb1(x) cerr << #x << " = " << x << endl #else #define deb(...) 0 #define deb1(x) 0 #endif #define pb push_back #define mp make_pair #define fst first #define snd second #define fore(i, a, b) for (int i = a, ThxDem = b; i < T...
replace
26
27
26
27
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) const ll mod = 1e9 + 7; c...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) const ll mod = 1e9 + 7; c...
replace
12
13
12
13
0
TIME: 0.013744 sec
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <stdlib.h> /* srand, rand */ #include <time.h> /* time */ #define mt make_tuple #define ll long long #define ld long double #define eb emplace_back #define fi first #define pb push_back // #define endl '\n'...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <stdlib.h> /* srand, rand */ #include <time.h> /* time */ #define mt make_tuple #define ll long long #define ld long double #define eb emplace_back #define fi first #define pb push_back // #define endl '\n'...
replace
90
91
90
91
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define gcj "Case #" #define adj_list vector<vi> #define endl "\n" #define INF_INT 2e9 #define INF_LL 2e18 #define matmax 25 #define mod 1000000007 #define mp make_pair #define pb push_back #define pi pair<int, int> #define pii pair<int, pair<int, int>> #define pl pair<ll, ll> #define pll pair<...
#include <bits/stdc++.h> #define gcj "Case #" #define adj_list vector<vi> #define endl "\n" #define INF_INT 2e9 #define INF_LL 2e18 #define matmax 25 #define mod 1000000007 #define mp make_pair #define pb push_back #define pi pair<int, int> #define pii pair<int, pair<int, int>> #define pl pair<ll, ll> #define pll pair<...
insert
60
60
60
61
TLE
p03171
C++
Runtime Error
#include <iomanip> #include <iostream> using namespace std; const long long MAXN = 3001; long long dp[MAXN][MAXN][2]; long long arr[MAXN]; long long f(long long x, long long y, long long turn) { if (dp[x][y][turn]) { return dp[x][y][turn]; } if (x > y) { return 0; } // cout<<x<<" "<<y<<" "<<turn<<en...
#include <iomanip> #include <iostream> using namespace std; const long long MAXN = 3010; long long dp[MAXN][MAXN][2]; long long arr[MAXN]; long long f(long long x, long long y, long long turn) { if (dp[x][y][turn]) { return dp[x][y][turn]; } if (x > y) { return 0; } // cout<<x<<" "<<y<<" "<<turn<<en...
replace
4
5
4
5
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define F first #define S second #define mod 1000000007 #define dbg(n) cout << #n << ' ' << n << endl; ll dp[101][101]; ll solve(int i, int j, ll a[]) { if (i == j) return dp[i][j] = a[i]; else if (j...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define F first #define S second #define mod 1000000007 #define dbg(n) cout << #n << ' ' << n << endl; ll dp[3001][3001]; ll solve(int i, int j, ll a[]) { if (i == j) return dp[i][j] = a[i]; else if ...
replace
9
10
9
10
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAX = 3005; int64_t dp[MAX][MAX]; vector<int> vals(4); int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> vals[i]; for (int L = n - 1; L >= 0; L--) { for (int R = L; R < n; R++) { if (L != R) { dp[L][R] = max(vals[L...
#include <bits/stdc++.h> using namespace std; const int MAX = 3005; int64_t dp[MAX][MAX]; vector<int> vals(MAX, 0); int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> vals[i]; for (int L = n - 1; L >= 0; L--) { for (int R = L; R < n; R++) { if (L != R) { dp[L][R] = max(v...
replace
6
7
6
7
0
p03171
C++
Time Limit Exceeded
/*input 6 4 2 9 7 1 5 */ #include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 3003; vector<ll> v; ll dp[N][N]; ll func(int l, int r) { if (l > r) { return 0; } if (dp[l][r] > -1) { return dp[l][r]; } ll a = v[l] + min(func(l + 2, r), func(l + 1, r - 1)); ll b = v[r] ...
/*input 6 4 2 9 7 1 5 */ #include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 3003; vector<ll> v; ll dp[N][N]; ll func(int l, int r) { if (l > r) { return 0; } if (dp[l][r] > -1) { return dp[l][r]; } ll a = v[l] + min(func(l + 2, r), func(l + 1, r - 1)); ll b = v[r] ...
replace
23
24
23
24
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int mxN = 3000; int n, a[mxN]; long long dp[mxN][mxN + 1]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = n - 1; i >= 0; --i) { for (int j = i + 1; j <= n; ++j) { dp[i][j] = ...
#include <bits/stdc++.h> using namespace std; const int mxN = 3000; int n, a[mxN]; long long dp[mxN + 1][mxN + 1]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = n - 1; i >= 0; --i) { for (int j = i + 1; j <= n; ++j) { dp[i][j...
replace
5
6
5
6
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #define ll long long int #define ar array #define ld long double #define bigint int64_t #define vll vector<ll> #define pll ar<ll, 3> #define vpll vector<pll> #define pb push_back #define sz(x) (int)(x).size...
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #define ll long long int #define ar array #define ld long double #define bigint int64_t #define vll vector<ll> #define pll ar<ll, 3> #define vpll vector<pll> #define pb push_back #define sz(x) (int)(x).size...
replace
290
291
290
291
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define vi vector<int> #define rep(i, xtz, n) for (int i = xtz; i < n; i++) #define repx(i, xtz, n) for (int i = xtz; i >= n; i--) #define lli long long int using namespace std; lli dp[305][305]; int main() { // freopen("i.in", "r", stdin); int n; scanf("%d", &n); vector<lli> vec(n);...
#include <bits/stdc++.h> #define vi vector<int> #define rep(i, xtz, n) for (int i = xtz; i < n; i++) #define repx(i, xtz, n) for (int i = xtz; i >= n; i--) #define lli long long int using namespace std; lli dp[3005][3005]; int main() { // freopen("i.in", "r", stdin); int n; scanf("%d", &n); vector<lli> vec(n...
replace
8
9
8
9
0
p03171
C++
Runtime Error
#pragma GCC optimize "trapv" #include <bits/stdc++.h> #define faster \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using ...
#pragma GCC optimize "trapv" #include <bits/stdc++.h> #define faster \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using ...
replace
11
12
11
12
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 // #define MOD 998244353 // #define INF 1145141919810893364 // #define INF 810114514 #define PI 3.141592653589 typedef pair<int, int> PP; typedef long long ll; #define int ll #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 // #define MOD 998244353 // #define INF 1145141919810893364 // #define INF 810114514 #define PI 3.141592653589 typedef pair<int, int> PP; typedef long long ll; #define int ll #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++...
replace
36
38
36
39
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n; vector<int> a; vector<vector<bool>> vis; vector<vector<int64_t>> dp; int64_t go(int i, int j, int p) { if (vis[i][j]) return dp[i][j]; if (i == j) return dp[i][j] = p * a[i]; int64_t x = go(i + 1, j, -p) + p * a[i]; int64_t y = go(i, j - 1, -p) + p *...
#include <bits/stdc++.h> using namespace std; int n; vector<int> a; vector<vector<bool>> vis; vector<vector<int64_t>> dp; int64_t go(int i, int j, int p) { if (vis[i][j]) return dp[i][j]; if (i == j) return dp[i][j] = p * a[i]; vis[i][j] = true; int64_t x = go(i + 1, j, -p) + p * a[i]; int64_t y = go...
insert
12
12
12
13
TLE
p03171
C++
Runtime Error
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define ll long long #define pb push_back #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; const ll N ...
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define ll long long #define pb push_back #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; const ll N ...
replace
7
8
7
8
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define int long long #define ld long double #define MAX 100001 #define MOD 1000000007 using namespace std; int dp[1001][1001][2]; void play(int s, int e, int turn, int *a) { if (dp[s][e][turn] != -1) return; if (s == e) { dp[s][e][turn] = a[s]; dp[s][e][turn ^ 1] = 0; ret...
#include <bits/stdc++.h> #define int long long #define ld long double #define MAX 100001 #define MOD 1000000007 using namespace std; int dp[3001][3001][2]; void play(int s, int e, int turn, int *a) { if (dp[s][e][turn] != -1) return; if (s == e) { dp[s][e][turn] = a[s]; dp[s][e][turn ^ 1] = 0; ret...
replace
7
8
7
8
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long n, a[3001], dp[3001][3001]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == 1) dp[i][j] = a[j]; else if (i == 2) dp[i][j] = abs(a[j] -...
#include <bits/stdc++.h> using namespace std; long long n, a[3001], dp[3001][3001]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i + j - 1 > n) break; if (i == 1) dp[i][j] = a[j]; else i...
insert
9
9
9
11
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define tani_nachi_ke \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define M_PI 3.14159265358979323846 #define data data_ #define ff first #define ss second int c...
#include <bits/stdc++.h> using namespace std; #define tani_nachi_ke \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define M_PI 3.14159265358979323846 #define data data_ #define ff first #define ss second int c...
replace
20
21
20
22
TLE
p03171
C++
Time Limit Exceeded
// May this submission get accepted! #pragma GCC optimize("O3") #pragma GCC target("tune=native") #pragma GCC target("avx") #include <bits/stdc++.h> // 汎用マクロ #define ALL_OF(x) (x).begin(), (x).end() #define REP(i, n) for (long long i = 0, i##_len = (n); i < i##_len; i++) #define RANGE(i, is, ie) ...
// May this submission get accepted! #pragma GCC optimize("O3") #pragma GCC target("tune=native") #pragma GCC target("avx") #include <bits/stdc++.h> // 汎用マクロ #define ALL_OF(x) (x).begin(), (x).end() #define REP(i, n) for (long long i = 0, i##_len = (n); i < i##_len; i++) #define RANGE(i, is, ie) ...
replace
77
78
77
78
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define MAX_N 3000 typedef long long int ll; int n; ll a[MAX_N]; ll dp[MAX_N + 1][MAX_N + 1]; int main() { std::cin >> n; for (int i = 0; i < n; ++i) { std::cin >> a[i]; } for (int i = 0; i <= n; ++i) { dp[i][i] = 0; } for (int len = 1; len <= n; ++len) { for (int i...
#include <bits/stdc++.h> #define MAX_N 3000 typedef long long int ll; int n; ll a[MAX_N]; ll dp[MAX_N + 1][MAX_N + 1]; int main() { std::cin >> n; for (int i = 0; i < n; ++i) { std::cin >> a[i]; } for (int i = 0; i <= n; ++i) { dp[i][i] = 0; } for (int len = 1; len <= n; ++len) { for (int i...
replace
20
21
20
21
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define f(i, n) for (ll i = 0; i < n; i++) #define fz for (ll j = i + 1; j < n; j++) #define f2(i, n) for (ll i = 1; i <= n; i++) #define endl "\n" #define vll vector<ll> #define sz(a) (ll) a.size() #define mod 1000000007 #define pb push_back #defin...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define f(i, n) for (ll i = 0; i < n; i++) #define fz for (ll j = i + 1; j < n; j++) #define f2(i, n) for (ll i = 1; i <= n; i++) #define endl "\n" #define vll vector<ll> #define sz(a) (ll) a.size() #define mod 1000000007 #define pb push_back #defin...
replace
31
32
31
32
0
p03171
C++
Time Limit Exceeded
#include "bits/stdc++.h" #define ALL(g) (g).begin(), (g).end() #define REP(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, x, n) for (int i = x; i >= n; i--) #define rrep(i, n) RREP(i, n, 0) #define pb push_back #pragma GCC optimize("-O3") using namespace std; // #define DEBUG_IS_...
#include "bits/stdc++.h" #define ALL(g) (g).begin(), (g).end() #define REP(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, x, n) for (int i = x; i >= n; i--) #define rrep(i, n) RREP(i, n, 0) #define pb push_back #pragma GCC optimize("-O3") using namespace std; // #define DEBUG_IS_...
replace
215
216
215
216
TLE
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <list> #include <queue> #include <string> #include <vector> #define rep(i, n) for (i = 0; i < (n); i++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define MOD 1000000007 #define PI 3.14159265358979323846 #define INF 1 << 30 using namespace std;...
#include <algorithm> #include <iostream> #include <list> #include <queue> #include <string> #include <vector> #define rep(i, n) for (i = 0; i < (n); i++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define MOD 1000000007 #define PI 3.14159265358979323846 #define INF 1 << 30 using namespace std;...
replace
22
23
22
23
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long const ll maxn = 1001; ll n, a[maxn], memo[3001][3001][2]; ll go(ll i, ll j, ll par) { if (i > j) { return 0; } ll ans = 0; if (memo[i][j][par] != -1) return memo[i][j][par]; if (par == 0) { ans += max(a[i] + go(i + 1, j, !par), a[...
#include <bits/stdc++.h> using namespace std; #define ll long long const ll maxn = 3001; ll n, a[maxn], memo[maxn][maxn][2]; ll go(ll i, ll j, ll par) { if (i > j) { return 0; } ll ans = 0; if (memo[i][j][par] != -1) return memo[i][j][par]; if (par == 0) { ans += max(a[i] + go(i + 1, j, !par), a[...
replace
3
5
3
5
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTIO \ cin.tie(0); \ cout.tie(0); \ ios_base...
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTIO \ cin.tie(0); \ cout.tie(0); \ ios_base...
replace
20
21
20
21
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define se second #define fr first #define int long long int #define pb push_back #define inf 1e18 #define all(v) v.begin(), v.end() #define CHAL_BAAP_KO_MT_SIKHA \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define se second #define fr first #define int long long int #define pb push_back #define inf 1e18 #define all(v) v.begin(), v.end() #define CHAL_BAAP_KO_MT_SIKHA \ ios_base::sync_with_stdio(false); ...
replace
22
23
22
23
0
p03171
C++
Runtime Error
#pragma region template 1.0 #pragma region def #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define REP1(i, n) for (ll i = 1; i <= (n); ++i) #define OUT(x) cout << (x) << endl; #define OUTA(a) ...
#pragma region template 1.0 #pragma region def #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define REP1(i, n) for (ll i = 1; i <= (n); ++i) #define OUT(x) cout << (x) << endl; #define OUTA(a) ...
replace
30
31
30
31
-6
malloc(): corrupted top size
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vl = vector<ll>; using vvl = vector<vl>; #define mp make_pair #define pb push_back #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); i+...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vl = vector<ll>; using vvl = vector<vl>; #define mp make_pair #define pb push_back #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); i+...
replace
78
83
78
81
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() ll stoneGame(vector<ll> &piles) { // cout << piles[0] << " "; ll n = piles.size(); vector<vector<ll>> dp(n, vector<ll>(n, 0)); for (int i = 0...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() ll stoneGame(vector<ll> &piles) { // cout << piles[0] << " "; ll n = piles.size(); vector<vector<ll>> dp(n, vector<ll>(n, 0)); for (int i = 0...
delete
25
29
25
25
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const int maxn = 3e3 + 5, mod = 1e9 + 7; int n, c[maxn][maxn], a[maxn]; long long f[maxn][maxn]; long long dp(int l, int r) { if (l > r) return 0; long long &res = f[l][r]; if (c[l][r]) return res; int turn = (l + (n - r + 1)) % 2; if (turn) { res = ...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e3 + 5, mod = 1e9 + 7; int n, c[maxn][maxn], a[maxn]; long long f[maxn][maxn]; long long dp(int l, int r) { if (l > r) return 0; long long &res = f[l][r]; if (c[l][r]) return res; c[l][r] = true; int turn = (l + (n - r + 1)) % 2; if (...
insert
13
13
13
14
TLE
p03171
C++
Runtime Error
// // Created by vishal on 7/7/20. // // // Created by vishal on 6/14/20. // #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp ...
// // Created by vishal on 7/7/20. // // // Created by vishal on 6/14/20. // #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp ...
replace
41
42
41
42
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; // #define int ll typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<short> vs; typedef vector<vs> vvs...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; // #define int ll typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<short> vs; typedef vector<vs> vvs...
replace
95
96
95
96
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; class Debug { private: static int NAME_LENGTH, MAX_WIDTH; static bool IS_MATRIX; static long long INF; public: static void set_NAME_LENGTH(int l) { NAME_LENGTH = l; } static int get_NAME_LENGTH() { return NAME_LENGTH; } static void set_MAX_WIDTH(int w) { MAX_W...
#include <bits/stdc++.h> using namespace std; class Debug { private: static int NAME_LENGTH, MAX_WIDTH; static bool IS_MATRIX; static long long INF; public: static void set_NAME_LENGTH(int l) { NAME_LENGTH = l; } static int get_NAME_LENGTH() { return NAME_LENGTH; } static void set_MAX_WIDTH(int w) { MAX_W...
replace
216
218
216
218
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, s, n) for (int i = (s); i < (n); i++) #define all(v) v.begin(), v.end() #define outve(v) \ for (auto i : v) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, s, n) for (int i = (s); i < (n); i++) #define all(v) v.begin(), v.end() #define outve(v) \ for (auto i : v) ...
replace
65
66
65
66
0