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
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, k; cin >> n >> k; vector<int> A(n); rep(i, n) cin >> A[i]; bool dp[101010] = {0}; for (int i = 0; i < k + 1; i++) { if (dp[i]) continue; for (int j = 0; j < n;...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, k; cin >> n >> k; vector<int> A(n); rep(i, n) cin >> A[i]; bool dp[201010] = {0}; for (int i = 0; i < k + 1; i++) { if (dp[i]) continue; for (int j = 0; j < n;...
replace
10
11
10
11
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define MP make_pair #define PB push_back #define ll int64_t #define F first #define S second #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) using namespace std; ll modex(ll a, int b, ll p) { ll res = 1; a %= p; while (b > 0) { if (b & 1) res = (res * a) %...
#include <bits/stdc++.h> #define MP make_pair #define PB push_back #define ll int64_t #define F first #define S second #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) using namespace std; ll modex(ll a, int b, ll p) { ll res = 1; a %= p; while (b > 0) { if (b & 1) res = (res * a) %...
replace
23
24
23
24
0
p03170
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int N, P, A[109], dp[109]; int main() { cin >> N >> P; for (int i = 1; i <= N; i++) cin >> A[i]; for (int i = 1; i <= P; i++) { bool used[109]; for (int j = 0; j < 109; j++) used[j] = false; for (int j = 1; j <= N; j++) { ...
#include <algorithm> #include <iostream> using namespace std; int N, P, A[100009], dp[100009]; int main() { cin >> N >> P; for (int i = 1; i <= N; i++) cin >> A[i]; for (int i = 1; i <= P; i++) { bool used[109]; for (int j = 0; j < 109; j++) used[j] = false; for (int j = 1; j <= N; j++) { ...
replace
4
5
4
5
0
p03170
C++
Runtime Error
#include <iomanip> #include <iostream> using namespace std; const long long MAXN = 3001; int dp[MAXN]; int arr[MAXN]; int main() { int n, k; cin >> n >> k; int mine = 1000000000; for (int i = 0; i < n; i++) { cin >> arr[i]; mine = min(arr[i], mine); } for (int i = mine; i <= k; i++) { for (in...
#include <iomanip> #include <iostream> using namespace std; const long long MAXN = 100010; int dp[MAXN]; int arr[MAXN]; int main() { int n, k; cin >> n >> k; int mine = 1000000000; for (int i = 0; i < n; i++) { cin >> arr[i]; mine = min(arr[i], mine); } for (int i = mine; i <= k; i++) { for (...
replace
4
5
4
5
0
p03170
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
166
170
166
166
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; typedef long long ll; const int MOD = 1e9 + 7; #define INF ((1 << 30) - 1) #define LINF (1LL << 30) bool dp[110000]; int a[110]; int n, k; int main() { cin >> n >> k; for (int i = 0; i < n; i++)...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; typedef long long ll; const int MOD = 1e9 + 7; #define INF ((1 << 30) - 1) #define LINF (1LL << 30) bool dp[110000]; int a[110]; int n, k; int main() { cin >> n >> k; for (int i = 0; i < n; i++)...
replace
20
21
20
21
0
p03170
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> #define PI 3.1415926535897932384626433832795l...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> #define PI 3.1415926535897932384626433832795l...
replace
44
45
44
45
0
p03170
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define repp(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) ll binpowmod(ll a, ll b, ll m) {...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define repp(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) ll binpowmod(ll a, ll b, ll m) {...
replace
40
41
40
41
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long ll mod = 1000000007; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll T; T = 6; start: while (T--) { ll n, m; cin >> n >> m; ll a[n]; for (ll i = 0; i < n; i++) { cin >> a[i]; } ...
#include <bits/stdc++.h> using namespace std; #define ll long long ll mod = 1000000007; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll T; T = 1; start: while (T--) { ll n, m; cin >> n >> m; ll a[n]; for (ll i = 0; i < n; i++) { cin >> a[i]; } ...
replace
11
12
11
12
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, k; const int MAXN = 1e5 + 5; int vis[MAXN]; vector<int> arr; int main() { cin >> n >> k; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; for (int i = 0; i <= k; i++) for (auto val : arr) if (!vis[i - val] && i - val >= 0) vis[i...
#include <bits/stdc++.h> using namespace std; int n, k; const int MAXN = 1e5 + 5; int vis[MAXN]; vector<int> arr; int main() { cin >> n >> k; arr.resize(n); for (int i = 0; i < n; i++) cin >> arr[i]; for (int i = 0; i <= k; i++) for (auto val : arr) if (i - val >= 0 && !vis[i - val]) vis[i...
replace
13
14
13
14
0
p03170
C++
Time Limit Exceeded
#include <iostream> using namespace std; int N, K; int a[101]; bool dp[2][100010], vis[101][100010]; // true -> sente, false -> gote bool rec(int cur, int k) { if (vis[cur][k]) return dp[cur][k]; if (k == K) { return cur % 2 == 1; } if (cur % 2 == 0) { bool sente = false; for (int i = 0; i <...
#include <iostream> using namespace std; int N, K; int a[101]; bool dp[2][100010], vis[101][100010]; // true -> sente, false -> gote bool rec(int cur, int k) { if (vis[cur][k]) return dp[cur][k]; if (k == K) { return cur % 2 == 1; } vis[cur][k] = true; if (cur % 2 == 0) { bool sente = false; ...
insert
15
15
15
17
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define _USE_MATH_DEFINES #include <cmath> long long MOD = 1000000007; // vector<long long > t(4*100001); long long binary_exp(long long a, long long b) { long long ans = 1; while (b > 0) { if (b & 1) { ans = (ans * a) % MOD; } a = (a * a) % MOD; b...
#include <bits/stdc++.h> using namespace std; #define _USE_MATH_DEFINES #include <cmath> long long MOD = 1000000007; // vector<long long > t(4*100001); long long binary_exp(long long a, long long b) { long long ans = 1; while (b > 0) { if (b & 1) { ans = (ans * a) % MOD; } a = (a * a) % MOD; b...
replace
157
160
157
162
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define int long long int #define len length #define pb push_back #define F first #define S second #define all(a) a.begin(), a.end() #define scnarr(a, n) \ for (int i = 0; i < n; ++i) \ ...
#include <bits/stdc++.h> #define int long long int #define len length #define pb push_back #define F first #define S second #define all(a) a.begin(), a.end() #define scnarr(a, n) \ for (int i = 0; i < n; ++i) \ ...
replace
71
74
71
73
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ld long double #define ull unsigned long long int #define ll long long int #define SPEED \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ld long double #define ull unsigned long long int #define ll long long int #define SPEED \ ios_base::sync_with_stdio(false); ...
replace
79
80
79
80
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef int integer; #define FIN \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.t...
#include <bits/stdc++.h> using namespace std; typedef int integer; #define FIN \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.t...
replace
39
40
39
40
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define fastio \ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define fastio \ ios_base::sync_with_stdio(0); ...
replace
54
55
54
55
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp1[3001][3001], dp2[3001][3001]; ll a[3001]; ll f(ll i, ll j, ll y) { if (y == -1) { if (dp2[i][j] != -1) { return dp2[i][j]; } if (i == j) { return dp2[i][j] = y * a[i]; } return dp2[i][j] = min(y *...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp1[3001][3001], dp2[3001][3001]; ll a[3001]; ll f(ll i, ll j, ll y) { if (y == -1) { if (dp2[i][j] != -1) { return dp2[i][j]; } if (i == j) { return dp2[i][j] = y * a[i]; } return dp2[i][j] = min(y *...
insert
34
34
34
38
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << endl #define out(x) cout << x << endl #define repeat(i, a, b) for (int i = (a); i < (b); i++) #define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define revre...
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << endl #define out(x) cout << x << endl #define repeat(i, a, b) for (int i = (a); i < (b); i++) #define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define revre...
insert
49
49
49
51
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define int long long #define pb push_back #define mod 1000000007 #define setbits(x) __builtin_popcountll(x) #define zerobits(x) __builtin_ctzll(x) #define inf 1e18 #define pre(x, y) fixed << setprecision(y) << x #define pq priority_queue<int> #def...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define int long long #define pb push_back #define mod 1000000007 #define setbits(x) __builtin_popcountll(x) #define zerobits(x) __builtin_ctzll(x) #define inf 1e18 #define pre(x, y) fixed << setprecision(y) << x #define pq priority_queue<int> #def...
replace
15
16
15
16
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <cmath> #define SZ(x) ((int)x.size()) #include <map> #include <set> #include <vector> #define ll long long #define lli long long int #define REP(i, a, b) for (ll i = a; i < b; i++) #define pb push_back #include <cctype> #include <queue> #include <string> #define ii pair<int, int> #incl...
#include <bits/stdc++.h> #include <cmath> #define SZ(x) ((int)x.size()) #include <map> #include <set> #include <vector> #define ll long long #define lli long long int #define REP(i, a, b) for (ll i = a; i < b; i++) #define pb push_back #include <cctype> #include <queue> #include <string> #define ii pair<int, int> #incl...
replace
83
84
83
84
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back typedef long long ll; const ll mod = 1e9 + 7; const ll inf = 9223372036854775807; ll arr[2000], memo[2000][2000], bl[2000][2000], maxi, n, ans, dif, sum; ll dp(ll x, ll y) { ll depan = 0; ll belakang = 0; if (x...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back typedef long long ll; const ll mod = 1e9 + 7; const ll inf = 9223372036854775807; ll arr[3000], memo[3000][3000], bl[3000][3000], maxi, n, ans, dif, sum; ll dp(ll x, ll y) { ll depan = 0; ll belakang = 0; if (x...
replace
9
10
9
10
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // Macros for easier access #define ll long long #define endl '\n' #define umap unordered_map #define uset unordered_set #define test \ ll cases; ...
#include <bits/stdc++.h> using namespace std; // Macros for easier access #define ll long long #define endl '\n' #define umap unordered_map #define uset unordered_set #define test \ ll cases; ...
replace
89
90
89
90
-11
p03171
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; #define rep(i, n) for (ll i = 0; i < n; i++)...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; #define rep(i, n) for (ll i = 0; i < n; i++)...
replace
36
37
36
37
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <string.h> using namespace std; #define li long long int #define mod 1000000000 + 7 li n, k; li a[3005]; li dp[3005][3005]; li f(li i, li j) { if (i == j) { return a[i]; } if (i == j - 1) { return max(a[i], a[j]); } li op1 = a[i] + min(f(i + 2, j), f(i + 1, j - 1)); ...
#include <bits/stdc++.h> #include <string.h> using namespace std; #define li long long int #define mod 1000000000 + 7 li n, k; li a[3005]; li dp[3005][3005]; li f(li i, li j) { if (i == j) { return a[i]; } if (i == j - 1) { return max(a[i], a[j]); } if (dp[i][j] != -1) { return dp[i][j]; } li ...
insert
14
14
14
17
TLE
p03171
C++
Runtime Error
/* !!!!!! !!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!! ...
/* !!!!!! !!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!! ...
delete
75
80
75
75
-11
p03171
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; using P = pair<int, int>; int main() { int N; cin >> N; vector<int> A(N); rep(i, N) cin >> A[i]; vector<vector<ll>> dp(N + 100, vector<ll>(N + 100)); for (int width = 1; width <= N; width++) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int N; cin >> N; vector<int> A(N); rep(i, N) cin >> A[i]; vector<vector<ll>> dp(N + 100, vector<ll>(N + 100)); for (int width = 1; width <= N; width++) ...
insert
15
15
15
17
0
p03171
C++
Time Limit Exceeded
#define INPUT "./io/test.in" #define OUTPUT "./io/test.out" #ifdef NARUT_LOCAL #include "local.hpp" #include "reopen.hpp" #else #pragma GCC optimize("-O2", "-ftree-vectorize") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdi...
#define INPUT "./io/test.in" #define OUTPUT "./io/test.out" #ifdef NARUT_LOCAL #include "local.hpp" #include "reopen.hpp" #else #pragma GCC optimize("-O2", "-ftree-vectorize") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdi...
replace
208
209
208
209
TLE
p03171
C++
Runtime Error
/* *#*#*#* Author GaryMr *#*#*#* ######################################################################## 是否可以简化问题: 抓住数据范围哪里小 dfs or bfs 是否可以化具体为抽象 字符串问题是否可以用数学模拟递归过程(取c[i]或不取来算结果) 二分?左闭右开? long long? 逆向思维? dp? 贪心? 树的直径:随便找一...
/* *#*#*#* Author GaryMr *#*#*#* ######################################################################## 是否可以简化问题: 抓住数据范围哪里小 dfs or bfs 是否可以化具体为抽象 字符串问题是否可以用数学模拟递归过程(取c[i]或不取来算结果) 二分?左闭右开? long long? 逆向思维? dp? 贪心? 树的直径:随便找一...
replace
56
57
56
57
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; typedef pair<ll, ll> P; #define M 1000000007 #define F first #define S second #define PB push_back #define INF 100000000000000000 ll n, a[3005], dp[3005][3005][2]; int main(void) { scanf("%lld", &n); for (int i = 1; i <= n; i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; typedef pair<ll, ll> P; #define M 1000000007 #define F first #define S second #define PB push_back #define INF 100000000000000000 ll n, a[3005], dp[3005][3005][2]; int main(void) { scanf("%lld", &n); for (int i = 1; i <= n; i++) ...
replace
16
17
16
17
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define y1 as214 #define ii pair<int, int> #define iii pair<int, ii> #define iv pair<ii, ii> #define fi first #define se second #define fr front() #define pb push_back #define FOR(i, x, n) for (int i = x; i <= n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define...
#include <bits/stdc++.h> using namespace std; #define y1 as214 #define ii pair<int, int> #define iii pair<int, ii> #define iv pair<ii, ii> #define fi first #define se second #define fr front() #define pb push_back #define FOR(i, x, n) for (int i = x; i <= n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define...
replace
20
21
20
21
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <string.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
#include <bits/stdc++.h> #include <string.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
replace
51
52
51
52
-11
p03171
C++
Runtime Error
// // ROIGold.cpp // Main calisma // // Created by Rakhman on 05/02/2019. // Copyright © 2019 Rakhman. All rights reserved. // #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #...
// // ROIGold.cpp // Main calisma // // Created by Rakhman on 05/02/2019. // Copyright © 2019 Rakhman. All rights reserved. // #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #...
replace
43
44
43
44
0
p03171
C++
Time Limit Exceeded
// Rishabh Agarwal #include <bits/stdc++.h> #define F first #define S second #define MAX 10000003 using namespace std; typedef long long int ll; const ll mod = 1e9 + 7; const ll INF = 1e18; long double PI = 3.1415926; ll power(ll a, ll b) { if (b == 0) { return 1; } ll temp = power(a, b / 2) % mod; if (...
// Rishabh Agarwal #include <bits/stdc++.h> #define F first #define S second #define MAX 10000003 using namespace std; typedef long long int ll; const ll mod = 1e9 + 7; const ll INF = 1e18; long double PI = 3.1415926; ll power(ll a, ll b) { if (b == 0) { return 1; } ll temp = power(a, b / 2) % mod; if (...
replace
58
59
58
60
TLE
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> // #include <map> #include <cmath> #include <cstring> #include <iomanip> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long LL; typedef long double LD; typedef unsigned int uii; typedef pair<int, int>...
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> // #include <map> #include <cmath> #include <cstring> #include <iomanip> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long LL; typedef long double LD; typedef unsigned int uii; typedef pair<int, int>...
insert
24
24
24
25
TLE
p03171
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #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 <stack> #include <string> #include <unor...
#include <algorithm> #include <cmath> #include <cstdio> #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 <stack> #include <string> #include <unor...
replace
40
41
40
41
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n; cin >> n; ll a[n]; ll sum = 0; ll dp[3000][3000][2]; for (ll i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; dp[i][i][0] = a[i]; dp[i][i][1] = 0; } for (ll rml = 1; rml < n; rml++) { for (ll L = 0; ...
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n; cin >> n; ll a[n]; ll sum = 0; ll dp[3000][3000][2]; for (ll i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; dp[i][i][0] = a[i]; dp[i][i][1] = 0; } for (ll rml = 1; rml < n; rml++) { for (ll L = 0; ...
replace
16
17
16
17
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int solve(vector<int> &coins, int l, int r, vector<vector<int>> &dp) { if (l > r) return 0; if (dp[l][r] != -1) return dp[l][r]; int a1 = dp[l + 2][r] != -1 ? dp[l + 2][r] : solve(coins, l + 2, r, dp); int a2 = dp[l + 1][r - 1] != -1...
#include <bits/stdc++.h> using namespace std; #define int long long int solve(vector<int> &coins, int l, int r, vector<vector<int>> &dp) { if (l > r) return 0; if (dp[l][r] != -1) return dp[l][r]; return dp[l][r] = max(coins[l] + min(solve(coins, l + 2, r, dp), sol...
replace
10
23
10
14
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl '\n' #define PI acos(-1) typedef long long ll; // Table is the complete reverse of dp // Always think of the pattern (LCM, GCD) // Be careful of unsigned // double epsilon = FLT_EPSILON; // Think of a soluti...
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl '\n' #define PI acos(-1) typedef long long ll; // Table is the complete reverse of dp // Always think of the pattern (LCM, GCD) // Be careful of unsigned // double epsilon = FLT_EPSILON; // Think of a soluti...
replace
32
33
32
33
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, s, t) for (int i = (s); i < (t); i++) int N; ll A[3005], DP[3005][3005]; ll sol = 0; // 0 - Taro's turn // 1 - Jiro's turn ll rek(int l, int r, int turn) { if (l > r) return 0; if (l == r) { return DP[l][r] = A[l] * (1 - ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, s, t) for (int i = (s); i < (t); i++) int N; ll A[3005], DP[3005][3005]; ll sol = 0; // 0 - Taro's turn // 1 - Jiro's turn ll rek(int l, int r, int turn) { if (l > r) return 0; if (l == r) { return DP[l][r] = A[l] * (1 - ...
insert
19
19
19
21
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; inline void fileio(const char *in, const char *out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } #define TD typedef #define forx(i, n) for (int i = 0; i < (n); ++i) #define forxr(i, n) for (int i = (n)-1; i >= 0; --i) TD long long ll; TD long double ld; TD pa...
#include <bits/stdc++.h> using namespace std; inline void fileio(const char *in, const char *out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } #define TD typedef #define forx(i, n) for (int i = 0; i < (n); ++i) #define forxr(i, n) for (int i = (n)-1; i >= 0; --i) TD long long ll; TD long double ld; TD pa...
insert
34
34
34
35
TLE
p03171
C++
Runtime Error
#include "bits/stdc++.h" #define fastread \ std::ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define endl '\n' #define pb push...
#include "bits/stdc++.h" #define fastread \ std::ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define endl '\n' #define pb push...
replace
89
90
89
90
-11
p03171
C++
Memory Limit Exceeded
// #undef _DEBUG // #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; #define int long long // todo 消したら動かない intの代わりにsignedを使う #define ll long long auto start_time = system_clock::now(); ...
// #undef _DEBUG // #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; #define int long long // todo 消したら動かない intの代わりにsignedを使う #define ll long long auto start_time = system_clock::now(); ...
replace
4,737
4,741
4,737
4,739
MLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define all(a) a.begin(), a.end() #define F first #define S second #define pb push_back #define int long long #define ld long double #define vi vector<long long> #define mkp make_pair #define sz(x) (int)x.size() #defi...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define all(a) a.begin(), a.end() #define F first #define S second #define pb push_back #define int long long #define ld long double #define vi vector<long long> #define mkp make_pair #define sz(x) (int)x.size() #defi...
replace
37
38
37
38
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define mk make_pair #define fi first #define se second #define vll vector<ll> #define pii pair<ll, ll> #define vvll vector<vector<ll>> #define pb push_back #define sz...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define mk make_pair #define fi first #define se second #define vll vector<ll> #define pii pair<ll, ll> #define vvll vector<vector<ll>> #define pb push_back #define sz...
replace
56
57
56
57
-11
p03171
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <m...
#define _CRT_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <m...
replace
131
132
131
132
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define MOD ((int)(1e9) + 7) #define fast \ cin.tie(0); \ cout.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define MOD ((int)(1e9) + 7) #define fast \ cin.tie(0); \ cout.tie(0); ...
replace
15
16
15
16
0
p03171
Python
Time Limit Exceeded
def kukan(n, a): dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) return dp[0][n - 1] n = int(input()) a = list(map(int, input().split())) pr...
def kukan(n, a): dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): L = a[i] - dp[i + 1][j] R = a[j] - dp[i][j - 1] dp[i][j] = L if L > R else R return dp[0][n - 1] n = int(inp...
replace
6
7
6
9
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // dp[i][j] = max a person can get from strones from i to j int main() { long long int n; cin >> n; vector<long long int> x(n); for (long long int i = 0; i < n; i++) cin >> x[i]; vector<long long int> ab(n + 1); vector<vector<long long int>> dp(n + 1, a...
#include <bits/stdc++.h> using namespace std; // dp[i][j] = max a person can get from strones from i to j int main() { long long int n; cin >> n; vector<long long int> x(n); for (long long int i = 0; i < n; i++) cin >> x[i]; if (n == 0) { cout << 0; return 0; } if (n == 1) { cout << x...
insert
13
13
13
21
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define Mx 1000000000005 #define ll long long #define pi 3.141592653 #define vi vector<ll> #define Mo 1000000007 #define mp make_pair #define M map<ll, ll> #define fr(i, a, b) for (ll i = a; i < b; i++) #define vii vector<pair<ll, ll>> #define fi first #define se second #define pb push_back #de...
#include <bits/stdc++.h> #define Mx 1000000000005 #define ll long long #define pi 3.141592653 #define vi vector<ll> #define Mo 1000000007 #define mp make_pair #define M map<ll, ll> #define fr(i, a, b) for (ll i = a; i < b; i++) #define vii vector<pair<ll, ll>> #define fi first #define se second #define pb push_back #de...
replace
45
46
45
65
TLE
p03171
C++
Time Limit Exceeded
// ############################################################################# #include "bits/stdc++.h" // ############################################################################# // Macros #define MOD 1000000007 #define eb emplace_back #define mp make_pair #define fr first #define sc second #define vec vector #...
// ############################################################################# #include "bits/stdc++.h" // ############################################################################# // Macros #define MOD 1000000007 #define eb emplace_back #define mp make_pair #define fr first #define sc second #define vec vector #...
replace
86
88
86
90
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int #define vi vector<int> #define pii pair<long long, long long> #define pll pair<int, int> #define mod 1000000007 #define hell 998244353 #define all(x) x.begin(), x.end() #define mp(x, y) make_pair(x, y) #define mem(a, val) memset(a, val, sizeof(a)) ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define vi vector<int> #define pii pair<long long, long long> #define pll pair<int, int> #define mod 1000000007 #define hell 998244353 #define all(x) x.begin(), x.end() #define mp(x, y) make_pair(x, y) #define mem(a, val) memset(a, val, sizeof(a)) ...
delete
50
55
50
50
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define err(args...) \ {} #ifdef DEBUG #include "_debug.cpp" #endif using namespace std; using ll = long long; using ld = long double; template <typename T> using lim = numeric_limits<T>; template <typename T> istream &operator>>(istre...
#include <bits/stdc++.h> #define err(args...) \ {} #ifdef DEBUG #include "_debug.cpp" #endif using namespace std; using ll = long long; using ld = long double; template <typename T> using lim = numeric_limits<T>; template <typename T> istream &operator>>(istre...
replace
26
27
26
27
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; const int N = 1e6 + 69, INF = 1e9; const ll INFLL = 1e18; int n, k; ll dp[3009][3009], A[N]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> A[i]; } for (int cnt =...
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; const int N = 1e6 + 69, INF = 1e9; const ll INFLL = 1e18; int n, k; ll dp[3009][3009], A[N]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> A[i]; } for (int cnt =...
replace
26
27
26
29
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define mod 1000000007 #define pb push_back #define ll long long #define ld long double #define ft first #define sd second using namespace std; const int N = 1e3 + 9; ll a[N]; ll dp[N][N][2]; ll solve(int l, int r, bool turn) { if (l > r) return 0; ll &ret = dp[l][r][turn]; if (ret ...
#include <bits/stdc++.h> #define mod 1000000007 #define pb push_back #define ll long long #define ld long double #define ft first #define sd second using namespace std; const int N = 3e3 + 9; ll a[N]; ll dp[N][N][2]; ll solve(int l, int r, bool turn) { if (l > r) return 0; ll &ret = dp[l][r][turn]; if (ret ...
replace
9
10
9
10
0
p03171
C++
Runtime Error
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef p...
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef p...
replace
22
23
22
23
0
p03171
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; long long max(long long a, long long b) { return a > b ? a : b; } void get_opt_scoredelta(int N, long long *A) { long long dp[N + 1][N + 1]; // dp[i][j] = score difference between current player and the other player for // the subse...
#include <algorithm> #include <iostream> #include <string> using namespace std; long long max(long long a, long long b) { return a > b ? a : b; } void get_opt_scoredelta(int N, long long *A) { long long dp[N + 1][N + 1]; // dp[i][j] = score difference between current player and the other player for // the subse...
replace
17
18
17
19
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define lli long long int #define vec2 vector<vector<lli>> #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define lli long long int #define vec2 vector<vector<lli>> #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
replace
33
34
33
34
-11
p03171
C++
Runtime Error
// In the name of GOD #include <bits/stdc++.h> #define ll long long #define pp pair<int, int> using namespace std; const int N = 3e2 + 10, MOD = 1e9 + 7; const ll INF = 1e18; vector<int> a(N); ll dp[N][N]; bool vis[N][N] = {0}; ll f(int l, int r) { if (vis[l][r]) return dp[l][r]; if (l == r) return a[l];...
// In the name of GOD #include <bits/stdc++.h> #define ll long long #define pp pair<int, int> using namespace std; const int N = 3e3 + 10, MOD = 1e9 + 7; const ll INF = 1e18; vector<int> a(N); ll dp[N][N]; bool vis[N][N] = {0}; ll f(int l, int r) { if (vis[l][r]) return dp[l][r]; if (l == r) return a[l];...
replace
6
7
6
7
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define mod ((int)1e9 + 7) #define lim 1000000000000000007 #define lim1 18446744073709551615 // Unsigned #define sq(a) ((a) * (a)) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define mms(v, i) memset...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define mod ((int)1e9 + 7) #define lim 1000000000000000007 #define lim1 18446744073709551615 // Unsigned #define sq(a) ((a) * (a)) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define mms(v, i) memset...
replace
66
67
66
67
0
p03171
C++
Time Limit Exceeded
#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 #d...
#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 #d...
replace
36
37
36
37
TLE
p03171
C++
Runtime Error
/** Which of the favors of your Lord will you deny ? **/ #include <bits/stdc++.h> using namespace std; #define LL long long #define PII pair<int, int> #define PLL pair<LL, LL> #define MP make_pair #define F first #define S second #define ALL(x) (x).begin(), (x).end() #define DBG(x) cerr << __LINE__ << " says: " << ...
/** Which of the favors of your Lord will you deny ? **/ #include <bits/stdc++.h> using namespace std; #define LL long long #define PII pair<int, int> #define PLL pair<LL, LL> #define MP make_pair #define F first #define S second #define ALL(x) (x).begin(), (x).end() #define DBG(x) cerr << __LINE__ << " says: " << ...
replace
81
82
81
82
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <chrono> #include <cstdio> #include <random> using namespace std; #define DRACARYS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #include <chrono> #include <cstdio> #include <random> using namespace std; #define DRACARYS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
replace
48
49
48
50
TLE
p03171
C++
Runtime Error
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
replace
89
90
89
90
-11
p03171
C++
Time Limit Exceeded
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; // #define int long long #define pb(x) push_back(x) #define m0(x) memset((x), 0, sizeof(x)) #define mm(x) memset((x), -1, sizeof(x)) // container #define ALL(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), ...
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; // #define int long long #define pb(x) push_back(x) #define m0(x) memset((x), 0, sizeof(x)) #define mm(x) memset((x), -1, sizeof(x)) // container #define ALL(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), ...
replace
95
96
95
96
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; using ll = long long; using ull = unsigned long long; using uint = unsigned int; using pcc = pair<char, char>; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using tuplis = pair<ll, pll>; const ll LINF = ...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; using ll = long long; using ull = unsigned long long; using uint = unsigned int; using pcc = pair<char, char>; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using tuplis = pair<ll, pll>; const ll LINF = ...
replace
180
181
180
181
-6
corrupted size vs. prev_size
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <stdio.h> using namespace std; const int MAXN = 3005; int a[MAXN]; long long dp[MAXN][MAXN]; bool used[MAXN][MAXN]; int n; long long solve(int l, int r) { if (l > r) return 0; if (used[l][r]) return dp[l][r]; long long &ans = dp[l][r]; if ((r - l) % 2 == (n - 1) % 2) { ...
#include <algorithm> #include <stdio.h> using namespace std; const int MAXN = 3005; int a[MAXN]; long long dp[MAXN][MAXN]; bool used[MAXN][MAXN]; int n; long long solve(int l, int r) { if (l > r) return 0; if (used[l][r]) return dp[l][r]; long long &ans = dp[l][r]; if ((r - l) % 2 == (n - 1) % 2) { ...
insert
23
23
23
24
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define fi first #define se second #define endl '\n' const int mod = 1e9 + 7, u = 1e3 + 5; int n, arr[u], dp[u][u]; int solve(int low, int high) { if (dp[low][high] == -1) { if (low == high) { dp[low][high...
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define fi first #define se second #define endl '\n' const int mod = 1e9 + 7, u = 3e3 + 5; int n, arr[u], dp[u][u]; int solve(int low, int high) { if (dp[low][high] == -1) { if (low == high) { dp[low][high...
replace
7
8
7
8
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; #define ll long long #define dd double #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #define ll long long using namespace std; #define ll long long #define dd double #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
replace
104
108
104
108
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define inf 0x3f3f3f3f const int N = 3e3 + 5; ll a[N], dp[N][N]; int main() { int n, i, j, L, R; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%lld", a[i]); for (L = n; i >= 1; L--) { for (R = L; R <= n; R++) { dp[L][R] = max(a[...
#include <bits/stdc++.h> using namespace std; #define ll long long #define inf 0x3f3f3f3f const int N = 3e3 + 5; ll a[N], dp[N][N]; int main() { int n, i, j, L, R; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%lld", &a[i]); for (L = n; L >= 1; L--) { for (R = L; R <= n; R++) { dp[L][R] = max(a...
replace
10
12
10
12
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define pb push_back typedef long long ll; typedef long double ld; int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); ll N = 3e2 + 10, n, i, j; cin >> n; ll a[n], dp[N][N]; for (i = 0; i < n; i++) { cin >> a[i]; } ...
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define pb push_back typedef long long ll; typedef long double ld; int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); ll N = 3e3 + 10, n, i, j; cin >> n; ll a[n], dp[N][N]; for (i = 0; i < n; i++) { cin >> a[i]; } ...
replace
11
12
11
12
0
p03171
C++
Runtime Error
#include <iostream> using namespace std; typedef long long ll; ll dp[3001][3001] = {}; ll a[3001]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) { for (int j = i; j <= n; j++) { int taken = n - i - j - 1; if (taken % 2) { // Ji...
#include <iostream> using namespace std; typedef long long ll; ll dp[3002][3002] = {}; ll a[3001]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) { for (int j = i; j <= n; j++) { int taken = n - i - j - 1; if (taken % 2) { // Ji...
replace
4
5
4
5
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long int #define off \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long int #define off \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
22
23
22
23
0
p03171
C++
Runtime Error
// L - Deque https://atcoder.jp/contests/dp/tasks/dp_l /* 入力例 4 10 80 90 30 // →出力 10 */ #include <bits/stdc++.h> using namespace std; int N; int a[4]; long long int mem[4][4]; int memflag[4][4]; long long int dp(int l, int r) { if (memflag[l][r] == 1) { return mem[l][r]; } else if (l == r) { mem[l][r] =...
// L - Deque https://atcoder.jp/contests/dp/tasks/dp_l /* 入力例 4 10 80 90 30 // →出力 10 */ #include <bits/stdc++.h> using namespace std; int N; int a[3000]; long long int mem[3000][3000]; int memflag[3000][3000]; long long int dp(int l, int r) { if (memflag[l][r] == 1) { return mem[l][r]; } else if (l == r) { ...
replace
10
13
10
13
0
p03171
C++
Time Limit Exceeded
#pragma warning(disable : 4996) #pragma comment(linker, "/STACK:336777216") #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; typedef long long ll; #define int lon...
#pragma warning(disable : 4996) #pragma comment(linker, "/STACK:336777216") #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; typedef long long ll; #define int lon...
insert
91
91
91
93
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define endl '\n' #define pll pair<int, int> #define vll vector<int> #define all(a) (a).begin(), (a).end() #define x first #define y second #define hell 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define gcd(a, b) __gcd((a), (b)) #...
#include <bits/stdc++.h> #define pb push_back #define endl '\n' #define pll pair<int, int> #define vll vector<int> #define all(a) (a).begin(), (a).end() #define x first #define y second #define hell 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define gcd(a, b) __gcd((a), (b)) #...
replace
21
22
21
22
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long using namespace std; const ll N = 3090, OO = 1e9; ll a[N], n, dp[N][N], sum; ll Dp(int i, int j) { if (i > j) { return 0; } ll &ret = dp[i][j]; ret = max(a[i] - Dp(i + 1, j), a[j] - Dp(i, j - 1)); return ret; } int main() { cin >> n; for (int i = 0; i <...
#include <bits/stdc++.h> #define ll long long using namespace std; const ll N = 3090, OO = 1e9; ll a[N], n, dp[N][N], sum; ll Dp(int i, int j) { if (i > j) { return 0; } ll &ret = dp[i][j]; if (ret != -1) return ret; ret = 0; ret = max(a[i] - Dp(i + 1, j), a[j] - Dp(i, j - 1)); return ret; } in...
insert
12
12
12
15
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0)); for (int len = 1; len <= N; len++) { for (int i = 0; i < N; i++) { int j = i ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0)); for (int len = 1; len <= N; len++) { for (int i = 0; i + len <= N; i++) { int...
replace
14
15
14
15
-11
p03171
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; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> isPair; using vvll = vector<vector<ll>>; using vll = vector<ll>; #define Pll pair<ll, ll> #defin...
#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; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> isPair; using vvll = vector<vector<ll>>; using vll = vector<ll>; #define Pll pair<ll, ll> #defin...
replace
45
47
45
47
0
p03171
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; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> isPair; using vvll = vector<vector<ll>>; using vll = vector<ll>; #define Pll pair<ll, ll> #defin...
#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; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> isPair; using vvll = vector<vector<ll>>; using vll = vector<ll>; #define Pll pair<ll, ll> #defin...
replace
46
47
46
47
0
p03171
C++
Runtime Error
// deque #include <bits/stdc++.h> #define ll long long int using namespace std; const int mod = 1e9 + 7; const int inf = (1 << 30); string toBin(ll a) { int i; string s1 = ""; while (a > 0) { if (a & 1) { s1 = "1" + s1; } else { s1 = "0" + s1; } a >>= 1; } return s1; } ll dp[5000][...
// deque #include <bits/stdc++.h> #define ll long long int using namespace std; const int mod = 1e9 + 7; const int inf = (1 << 30); string toBin(ll a) { int i; string s1 = ""; while (a > 0) { if (a & 1) { s1 = "1" + s1; } else { s1 = "0" + s1; } a >>= 1; } return s1; } ll dp[5000][...
delete
56
62
56
56
-11
p03171
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <map> #include <memory> #include <numeric> #includ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <map> #include <memory> #include <numeric> #includ...
replace
260
261
260
261
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; long long f(vector<long long> &v, int i, int j, vector<vector<long long>> dp) { if (i == j) return v[i]; if (dp[i][j] != -1) return dp[i][j]; dp[i][j] = max(v[i] - f(v, i + 1, j, dp), v[j] - f(v, i, j - 1, dp)); return dp[i][j]; } int main() { int N; ...
#include <bits/stdc++.h> using namespace std; long long f(vector<long long> &v, int i, int j, vector<vector<long long>> &dp) { if (i == j) return v[i]; if (dp[i][j] != -1) return dp[i][j]; dp[i][j] = max(v[i] - f(v, i + 1, j, dp), v[j] - f(v, i, j - 1, dp)); return dp[i][j]; } int main() { int N; ...
replace
3
4
3
4
TLE
p03171
C++
Runtime Error
//============================================================================ // Name : ProjG.cpp // Author : Yong Kiat // Version : // Copyright : By Algotae. // Description : Hello World in C++, Ansi-style //============================================================================ #include <bit...
//============================================================================ // Name : ProjG.cpp // Author : Yong Kiat // Version : // Copyright : By Algotae. // Description : Hello World in C++, Ansi-style //============================================================================ #include <bit...
replace
14
15
14
15
0
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll dp[3000][3000]; bool dpv[3000][3000]; vector<int> deq(3000); ll solve(int l, int r, int flag) { // flag = 1 -> Taro if (dpv[l][r]) return dp[l][r]; if (l > r) return 0; if (l == r) { dpv[l][r] = true; if (flag) re...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll dp[3000][3000]; bool dpv[3000][3000]; vector<int> deq(3000); ll solve(int l, int r, int flag) { // flag = 1 -> Taro if (dpv[l][r]) return dp[l][r]; if (l > r) return 0; if (l == r) { dpv[l][r] = true; if (flag) re...
insert
22
22
22
23
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define f first #define s second #define mp make_pair #define sz size() #define ll long long int n; bool was[3010][3010]; ll dp[3010][3010]; int a[3010]; ll calc(int l, int r) { if (l > ...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define f first #define s second #define mp make_pair #define sz size() #define ll long long int n; bool was[3010][3010]; ll dp[3010][3010]; int a[3010]; ll calc(int l, int r) { if (l > ...
insert
22
22
22
23
TLE
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vecto...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vecto...
insert
59
59
59
60
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define int long long using namespace std; int n; vector<int> vec; int dp[3000][3000]; int solve(int i, int j) { if (i == j) { return vec[i]; } if (dp[i][j] != -1) return dp[i][j]; int ans = max(vec[i] - solve(i + 1, j), vec[j] - solve(i, j - 1)); return ans; } int32_t mai...
#include <bits/stdc++.h> #define int long long using namespace std; int n; vector<int> vec; int dp[3000][3000]; int solve(int i, int j) { if (i == j) { return vec[i]; } if (dp[i][j] != -1) return dp[i][j]; int ans = max(vec[i] - solve(i + 1, j), vec[j] - solve(i, j - 1)); return dp[i][j] = ans; } ...
replace
16
17
16
17
TLE
p03171
C++
Runtime Error
// #include<bits/stdc++.h> // using namespace std; // typedef vector <int> vi; // typedef pair< int ,int > pii; // #define all(v) v.begin(),v.end() // #define PB push_back // #define T(val) while(val--) // #define FIN for(i=0;i<n;i++) // #define FIS for(i=0;i<s.length();i++) // #define AIN for(i=0;i<n;i++){cin>>a[i];}...
// #include<bits/stdc++.h> // using namespace std; // typedef vector <int> vi; // typedef pair< int ,int > pii; // #define all(v) v.begin(),v.end() // #define PB push_back // #define T(val) while(val--) // #define FIN for(i=0;i<n;i++) // #define FIS for(i=0;i<s.length();i++) // #define AIN for(i=0;i<n;i++){cin>>a[i];}...
replace
88
89
88
89
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 3002; ll dp[MAXN][MAXN][2]; bool vis[MAXN][MAXN]; int A[MAXN], N; // ll solve(int i, int j, int p, int diff) { // if (j == i) // { if (p == 1) // return diff + A[i]; // else return diff - A[i]; // } // //if (j < i) return...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 3002; ll dp[MAXN][MAXN][2]; bool vis[MAXN][MAXN]; int A[MAXN], N; // ll solve(int i, int j, int p, int diff) { // if (j == i) // { if (p == 1) // return diff + A[i]; // else return diff - A[i]; // } // //if (j < i) return...
replace
69
73
69
70
-11
p03171
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; ll N; ll A[3000]; ll dp[3000 + 1][3000 + 1]; ll taro(ll i, ll j); ll jiro(ll i, ll j); ll taro(ll i, ll j) { // cout << "taro: " << i << " : " << j << endl; if (i > j) { return 0; } dp[i][j] = max(A[i]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; ll N; ll A[3000]; ll dp[3000 + 1][3000 + 1]; ll taro(ll i, ll j); ll jiro(ll i, ll j); ll taro(ll i, ll j) { // cout << "taro: " << i << " : " << j << endl; if (i > j) { return 0; } if (dp[i][j] != -1) ...
insert
18
18
18
21
TLE
p03171
C++
Time Limit Exceeded
#include <iostream> #define SM 3005 using namespace std; long long n, a[SM], F[SM][SM][3]; long Try(long L, long R, int x) { if (L > R) return 0; if (x == 1) { F[L][R][x] = Try(L + 1, R, (x + 1) % 2) + a[L]; F[L][R][x] = max(F[L][R][x], Try(L, R - 1, (x + 1) % 2) + a[R]); } else { F[L][R][x] = Try...
#include <iostream> #define SM 3005 using namespace std; long long n, a[SM], F[SM][SM][3]; long Try(long L, long R, int x) { if (L > R) return 0; if (F[L][R][x] != 0) return F[L][R][x]; if (x == 1) { F[L][R][x] = Try(L + 1, R, (x + 1) % 2) + a[L]; F[L][R][x] = max(F[L][R][x], Try(L, R - 1, (x + 1)...
insert
7
7
7
9
TLE
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ui unsigned ll #define us unsigned short #define IOS ios_base::sync_with_stdio(0) #define mp(x, y) make_pair(x, y) #define pb push_back #define f first #define INF pow(10, 14) + 7 #define s second ll N = 300000; ve...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ui unsigned ll #define us unsigned short #define IOS ios_base::sync_with_stdio(0) #define mp(x, y) make_pair(x, y) #define pb push_back #define f first #define INF pow(10, 14) + 7 #define s second ll N = 300000; ve...
replace
146
147
146
147
TLE
p03171
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define inp 10 #define check exit(0) #define nl cout << endl; #define mod 1000000007 #define ll long long int #define trace(x) cerr << #x << " : " << x << endl; #define deb(v) ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define inp 3005 #define check exit(0) #define nl cout << endl; #define mod 1000000007 #define ll long long int #define trace(x) cerr << #x << " : " << x << endl; #define deb(v) ...
replace
4
5
4
5
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; using namespace std; typedef pair<int, int> pii; #define endl '\n' #define F first #define S second const int MAX_N = 3e3 + 3; int n; int a[MAX_N]; ll dp[MAX_N][MAX_N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int d = ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; typedef pair<int, int> pii; #define endl '\n' #define F first #define S second const int MAX_N = 3e3 + 3; int n; int a[MAX_N]; ll dp[MAX_N][MAX_N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int d = ...
replace
18
19
18
19
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define FOR(i, a, n) for (int i = a; i < n; i++) #define mp make_pair #define RFOR(i, a, n) for (int i = n; i > a; i--) #define pii pair<long long int, long long int> #define ub upper_bound #define lb lower_bound #define MOD 1000000007 typedef long long...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define FOR(i, a, n) for (int i = a; i < n; i++) #define mp make_pair #define RFOR(i, a, n) for (int i = n; i > a; i--) #define pii pair<long long int, long long int> #define ub upper_bound #define lb lower_bound #define MOD 1000000007 typedef long long...
replace
18
19
18
19
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX_N = 3001; int N; ll a[MAX_N]; ll dp[MAX_N][MAX_N][2]; int main() { scanf("%d", &N); for (int i = 0; i < N; ++i) scanf("%lld", &a[i]); for (int i = 0; i < N; ++i) dp[i][i][0] = dp[i][i][1] = a[i]; for (int d = 1; d <...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX_N = 3001; int N; ll a[MAX_N]; ll dp[MAX_N][MAX_N][2]; int main() { scanf("%d", &N); for (int i = 0; i < N; ++i) scanf("%lld", &a[i]); for (int i = 0; i < N; ++i) dp[i][i][0] = dp[i][i][1] = a[i]; for (int d = 1; d <...
replace
22
23
22
23
-11
p03171
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define w while #define loop(i, l, r) for (int i = l; i < r; i++) #define ci cin >> #define co cout << #define mm 1000000007 #define ll long long using namespace std; ll int helper(vector<vector<ll int>> &dp, vector<ll int> vec, int start, int last) { if (start > last) { ret...
#include <bits/stdc++.h> #define w while #define loop(i, l, r) for (int i = l; i < r; i++) #define ci cin >> #define co cout << #define mm 1000000007 #define ll long long using namespace std; ll int helper(vector<vector<ll int>> &dp, vector<ll int> &vec, int start, int last) { if (start > last) { re...
replace
8
9
8
9
TLE
p03171
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS // #include <stdafx.h> // #include "targetver.h" #include <stdio.h> // #include <tchar.h> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include ...
#define _CRT_SECURE_NO_WARNINGS // #include <stdafx.h> // #include "targetver.h" #include <stdio.h> // #include <tchar.h> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include ...
replace
67
68
67
68
0
p03171
C++
Runtime Error
#include <bits/stdc++.h> typedef long long int ll; using namespace std; ll pref_sum[3000][3000], dp[3000][3000]; int a[3000]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; memset(pref_sum, 0, sizeof(pref_sum)); memset(dp, 0, sizeof(dp)); for (int i = 0; i < n; i++) { pref_su...
#include <bits/stdc++.h> typedef long long int ll; using namespace std; ll pref_sum[3000][3000], dp[3000][3000]; int a[3000]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; if (n == 1) { cout << a[0] << endl; return 0; } memset(pref_sum, 0, sizeof(pref_sum)); memset(dp,...
insert
10
10
10
14
-11
p03171
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<vector<long long int>> ve; long long int recurse(long long int *arr, int i, int j) { if (i > j) { return 0; } else if (i == j) { ve[i][j] = arr[i]; // cout<<i<<" "<<j<<" "<<ve[i][j]<<endl; return arr[i]; } else if ((i + 1) == j) { long long ...
#include <bits/stdc++.h> using namespace std; vector<vector<long long int>> ve; long long int recurse(long long int *arr, int i, int j) { if (i > j) { return 0; } else if (i == j) { ve[i][j] = arr[i]; // cout<<i<<" "<<j<<" "<<ve[i][j]<<endl; return arr[i]; } else if ((i + 1) == j) { long long ...
insert
24
24
24
25
0