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
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct iofix { ios_base::Init i; iofix() { cin.sync_with_stdio(0); cin.tie(0); cout.sync_with_stdio(0); cout.tie(0); cout.precision(10); cout << fixed; } } iofix; void solve() { int N; cin >> N; vector<int64_t> dp(3, 0); for (int i = 0...
#include <bits/stdc++.h> using namespace std; struct iofix { ios_base::Init i; iofix() { cin.sync_with_stdio(0); cin.tie(0); cout.sync_with_stdio(0); cout.tie(0); cout.precision(10); cout << fixed; } } iofix; void solve() { int N; cin >> N; vector<int64_t> dp(3, 0); for (int i = 0...
replace
20
21
20
21
0
Time elapsed: 0.032898 s.
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define repi(i, n, m) for (int i = (int)(n); i < (int)(m); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; usin...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define repi(i, n, m) for (int i = (int)(n); i < (int)(m); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; usin...
replace
15
16
15
16
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define f0(i, n) for (long long int i = 0; i < n; i++) #define f1(i, n) for (long long int i = 1; i <= n; i++) #define f2(i, a, b) for (long long int i = a; i <= b; i++) #define sp << " " // giving space #define sp1 << " " << // giving space between two elements #define nl << "/n" // ...
#include <bits/stdc++.h> #define f0(i, n) for (long long int i = 0; i < n; i++) #define f1(i, n) for (long long int i = 1; i <= n; i++) #define f2(i, a, b) for (long long int i = a; i <= b; i++) #define sp << " " // giving space #define sp1 << " " << // giving space between two elements #define nl << "/n" // ...
delete
110
118
110
110
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define pi pair<ll, ll> #define pii pair<ll, pi> #define pb push_back #define mk make_pair const int inf = 1e9; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define pi pair<ll, ll> #define pii pair<ll, pi> #define pb push_back #define mk make_pair const int inf = 1e9; int main() { // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt"...
replace
11
15
11
15
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int INT_INF = 2147483647; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) {...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int INT_INF = 2147483647; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) {...
replace
38
39
38
39
0
p03162
C++
Runtime Error
#include <algorithm> #include <iostream> #include <math.h> #include <vector> typedef long long ll; // max ll constant = LLONG_MAX using namespace std; vector<vector<int>> A(100000, vector<int>(3)); vector<vector<int>> dp(10000, vector<int>(3, -1)); int idx, N; int f, s, ans = -1; int main() { cin >> N; for (in...
#include <algorithm> #include <iostream> #include <math.h> #include <vector> typedef long long ll; // max ll constant = LLONG_MAX using namespace std; vector<vector<int>> A(100000, vector<int>(3)); vector<vector<int>> dp(100000, vector<int>(3, -1)); int idx, N; int f, s, ans = -1; int main() { cin >> N; for (i...
replace
10
11
10
11
0
p03162
C++
Runtime Error
/// dp solution #include <bits/stdc++.h> using namespace std; const int N = 10007; long long dp[N][3]; int main() { int n, A[N], B[N], C[N]; cin >> n; for (int i = 0; i < n; ++i) cin >> A[i] >> B[i] >> C[i]; dp[0][0] = A[0], dp[0][1] = B[0], dp[0][2] = C[0]; for (int i = 1; i < n; ++i) { dp[i][0] = A[...
/// dp solution #include <bits/stdc++.h> using namespace std; const int N = 100007; long long dp[N][3]; int main() { int n, A[N], B[N], C[N]; cin >> n; for (int i = 0; i < n; ++i) cin >> A[i] >> B[i] >> C[i]; dp[0][0] = A[0], dp[0][1] = B[0], dp[0][2] = C[0]; for (int i = 1; i < n; ++i) { dp[i][0] = A...
replace
3
4
3
4
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MAX 1000000007 template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int hpns[10010][3];...
#include <bits/stdc++.h> using namespace std; #define MAX 1000000007 template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int hpns[100010][3]...
replace
19
21
19
21
0
p03162
C++
Runtime Error
#include <iostream> using namespace std; long long n, f[4][100004], a[4][100005]; int main() { cin >> n; for (long long i = 1; i <= n; ++i) { cin >> a[i][1] >> a[i][2] >> a[i][3]; } f[1][1] = a[1][1]; f[1][2] = a[1][2]; f[1][3] = a[1][3]; for (long long i = 2; i <= n; ++i) { for (long long j = 1; ...
#include <iostream> using namespace std; long long n, f[100005][4], a[100005][4]; int main() { cin >> n; for (long long i = 1; i <= n; ++i) { cin >> a[i][1] >> a[i][2] >> a[i][3]; } f[1][1] = a[1][1]; f[1][2] = a[1][2]; f[1][3] = a[1][3]; for (long long i = 2; i <= n; ++i) { for (long long j = 1; ...
replace
2
3
2
3
0
p03162
C++
Runtime Error
#include <cstdlib> #include <iostream> using namespace std; int n; long long a[1010]; long long b[1010]; long long c[1010]; long long dp[10010][3]; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i]; for (int i = 0; i < n; ++i) { for (int j = 0; j <= 2; ++j) { dp[i][j] ...
#include <cstdlib> #include <iostream> using namespace std; int n; long long a[100010]; long long b[100010]; long long c[100010]; long long dp[100010][3]; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i]; for (int i = 0; i < n; ++i) { for (int j = 0; j <= 2; ++j) { dp...
replace
5
9
5
9
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define fin for (i = 0; i < n; i++) #define vec vector<ll> #define pb push_back #define vecit vector<ll>::iterator #define vecp vector<pair<ll, ll>> #define vecpit vector<pair<ll, ll>>::iterator #define mapp map<ll, ll> #define mapr map<ll, pair<ll, ll>> #define maprit ...
#include <bits/stdc++.h> #define ll long long int #define fin for (i = 0; i < n; i++) #define vec vector<ll> #define pb push_back #define vecit vector<ll>::iterator #define vecp vector<pair<ll, ll>> #define vecpit vector<pair<ll, ll>>::iterator #define mapp map<ll, ll> #define mapr map<ll, pair<ll, ll>> #define maprit ...
replace
19
20
19
20
-11
p03162
C++
Time Limit Exceeded
// author: chinmay0402 // One day your whole life will flash before your eyes, make sure you make it // worth watching #include <bits/stdc++.h> using namespace std; // policy based data structures #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
// author: chinmay0402 // One day your whole life will flash before your eyes, make sure you make it // worth watching #include <bits/stdc++.h> using namespace std; // policy based data structures #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
replace
226
229
226
236
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[10001][3]; int main() { int n; cin >> n; for (int i = 0; i < 10001; i++) { for (int j = 0; j < 3; j++) { dp[i][j] = 0; } } vector<int> a(n); vector<int> b(n); vector<int> c(n); for (int i = 0; i < n; i++) { cin >> a[i]; cin >> b[...
#include <bits/stdc++.h> using namespace std; int dp[100001][3]; int main() { int n; cin >> n; for (int i = 0; i < 10001; i++) { for (int j = 0; j < 3; j++) { dp[i][j] = 0; } } vector<int> a(n); vector<int> b(n); vector<int> c(n); for (int i = 0; i < n; i++) { cin >> a[i]; cin >> b...
replace
2
3
2
3
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll n; cin >> n; ll a[n][3]; ll i, j; for (i = 0; i < n; i++) { for (j = 0; j < 3; j++) { cin >> a[i][j]; } } ll dp[n][n]; dp[0][0] = a[0][0]; dp[0][1] = a[0][1]; dp[0][2] = a[0][2]; for (i = 1; i < ...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll n; cin >> n; ll a[n][3]; ll i, j; for (i = 0; i < n; i++) { for (j = 0; j < 3; j++) { cin >> a[i][j]; } } ll dp[n][3]; dp[0][0] = a[0][0]; dp[0][1] = a[0][1]; dp[0][2] = a[0][2]; for (i = 1; i < ...
replace
15
16
15
16
0
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int n; int mem[MAXN][4]; int a[MAXN], b[MAXN], c[MAXN]; int solve(int i, int prev) { if (i == n) return 0; int &ret = mem[i][prev]; int c1 = -1e9, c2 = -1e9, c3 = -1e9; if (prev != 1) c1 = solve(i + 1, 1) + a[i]; if (prev !=...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int n; int mem[MAXN][4]; int a[MAXN], b[MAXN], c[MAXN]; int solve(int i, int prev) { if (i == n) return 0; int &ret = mem[i][prev]; if (ret != -1) return ret; int c1 = -1e9, c2 = -1e9, c3 = -1e9; if (prev != 1) c1 = solv...
insert
14
14
14
16
TLE
p03162
C++
Runtime Error
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int k[3][10001]; int dp[3][10001] = {}; for (int i = 0; i < n; i++) { cin >> k[0][i + 1] >> k[1][i + 1] >> k[2][i + 1]; } for (int i = 0; i < n; i++) { ...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int k[3][100001]; int dp[3][100001] = {}; for (int i = 0; i < n; i++) { cin >> k[0][i + 1] >> k[1][i + 1] >> k[2][i + 1]; } for (int i = 0; i < n; i++) ...
replace
10
12
10
12
0
p03162
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; const ll INF = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); i++) vector<vector<ll>> me...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; const ll INF = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); i++) vector<vector<ll>> me...
replace
19
20
19
20
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #ifdef DEBUG #define PRINT(x) \ cout << "func " << __func__ << ": line " << __LINE__ << ": " << #x << " = " \ << (x) << endl; #define PRINTA(a, first, last) \ cout << "func...
#include <bits/stdc++.h> #ifdef DEBUG #define PRINT(x) \ cout << "func " << __func__ << ": line " << __LINE__ << ": " << #x << " = " \ << (x) << endl; #define PRINTA(a, first, last) \ cout << "func...
replace
42
43
42
43
0
p03162
C++
Runtime Error
#include <cstring> #include <iostream> #include <string> using namespace std; int dp[10001][3]; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int n; cin >> n; memset(dp, 0, sizeof(dp)); int a[n][3]; for (int i = 0; i < n; ...
#include <cstring> #include <iostream> #include <string> using namespace std; int dp[100001][3]; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int n; cin >> n; memset(dp, 0, sizeof(dp)); int a[n][3]; for (int i = 0; i < n;...
replace
6
7
6
7
0
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define int long long using namespace ...
#include <bits/stdc++.h> #define IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define int long long using namespace ...
replace
23
24
23
24
TLE
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define int long long using namespace ...
#include <bits/stdc++.h> #define IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define int long long using namespace ...
replace
24
25
24
25
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> #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++) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define all(v) v.begin(), v.end()...
#include <bits/stdc++.h> #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++) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define all(v) v.begin(), v.end()...
replace
28
30
28
31
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define INF (1e10) #define mp make_pair #define pb push_back #define A 0 #define B 1 #define C 2 using namespace std; typedef long long int lo; lo dp[10000005][3], arr[10000005][3], n; lo f(lo i, lo c) { if (i == n) return dp[i][c] = arr[i][c]; if (dp[i][c] != 0) return dp[i][c]; ...
#include <bits/stdc++.h> #define INF (1e10) #define mp make_pair #define pb push_back #define A 0 #define B 1 #define C 2 using namespace std; typedef long long int lo; lo dp[10000005][3], arr[10000005][3], n; lo f(lo i, lo c) { if (i == n) return dp[i][c] = arr[i][c]; if (dp[i][c] != 0) return dp[i][c]; ...
replace
24
26
24
26
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<string> vec_splitter(string s) { s += ','; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) args, ...
#include <bits/stdc++.h> using namespace std; vector<string> vec_splitter(string s) { s += ','; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) args, ...
replace
75
76
75
76
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll mod = 1e9 + 7; #define rep(i, a, b) for (ll i = a; i < b; i++) void swap(ll &a, ll &b) { ll t = a; a = b; b = t; } ll min(ll a, ll b) { if (a < b) return a; return b; } ll max(ll a, ll b) { if (a > b) return a; ret...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll mod = 1e9 + 7; #define rep(i, a, b) for (ll i = a; i < b; i++) void swap(ll &a, ll &b) { ll t = a; a = b; b = t; } ll min(ll a, ll b) { if (a < b) return a; return b; } ll max(ll a, ll b) { if (a > b) return a; ret...
replace
47
48
47
48
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int INF = 2000000000; const int N_MAX = 10010; int main() { int n; cin >> n; vector<int> A(N_MAX), B(N_MAX), C(N_MAX); for (int i = 0; i < n; i++) { cin >> A[i] >> B[i] >> C[i]; } // dp[i][j]: i日目にjをやった時の幸福度 // j: 0 => A, 1 => B, 2 => C int dp[N...
#include <bits/stdc++.h> using namespace std; const int INF = 2000000000; const int N_MAX = 100100; int main() { int n; cin >> n; vector<int> A(N_MAX), B(N_MAX), C(N_MAX); for (int i = 0; i < n; i++) { cin >> A[i] >> B[i] >> C[i]; } // dp[i][j]: i日目にjをやった時の幸福度 // j: 0 => A, 1 => B, 2 => C int dp[...
replace
4
5
4
5
0
p03162
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespac...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespac...
replace
46
47
46
47
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; #define int long long #define fast ...
#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<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; #define int long long #define fast ...
replace
63
64
63
64
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll long long #define pll p...
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll long long #define pll p...
replace
25
26
25
26
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rp(i, n) for (int i = 0; i < (int)(n); ++i) #define rep(i, x, n) for (int i = ...
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rp(i, n) for (int i = 0; i < (int)(n); ++i) #define rep(i, x, n) for (int i = ...
replace
31
32
31
32
0
p03162
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; #define db(x) cerr << #x << " == " << x << endl #define all(container) container.begin(), container.end() #define mp(i, j) make_pair(i, j) #define pb push_back typedef pair<int, int> pii; typedef long long ll; typedef vector<ll> vll; typedef vector<int> vi; typedef vector...
#include "bits/stdc++.h" using namespace std; #define db(x) cerr << #x << " == " << x << endl #define all(container) container.begin(), container.end() #define mp(i, j) make_pair(i, j) #define pb push_back typedef pair<int, int> pii; typedef long long ll; typedef vector<ll> vll; typedef vector<int> vi; typedef vector...
insert
39
39
39
40
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define fi first #define sec second #define MOD 1000000007 #define pb push_back #define test cout << "debuged\n"; #define INF 10000000000 #define si 1000000 #define debug(x) cout << x << "\n"; int main() { ios_base::sync_with_stdio(false); cin...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define fi first #define sec second #define MOD 1000000007 #define pb push_back #define test cout << "debuged\n"; #define INF 10000000000 #define si 1000000 #define debug(x) cout << x << "\n"; int main() { ios_base::sync_with_stdio(false); cin...
replace
15
19
15
16
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03162
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 1; i <=...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 1; i <=...
replace
31
32
31
32
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[10004][3]; int main() { int n; cin >> n; int ar[n][3]; for (int i = 0; i < n; i++) { cin >> ar[i][0] >> ar[i][1] >> ar[i][2]; } dp[0][0] = ar[0][0]; dp[0][1] = ar[0][1]; dp[0][2] = ar[0][2]; for (int i = 1; i < n; i++) { dp[i][0] = max(dp[i...
#include <bits/stdc++.h> using namespace std; int dp[100004][3]; int main() { int n; cin >> n; int ar[n][3]; for (int i = 0; i < n; i++) { cin >> ar[i][0] >> ar[i][1] >> ar[i][2]; } dp[0][0] = ar[0][0]; dp[0][1] = ar[0][1]; dp[0][2] = ar[0][2]; for (int i = 1; i < n; i++) { dp[i][0] = max(dp[...
replace
3
4
3
4
0
p03162
C++
Runtime Error
// Includes #include <algorithm> #include <assert.h> #include <bitset> #include <cstdlib> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <sta...
// Includes #include <algorithm> #include <assert.h> #include <bitset> #include <cstdlib> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <sta...
delete
66
70
66
66
0
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define ld long double #define ull unsigned long long int #define MOD (ll)(1e9 + 7) #define vi vector<int> #define vl vector<long> #define vll vector<ll> #define vs vector<string> #define pll pair<ll, ll> #define mll map<ll, ll> #defi...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define ld long double #define ull unsigned long long int #define MOD (ll)(1e9 + 7) #define vi vector<int> #define vl vector<long> #define vll vector<ll> #define vs vector<string> #define pll pair<ll, ll> #define mll map<ll, ll> #defi...
replace
68
79
68
90
TLE
p03162
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> A, B, C; vector<long long> Ma, Mb, Mc; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; A.push_back(a); B.push_back(b); C.push_back(c); } Ma.push_back(A[0]); Mb.push...
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> A, B, C; vector<long long> Ma, Mb, Mc; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; A.push_back(a); B.push_back(b); C.push_back(c); } Ma.push_back(A[0]); Mb.push...
replace
23
26
23
26
0
p03162
C++
Time Limit Exceeded
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <math.h> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> //------------------------------------------------------------------------------ #define fio ios_base::sync_with_stdio(false)...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <math.h> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> //------------------------------------------------------------------------------ #define fio ios_base::sync_with_stdio(false)...
replace
40
41
40
41
TLE
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int func(int n, int m, int A[][3], int dp[][3]) { if (n < 0) return 0; if (n == 0) return 0; int maxi = 0; for (int i = 0; i <= 2; i++) { if (i != m) { int x = A[n - 1][i] + func(n - 1, i, A, dp); if (x > maxi) maxi = x; } } r...
#include <bits/stdc++.h> using namespace std; int func(int n, int m, int A[][3], int dp[][3]) { if (n < 0) return 0; if (n == 0) return 0; if (dp[n][m] != -1) return dp[n][m]; int maxi = 0; for (int i = 0; i <= 2; i++) { if (i != m) { int x = A[n - 1][i] + func(n - 1, i, A, dp); if...
insert
7
7
7
9
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long a[100001], b[100001], c[100001], dp[1001][1001], n; long long cal(long long idx, long long v) { // cout<<dp[idx][v]<<' '<<idx<<endl; if (idx > n) return 0; if (dp[idx][v] != -1) return dp[idx][v]; else dp[idx][v] = 0; if (v == 0) dp[idx][...
#include <bits/stdc++.h> using namespace std; long long a[100001], b[100001], c[100001], dp[100001][3], n; long long cal(long long idx, long long v) { // cout<<dp[idx][v]<<' '<<idx<<endl; if (idx > n) return 0; if (dp[idx][v] != -1) return dp[idx][v]; else dp[idx][v] = 0; if (v == 0) dp[idx][v...
replace
2
3
2
3
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 #define PI 3.14159265358979323846 #define INF 1e9 + 5 using namespace std; int solve() { int n; cin >> n; vector<int> dp(3); for (int day = 0; day < n; day++) { vector<int> new_dp(3); vector<int> a(3); for (int i = 0; i < 3; i++)...
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 #define PI 3.14159265358979323846 #define INF 1e9 + 5 using namespace std; int solve() { int n; cin >> n; vector<int> dp(3); for (int day = 0; day < n; day++) { vector<int> new_dp(3); vector<int> a(3); for (int i = 0; i < 3; i++)...
replace
19
21
19
21
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a ...
replace
42
43
42
43
0
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long lli; typedef long double lld; #define mod 1000000007 #define mod2 998244353 #define fori(n) for (int i = 0; i < n; i++) #define forj(n) for (int j = 0; j < n; j++) #define pb push_back #define mp make_pair #define F first #define S second #define fast ios:...
#include <bits/stdc++.h> using namespace std; typedef long long lli; typedef long double lld; #define mod 1000000007 #define mod2 998244353 #define fori(n) for (int i = 0; i < n; i++) #define forj(n) for (int j = 0; j < n; j++) #define pb push_back #define mp make_pair #define F first #define S second #define fast ios:...
replace
61
63
61
64
TLE
p03162
C++
Runtime Error
// Author:: Pham Ngoc Minh- Chuyen Thai Binh #include <bits/stdc++.h> using namespace std; #define f first #define s second #define ll long long #define fl float #define db double #define ii pair<ll, ll> #define pii pair<ii, ii> #define ford(i, a, b) for (int i = a; i <= b; i++) #define foru(i, a, b) for (int i = a; i ...
// Author:: Pham Ngoc Minh- Chuyen Thai Binh #include <bits/stdc++.h> using namespace std; #define f first #define s second #define ll long long #define fl float #define db double #define ii pair<ll, ll> #define pii pair<ii, ii> #define ford(i, a, b) for (int i = a; i <= b; i++) #define foru(i, a, b) for (int i = a; i ...
replace
18
19
18
19
0
p03162
Python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**6) n = int(input()) abc = [list(map(int, input().split())) for _ in range(n)] def recur(i, last_index, v): if i == n: return v res = -1 for j in range(3): if j == last_index: continue res = max(res, recur(i + 1, j, v + abc[i][j])) ...
import sys sys.setrecursionlimit(10**6) n = int(input()) abc = [list(map(int, input().split())) for _ in range(n)] dp = [[0, 0, 0] for _ in range(n)] dp[0] = abc[0] for i in range(1, n): dp[i][0] = abc[i][0] + max(dp[i - 1][1], dp[i - 1][2]) dp[i][1] = abc[i][1] + max(dp[i - 1][0], dp[i - 1][2]) dp[i][2]...
replace
7
20
7
14
TLE
p03162
Python
Time Limit Exceeded
import numpy as np N = int(input()) values = np.array([list(map(int, input().split(" "))) for _ in range(N)]) dp = np.zeros(shape=(N, 3), dtype=int) dp[0] = values[0] for i in range(1, N): dp[i][0] = np.max(values[i][0] + dp[i - 1][1:3]) dp[i][1] = np.max(values[i][1] + dp[i - 1][0::2]) dp[i][2] = np.ma...
import numpy as np N = int(input()) values = np.array([list(map(int, input().split(" "))) for _ in range(N)]) dp = np.zeros(shape=(N, 3), dtype=int) dp[0] = values[0] for i in range(1, N): prev = dp[i - 1] dp[i][0] = values[i][0] + max(prev[1], prev[2]) dp[i][1] = values[i][1] + max(prev[0], prev[2]) ...
replace
10
13
10
14
TLE
p03162
Python
Runtime Error
import sys sys.setrecursionlimit(10**7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) ABC = [[int(x) for x in readline().split()] for _ in range(N)] dp = [[0] * 3 for _ in range(10 * 5 + 10)] for i in range(N): for j in range(3): ...
import sys sys.setrecursionlimit(10**7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) ABC = [[int(x) for x in readline().split()] for _ in range(N)] dp = [[0] * 3 for _ in range(10**5 + 10)] for i in range(N): for j in range(3): ...
replace
11
12
11
12
0
p03162
C++
Runtime Error
#include <stdio.h> #include <vector> using namespace std; const int C = 150001; int n, k, a, b, c, dp[2][C]; int abs(int a) { return (a > 0) ? (a) : (-a); } int main() { int j; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d %d", &a, &b, &c); dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + a;...
#include <stdio.h> #include <vector> using namespace std; const int C = 150001; int n, k, a, b, c, dp[3][C]; int abs(int a) { return (a > 0) ? (a) : (-a); } int main() { int j; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d %d", &a, &b, &c); dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + a;...
replace
5
6
5
6
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { int N; cin >> N; ll dp[11000][2][2][2]; for (int i = 0; i < 11000; i++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) for (int l = 0; l < 2; l++) dp[i][j][k][l] = 0; ll a[N + 1]; ll b[...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { int N; cin >> N; ll dp[110000][2][2][2]; for (int i = 0; i < 110000; i++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) for (int l = 0; l < 2; l++) dp[i][j][k][l] = 0; ll a[N + 1]; ll ...
replace
6
8
6
8
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<ll> vecl; typedef pair<ll, ll> pairl; template <typename T, typename U> using mapv = map<T, vector<U>>; #define ALL(v) v.begin(), v.end() #define REP(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) REP(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<ll> vecl; typedef pair<ll, ll> pairl; template <typename T, typename U> using mapv = map<T, vector<U>>; #define ALL(v) v.begin(), v.end() #define REP(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) REP(...
replace
128
129
128
129
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define nl "\n" #define ff first #define ss second #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define bs binary_search #define pll pair<ll, ll> #define ppll pair<ll, pll> #define sll stack<ll> #define qll qu...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define nl "\n" #define ff first #define ss second #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define bs binary_search #define pll pair<ll, ll> #define ppll pair<ll, pll> #define sll stack<ll> #define qll qu...
replace
68
72
68
72
-11
p03162
C++
Runtime Error
#include <iostream> using namespace std; typedef long long ll; ll dp[100005][3]; int main(int argc, char *argv[]) { int N, a[10005] = {0}, b[10005] = {0}, c[10005] = {0}; cin >> N; for (int i = 0; i < N; i++) { cin >> a[i] >> b[i] >> c[i]; } dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0]; f...
#include <iostream> using namespace std; typedef long long ll; ll dp[100005][3]; int main(int argc, char *argv[]) { int N, a[100005] = {0}, b[100005] = {0}, c[100005] = {0}; cin >> N; for (int i = 0; i < N; i++) { cin >> a[i] >> b[i] >> c[i]; } dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0]; ...
replace
9
10
9
10
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") /* |||||||||||||||||||||||||||||||||||||||||||||||| | ||| | |||| |||| | | | | | | | | | | | | | | | | | | | | | | | | ...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") /* |||||||||||||||||||||||||||||||||||||||||||||||| | ||| | |||| |||| | | | | | | | | | | | | | | | | | | | | | | | | ...
replace
112
115
112
113
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vvl = vector<vl>; using pll = pair<ll, ll>; using vpll = vector<pll>; using vb = vector<bool>; using vs = vector<string>; const ll oo = 0x3f3f3f3f3f3f3f3fLL; const ld eps = 1e-9; #define sz(c) ll((c...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vvl = vector<vl>; using pll = pair<ll, ll>; using vpll = vector<pll>; using vb = vector<bool>; using vs = vector<string>; const ll oo = 0x3f3f3f3f3f3f3f3fLL; const ld eps = 1e-9; #define sz(c) ll((c...
replace
28
30
28
30
0
p03162
C++
Time Limit Exceeded
// Suraj Saste #include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define pi pair<ll, ll> #define in insert #define fe first #define se second #define ms(x, i) memset(x, i, sizeof(x)) #define prec(x) cout << std::setprecision(x) #define mod 1000000007 #define all(x) x.begin(),...
// Suraj Saste #include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define pi pair<ll, ll> #define in insert #define fe first #define se second #define ms(x, i) memset(x, i, sizeof(x)) #define prec(x) cout << std::setprecision(x) #define mod 1000000007 #define all(x) x.begin(),...
replace
58
59
58
59
TLE
p03162
C++
Time Limit Exceeded
#include <fstream> #include <iostream> #include <vector> using namespace std; int rezolvare(int n, vector<int> a, vector<int> b, vector<int> c, int imp, int **&memo) { int rezultat = 0; if (n == -1) return 0; if (memo[n][imp] != 0) return memo[n][imp]; if (imp == 0) { int temp1, temp2,...
#include <fstream> #include <iostream> #include <vector> using namespace std; int rezolvare(int n, vector<int> &a, vector<int> &b, vector<int> &c, int imp, int **&memo) { int rezultat = 0; if (n == -1) return 0; if (memo[n][imp] != 0) return memo[n][imp]; if (imp == 0) { int temp1, tem...
replace
4
5
4
5
TLE
p03162
C++
Runtime Error
/* Competitive programming template Author: Aswin Sampath */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<int> vi; typedef priority_queue<ll, vl, greater<ll>()> pq_ll_min; typedef priority_queue<ll> pq_ll_...
/* Competitive programming template Author: Aswin Sampath */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<int> vi; typedef priority_queue<ll, vl, greater<ll>()> pq_ll_min; typedef priority_queue<ll> pq_ll_...
replace
65
66
65
66
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater<i...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater<i...
delete
34
38
34
34
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define MOD 1000000007 template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b...
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define MOD 1000000007 template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b...
replace
29
30
29
30
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define Fast_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); int32_t main...
#include <bits/stdc++.h> using namespace std; #define Fast_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); int32_t main...
replace
9
10
9
10
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; const int MOD = 1000000007; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a =...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; const int MOD = 1000000007; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a =...
replace
25
27
25
27
0
p03162
C++
Runtime Error
// [amitdu6ey] // g++ -std=c++11 -o2 -Wall filename.cpp -o filename #include <bits/stdc++.h> #define hell 1000000009 #define bug1(x) cout << "$ " << x << " $" << endl #define bug2(x) cout << "% " << x << " %" << endl #define bug3(x) cout << "# " << x << " #" << endl #define ll long long #define pb push_back #define mp...
// [amitdu6ey] // g++ -std=c++11 -o2 -Wall filename.cpp -o filename #include <bits/stdc++.h> #define hell 1000000009 #define bug1(x) cout << "$ " << x << " $" << endl #define bug2(x) cout << "% " << x << " %" << endl #define bug3(x) cout << "# " << x << " #" << endl #define ll long long #define pb push_back #define mp...
replace
26
28
26
28
0
p03162
Python
Runtime Error
# dp[i日目][i-1日目にどれを選んだか] = i日目までの最大の幸福度 n = int(input()) a, b, c = [0 for _ in range(n)], [0 for _ in range(n)], [0 for _ in range(n)] for i in range(n): a[i], b[i], c[i] = map(int, input().split()) dp = [[-1 for _ in range(3)] for _ in range(n + 1)] for i in range(3): dp[0][i] = 0 def rec(i, choice): if...
# dp[i日目][i-1日目にどれを選んだか] = i日目までの最大の幸福度 import sys sys.setrecursionlimit(10**8) n = int(input()) a, b, c = [0 for _ in range(n)], [0 for _ in range(n)], [0 for _ in range(n)] for i in range(n): a[i], b[i], c[i] = map(int, input().split()) dp = [[-1 for _ in range(3)] for _ in range(n + 1)] for i in range(3): ...
insert
1
1
1
5
0
p03162
C++
Runtime Error
#include <cstdlib> #include <iostream> #include <vector> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int N; lon...
#include <cstdlib> #include <iostream> #include <vector> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int N; lon...
replace
21
23
21
23
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define fo(i, n) for (int i = 0; i < n; i++) #define rfo(i, n) for (int i = n - 1; i >= 0; i--) #define Fo(i, q, n) for (int i = q; i < n; i++) #define rFo(i, q, n) for (int i = n - 1; i >= q; i--) #define fO(i, n, k) for (int i = 0; i < n; i += k) #define FO(i, q, n, k) fo...
#include <bits/stdc++.h> #define ll long long #define fo(i, n) for (int i = 0; i < n; i++) #define rfo(i, n) for (int i = n - 1; i >= 0; i--) #define Fo(i, q, n) for (int i = q; i < n; i++) #define rFo(i, q, n) for (int i = n - 1; i >= q; i--) #define fO(i, n, k) for (int i = 0; i < n; i += k) #define FO(i, q, n, k) fo...
replace
35
40
35
37
0
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long int #define all(x) x.begin(), x.end() #define MOD 1000000007 #define vi vector<int> #define pii pair<int, int> #define INF (int)1e9 #define pb push_back #define fastIO \ ios::sync_with_st...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define all(x) x.begin(), x.end() #define MOD 1000000007 #define vi vector<int> #define pii pair<int, int> #define INF (int)1e9 #define pb push_back #define fastIO \ ios::sync_with_st...
insert
22
22
22
24
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<vector<ll>> a(n, vector<ll>(n)); for (int i = 0; i < n; i++) { cin >> a[i][0]; cin >> a[i][1]; cin >> a[i][2]; } ll dp[100010][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3;...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; ll a[100010][3] = {}; ll dp[100010][3] = {}; for (int i = 0; i < n; i++) for (int j = 0; j < 3; j++) cin >> a[i][j]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { for (int k ...
replace
7
14
7
12
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int dp[n][n]; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; if (i == 0) { dp[i][0] = a; dp[i][1] = b; dp[i][2] = c; } else { dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long int dp[112345][3]; // int dp[n][n]; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; if (i == 0) { dp[i][0] = a; dp[i][1] = b; dp[i][2] = c; } else { dp[i][0] = max(dp[i ...
replace
5
6
5
7
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define loop(a, b, inc) for (int i = a; i <= b; i += inc) typedef pair<int, int> pii; typedef pair<int, string> ps; typedef unsigned long long int llu; typedef long long int ll; typedef unsigned u; const int MOD = 1e7 + 9, MAXN = 1e5 + 100; int dp[MAXN...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define loop(a, b, inc) for (int i = a; i <= b; i += inc) typedef pair<int, int> pii; typedef pair<int, string> ps; typedef unsigned long long int llu; typedef long long int ll; typedef unsigned u; const int MOD = 1e7 + 9, MAXN = 1e6 + 100; int dp[MAXN...
replace
9
10
9
10
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> using namespace std; const int Nmax = 1e5 + 5; int N, S, Max, p; int a[Nmax][3], dp[Nmax][3]; int main() { scanf("%d", &N); for (int i = 1; i <= N; ++i) { scanf("%d%d%d", a[i][0], a[i][1], a[i][2]); for (int j = 0; j < 3; ++j) { for (i...
#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> using namespace std; const int Nmax = 1e5 + 5; int N, S, Max, p; int a[Nmax][3], dp[Nmax][3]; int main() { scanf("%d", &N); for (int i = 1; i <= N; ++i) { scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]); for (int j = 0; j < 3; ++j) { for...
replace
13
14
13
14
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI acos(-1) #define mx 1000 int fx[] = {0, 0, -1, 1}; int fy[] = {1, -1, 0, 0}; int a[mx], b[mx], c[mx]; int dp[mx][3]; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, i, j, res = 0; cin >> n; for (i = 0; i < n; i++) { cin >...
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI acos(-1) #define mx 100005 int fx[] = {0, 0, -1, 1}; int fy[] = {1, -1, 0, 0}; int a[mx], b[mx], c[mx]; int dp[mx][3]; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, i, j, res = 0; cin >> n; for (i = 0; i < n; i++) { cin...
replace
4
5
4
5
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> dp(3, 0); for (int day = 0; day < n; day++) { vector<int> c(3, 0); vector<int> new_dp(3, 0); for (int i = 0; i < 3; i++) { cin >> c[i]; } for (int i = 0; i < 3; i++) { for (int j = 0; j < n;...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> dp(3, 0); for (int day = 0; day < n; day++) { vector<int> c(3, 0); vector<int> new_dp(3, 0); for (int i = 0; i < 3; i++) { cin >> c[i]; } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3;...
replace
15
16
15
16
0
p03162
C++
Runtime Error
// Utkarsh-raj #include <bits/stdc++.h> #define ll long long int #define vc vector #define mod 100000000007 #define mp make_pair #define pb push_back #define nl cout << endl; #define ff first #define ss second using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ifstream myFile(...
// Utkarsh-raj #include <bits/stdc++.h> #define ll long long int #define vc vector #define mod 100000000007 #define mp make_pair #define pb push_back #define nl cout << endl; #define ff first #define ss second using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ifstream myFile(...
replace
27
28
27
28
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) FOR(i, 0, b) #define INF mugen #define dump(x) cerr << #x << "=" << x << endl #define all(a) (a).begin(), (a).end() typedef vector<int> vi; typedef vector<vi> vii; typedef vector<vii> viii; typedef pair<int,...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) FOR(i, 0, b) #define INF mugen #define dump(x) cerr << #x << "=" << x << endl #define all(a) (a).begin(), (a).end() typedef vector<int> vi; typedef vector<vi> vii; typedef vector<vii> viii; typedef pair<int,...
replace
30
31
30
31
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long cache[10005][3]; long long vacate(vector<long long> *v, int n, int i, int activity) { if (i >= n) { return 0; } if (activity != -1 && cache[i][activity] != -1) { return cache[i][activity]; } long long points = 0; for (int m = 0; m < 3; m++)...
#include <bits/stdc++.h> using namespace std; long long cache[100005][3]; long long vacate(vector<long long> *v, int n, int i, int activity) { if (i >= n) { return 0; } if (activity != -1 && cache[i][activity] != -1) { return cache[i][activity]; } long long points = 0; for (int m = 0; m < 3; m++...
replace
3
4
3
4
0
p03162
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <stack> #include <string> #include <type_traits> using namespace std; using ll = long long; typedef pair<int, in...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <stack> #include <string> #include <type_traits> using namespace std; using ll = long long; typedef pair<int, in...
replace
49
50
49
50
TLE
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n; int a[100005][4]; int dp[100005][4]; // int mx=INT_MIN; int solve(int i, int f) { if (i == n) return 0; if (dp[i][f] != -1) return dp[i][f]; int mx = INT_MIN; if (f == 0) { mx = max(mx, a[i][1] + solve(i + 1, 1)); mx = max(mx, a[i][2] + solve(...
#include <bits/stdc++.h> using namespace std; int n; int a[100005][4]; int dp[100005][4]; // int mx=INT_MIN; int solve(int i, int f) { if (i == n) return 0; if (dp[i][f] != -1) return dp[i][f]; int mx = INT_MIN; if (f == 0) { mx = max(mx, a[i][1] + solve(i + 1, 1)); mx = max(mx, a[i][2] + solve(...
replace
26
27
26
27
TLE
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define f first #define s second #define pb push_back #define all(v) (v).begin(), (v).end() #define debug(x) cout << #x << " " << x << "\n" using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair<ll,...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define f first #define s second #define pb push_back #define all(v) (v).begin(), (v).end() #define debug(x) cout << #x << " " << x << "\n" using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair<ll,...
replace
34
35
34
35
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout....
#include <bits/stdc++.h> using namespace std; #define int long long #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout....
replace
34
39
34
36
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int val[N][3]; for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { cin >> val[i][j]; } } long long int dp[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { dp[i][j] = -100000; ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int val[N][3]; for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { cin >> val[i][j]; } } long long int dp[N][3]; for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { dp[i][j] = -100000; ...
replace
12
13
12
13
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FAST \ std::ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define M 10000...
#include <bits/stdc++.h> using namespace std; #define FAST \ std::ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define M 10000...
replace
86
87
86
87
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { cin >> a[i][j]; } } int dp[n][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { dp[i][j] = 0; } } for (int i...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { cin >> a[i][j]; } } int dp[n][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { dp[i][j] = 0; } } for (int i...
replace
6
7
6
7
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif ll n, i; cin >> n; ll a[n], b[n], c[n]; for (i = 0; i < n; i++) { cin >> a[i] >> b[i] >> c[i]; } ll dp[n][3]; dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] ...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, i; cin >> n; ll a[n], b[n], c[n]; for (i = 0; i < n; i++) { cin >> a[i] >> b[i] >> c[i]; } ll dp[n][3]; dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0]; for (i = 1; i < n; i++) { dp[i][0] = max(dp[i - ...
replace
5
8
5
6
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int a[10001][4], f[10001][4] = {0}; int main() { int i, j, k, n; scanf("%d", &n); for (i = 1; i <= n; i++) for (j = 1; j <= 3; j++) scanf("%d", &a[i][j]); for (i = 1; i <= n; i++) { for (j = 1; j <= 3; j++) { for (k = 1; k <= 3; k++) { if...
#include <bits/stdc++.h> using namespace std; int a[100001][4], f[100001][4] = {0}; int main() { int i, j, k, n; scanf("%d", &n); for (i = 1; i <= n; i++) for (j = 1; j <= 3; j++) scanf("%d", &a[i][j]); for (i = 1; i <= n; i++) { for (j = 1; j <= 3; j++) { for (k = 1; k <= 3; k++) { ...
replace
2
3
2
3
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MOD ((int)(1e9 + 7)) #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ ...
#include <bits/stdc++.h> using namespace std; #define MOD ((int)(1e9 + 7)) #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ ...
replace
27
28
27
28
0
p03162
C++
Runtime Error
// C - Vacation #include <iostream> #include <vector> #define ll long long using namespace std; ll n; // vector<ll> dp(3, vector<ll>(1000005, -1)); ll dp[3][1000005]; ll cost(vector<vector<ll>> &matrix, ll selected, ll day) { if (dp[day][selected] != -1) return dp[day][selected]; if (day == matrix.size()) ...
// C - Vacation #include <iostream> #include <vector> #define ll long long using namespace std; ll n; // vector<ll> dp(3, vector<ll>(1000005, -1)); ll dp[1000005][3]; ll cost(vector<vector<ll>> &matrix, ll selected, ll day) { if (dp[day][selected] != -1) return dp[day][selected]; if (day == matrix.size()) ...
replace
10
11
10
11
0
p03162
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; #include <algorithm> #define str(a) to_string(a) #define int long long #define pb push_back int32_t main() { int n; cin >> n; vector<vector<int>> vec(n, vector<int>(n, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) cin >> ve...
#include <iostream> #include <vector> using namespace std; #include <algorithm> #define str(a) to_string(a) #define int long long #define pb push_back int32_t main() { int n; cin >> n; int vec[n][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) cin >> vec[i][j]; } int dp[n][3]; d...
replace
13
14
13
14
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #include <cstdio> typedef long long int ll; #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR_IN(i, a, b) for (int i = (a); i < (b); i++) #define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b)) using namespace std; /* N 10^5 a,b,c 10^4 N a1 b1 c1 ... aN bN cN */ int N; ll dp[100000][...
#include <bits/stdc++.h> #include <cstdio> typedef long long int ll; #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR_IN(i, a, b) for (int i = (a); i < (b); i++) #define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b)) using namespace std; /* N 10^5 a,b,c 10^4 N a1 b1 c1 ... aN bN cN */ int N; ll dp[100001][...
replace
20
21
20
21
0
p03162
C++
Runtime Error
/*************************************************** * Problem Name : C - Vacation.cpp * Problem Link : * OJ : * Verdict : Trying * Date : 2019-01-26 * Problem Type : * Author Name : Saikat Sharma * University : CSE, MBSTU ***************************************************/ #include ...
/*************************************************** * Problem Name : C - Vacation.cpp * Problem Link : * OJ : * Verdict : Trying * Date : 2019-01-26 * Problem Type : * Author Name : Saikat Sharma * University : CSE, MBSTU ***************************************************/ #include ...
replace
50
51
50
51
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define mod 1000000007 using namespace std; int main() { ll n; cin >> n; ll dp[10001][3]; ll arr[10001][3]; for (ll i = 0; i < n; i++) { ll x, y, z; cin >> x >> y >> z; arr[i][0] = x; arr[i][1] = y; arr[i][2] = z; } f...
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define mod 1000000007 using namespace std; int main() { ll n; cin >> n; ll dp[100001][3]; ll arr[100001][3]; for (ll i = 0; i < n; i++) { ll x, y, z; cin >> x >> y >> z; arr[i][0] = x; arr[i][1] = y; arr[i][2] = z; } ...
replace
10
12
10
12
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) FOR(i, 0, n - 1) typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T &a, T b) { if...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) FOR(i, 0, n - 1) typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T &a, T b) { if...
replace
33
34
33
34
-11
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define FAST_INPUT \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define ll long long using namespace ...
#include <bits/stdc++.h> #define FAST_INPUT \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define ll long long using namespace ...
replace
25
26
25
26
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; int dp[100000 + 1][3]; struct vacation { int a, b, c; }; int solve(vector<vacation> v, int i, int n, int j) { if (i > n) return 0; if (dp[i][j] != -1) return dp[i][j]; int sol = 0; if (j == 0) dp[i][j] = max(v[i].b +...
#include <bits/stdc++.h> #define ll long long using namespace std; int dp[100000 + 1][3]; struct vacation { int a, b, c; }; int solve(vector<vacation> &v, int i, int n, int j) { if (i > n) return 0; if (dp[i][j] != -1) return dp[i][j]; int sol = 0; if (j == 0) dp[i][j] = max(v[i].b ...
replace
10
11
10
11
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<vector<int>> abc(n, vector<int>(3)); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> abc[i][j]; vector<vector<int>> dp(n + 1, vector<int>(3, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<vector<int>> abc(n, vector<int>(3)); for (int i = 0; i < n; i++) for (int j = 0; j < 3; j++) cin >> abc[i][j]; vector<vector<int>> dp(n + 1, vector<int>(3, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j ...
replace
8
9
8
9
0
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long // #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<in...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long // #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define mii map<int, int> #define pqb priority_queue<int> #define pqs priority_queue<in...
delete
89
93
89
89
0
p03162
C++
Runtime Error
/* ╔═══╦═══╦═══╗ ║╔═╗║╔══╩╗╔╗║ ║║░║║╚══╗║║║║ ║║░║║╔══╝║║║║ ║╚═╝║╚══╦╝╚╝║ ╚══╗╠═══╩═══╝ ░░░╚╝░░░░░░░░ */ /* * * * */ #include <bits/stdc++.h> #define ll long long #define MAX 10000 using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int a[MAX][3]; for (...
/* ╔═══╦═══╦═══╗ ║╔═╗║╔══╩╗╔╗║ ║║░║║╚══╗║║║║ ║║░║║╔══╝║║║║ ║╚═╝║╚══╦╝╚╝║ ╚══╗╠═══╩═══╝ ░░░╚╝░░░░░░░░ */ /* * * * */ #include <bits/stdc++.h> #define ll long long #define MAX 100000 using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int a[MAX][3]; for ...
replace
16
17
16
17
0
p03162
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int solve(vector<array<int, 3>> &v_abc, vector<vector<int>> memo, int pre = -1, int cur = 0) { int n = v_abc.size(); if (cur == n) { return 0; } if (memo[cur][pre + 1] == -1) { int ans = 0; for (int i = 0; i < 3; ++i) { if (i != pre) {...
#include <bits/stdc++.h> using namespace std; int solve(vector<array<int, 3>> &v_abc, vector<vector<int>> &memo, int pre = -1, int cur = 0) { int n = v_abc.size(); if (cur == n) { return 0; } if (memo[cur][pre + 1] == -1) { int ans = 0; for (int i = 0; i < 3; ++i) { if (i != pre) ...
replace
4
5
4
5
TLE
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf("%d", &n); vector<vector<int>> a(n, vector<int>(3, 0)); vector<vector<int>> dp(n, vector<int>(3, 0)); for (i = 0; i < n; i++) { scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]); } dp[n - 1][0] = a[i][0]; dp[n - 1][1] = a[i][...
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf("%d", &n); vector<vector<int>> a(n, vector<int>(3, 0)); vector<vector<int>> dp(n, vector<int>(3, 0)); for (i = 0; i < n; i++) { scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]); } dp[n - 1][0] = a[n - 1][0]; dp[n - 1][1] = a...
replace
12
15
12
15
-11
p03162
C++
Runtime Error
/* Auther: ghoshashis545 Ashis Ghosh College: jalpaiguri Govt Enggineering College Date:12/06/2020 */ #include <algorithm> #include <bits/stdc++.h> #include <string> using namespace std; #define ll long long #define int ll #define ld long double #define ff first #define ss string #define se second #define a...
/* Auther: ghoshashis545 Ashis Ghosh College: jalpaiguri Govt Enggineering College Date:12/06/2020 */ #include <algorithm> #include <bits/stdc++.h> #include <string> using namespace std; #define ll long long #define int ll #define ld long double #define ff first #define ss string #define se second #define a...
replace
59
63
59
63
-6
terminate called after throwing an instance of 'std::__ios_failure' what(): basic_ios::clear: iostream error
p03162
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int a[10020], b[10020], c[10020]; int da[10020], db[10020], dc[10020]; int resiA(int i, int n); int resiB(int i, int n); int resiC(int i, int n); int resiA(int i, int n) { if (i == n - 1) { return a[i]; } if (da[i] == 0) { da[i] = max(resiB(i + 1, n) + a...
#include <bits/stdc++.h> using namespace std; int a[100200], b[100020], c[100020]; int da[100200], db[100020], dc[100020]; int resiA(int i, int n); int resiB(int i, int n); int resiC(int i, int n); int resiA(int i, int n) { if (i == n - 1) { return a[i]; } if (da[i] == 0) { da[i] = max(resiB(i + 1, ...
replace
4
6
4
6
0