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
p03165
C++
Runtime Error
#include <algorithm> #include <assert.h> #include <bitset> #include <chrono> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string.h> #include <time.h> #include <unordered_map> #include <unordered_set> #include <utilit...
#include <algorithm> #include <assert.h> #include <bitset> #include <chrono> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string.h> #include <time.h> #include <unordered_map> #include <unordered_set> #include <utilit...
replace
50
51
50
51
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; ll memo[33][33]; int main() { string a, b; cin >> a >> b; for (int i = 0; i <= a.size(); i++) memo[i][0] = 0; for (int j = 0; j <= b.size(); j++) memo[0][j] = 0; for (int i = 1; i...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; ll memo[3003][3003]; int main() { string a, b; cin >> a >> b; for (int i = 0; i <= a.size(); i++) memo[i][0] = 0; for (int j = 0; j <= b.size(); j++) memo[0][j] = 0; for (int i = ...
replace
5
6
5
6
0
p03165
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; #define pb push_back #define eb emplace_back #define fi first #define se second #define FF first #define SS second #define pii pair<int, int> #define fr(i, a, b) for (int i = a; i <= b; i++) #define sz(x) (int)x.size() #define mp make_pair #define Mod 1000000007 typedef lon...
#include "bits/stdc++.h" using namespace std; #define pb push_back #define eb emplace_back #define fi first #define se second #define FF first #define SS second #define pii pair<int, int> #define fr(i, a, b) for (int i = a; i <= b; i++) #define sz(x) (int)x.size() #define mp make_pair #define Mod 1000000007 typedef lon...
replace
24
27
24
27
0
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; string s, t, ans; int dp[3001][3001]; int main() { cin >> s >> t; for (int i = 0; i < s.size(); i++) { for (int j = 0; j < t.size(); j++) { if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1; else dp[i + 1...
#include <algorithm> #include <iostream> #include <string> using namespace std; string s, t, ans; int dp[3001][3001]; int main() { cin >> s >> t; for (int i = 0; i < s.size(); i++) { for (int j = 0; j < t.size(); j++) { if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1; else dp[i + 1...
replace
16
27
16
25
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; using namespace std; #define chmax(a, b) a = max(a, b) #define N 310 ll f[N][N]; string s, t; int main() { cin >> s >> t; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) f[i][j] = 0; for (int i = 1; i <= s.size(); i++) for ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; using namespace std; #define chmax(a, b) a = max(a, b) #define N 3010 ll f[N][N]; string s, t; int main() { cin >> s >> t; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) f[i][j] = 0; for (int i = 1; i <= s.size(); i++) for...
replace
6
7
6
7
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define dbg(n) cout << '\n' << #n << " is " << n << '\n'; #define pb push_back #define all(v) v.begin(), v.end() #define cs(i) cout << "Case " << i + 1 << ": " const int sz = 1e3 + 5; const int INF = 1e9 + 5; string a, b, ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define dbg(n) cout << '\n' << #n << " is " << n << '\n'; #define pb push_back #define all(v) v.begin(), v.end() #define cs(i) cout << "Case " << i + 1 << ": " const int sz = 3e3 + 5; const int INF = 1e9 + 5; string a, b, ...
replace
10
11
10
11
0
p03165
C++
Runtime Error
/*----------------by syr----------------*/ /* ----- ----- ----- | | |---| _/ | | | \_ / ----- | \ ----- |---\ \ / |\ /| | | \_/ | \/ | | | / \ | | |---/ / \ | | */ #include <bits/stdc++.h> using namespace std; #define PH push #define MP make_pair #define P...
/*----------------by syr----------------*/ /* ----- ----- ----- | | |---| _/ | | | \_ / ----- | \ ----- |---\ \ / |\ /| | | \_/ | \/ | | | / \ | | |---/ / \ | | */ #include <bits/stdc++.h> using namespace std; #define PH push #define MP make_pair #define P...
replace
35
36
35
36
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int inf = 1e4 + 5; typedef long long ll; string a, b, c; int len1, len2; int dp[inf][inf]; bool vis[inf][inf]; void str(int i, int j) { if (a[i] == '\0' || b[i] == '\0') { cout << c << endl; return; } if (a[i] == b[j]) { c += a[i]; str(i + 1, j +...
#include <bits/stdc++.h> using namespace std; const int inf = 1e4 + 5; typedef long long ll; string a, b, c; int len1, len2; int dp[inf][inf]; bool vis[inf][inf]; void str(int i, int j) { if (a[i] == '\0' || b[j] == '\0') { cout << c << endl; return; } if (a[i] == b[j]) { c += a[i]; str(i + 1, j +...
replace
9
10
9
10
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const double EPS = 1e-7; const long long mod = 1e6 + 3; #define Hello \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const double EPS = 1e-7; const long long mod = 1e6 + 3; #define Hello \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
20
21
20
21
0
p03165
Python
Runtime Error
s = input() t = input() dp = [0] lcs = [""] for b in t: search_idx = 0 ncs = lcs.copy() for i, curr_idx in enumerate(dp): char_idx = s.find(b, search_idx) if char_idx == -1: break next_idx = char_idx + 1 if next_idx < curr_idx: dp[i] = next_idx ...
s = input() t = input() dp = [0] lcs = [""] for b in t: search_idx = 0 ncs = lcs[:] for i, curr_idx in enumerate(dp): char_idx = s.find(b, search_idx) if char_idx == -1: break next_idx = char_idx + 1 if next_idx < curr_idx: dp[i] = next_idx ...
replace
6
7
6
7
0
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <unordered_map> #include <vector> using namespace std; void solve() { string s, t; cin >> s >> t; int m = s.size(); int n = t.size(); vector<vector<int>...
#include <algorithm> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <unordered_map> #include <vector> using namespace std; void solve() { string s, t; cin >> s >> t; int m = s.size(); int n = t.size(); vector<vector<int>...
replace
21
23
21
23
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define pob pop_back #define pf push_front #define pof pop_front #define nd second #define st first using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using mii = map<int, int>; usi...
#include <bits/stdc++.h> #define pb push_back #define pob pop_back #define pf push_front #define pof pop_front #define nd second #define st first using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using mii = map<int, int>; usi...
replace
18
19
18
19
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; string lcs(string a, string b) { int n = a.size(), m = b.size(); vector<vector<int>> X(3000, vector<int>(3000)); vector<vector<int>> Y(3000, vector<int>(3000)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a.at(i) == b.at(j)) { ...
#include <bits/stdc++.h> using namespace std; string lcs(string a, string b) { int n = a.size(), m = b.size(); vector<vector<int>> X(3001, vector<int>(3001)); vector<vector<int>> Y(3001, vector<int>(3001)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a.at(i) == b.at(j)) { ...
replace
5
7
5
7
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main(void) { string s, t; cin >> s >> t; int lens = s.length(); int lent = t.length(); int dp[lens][lent]; for (int i = 0; i <= lens; i++) { for (int j = 0; j <= lent; j++) { if (i == 0 || j == 0) { dp[i][j] = 0; continue; } ...
#include <bits/stdc++.h> using namespace std; int main(void) { string s, t; cin >> s >> t; int lens = s.length(); int lent = t.length(); int dp[lens + 1][lent + 1]; for (int i = 0; i <= lens; i++) { for (int j = 0; j <= lent; j++) { if (i == 0 || j == 0) { dp[i][j] = 0; continue; ...
replace
7
8
7
8
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define mk make_pair #define pb push_back #define ppb pop_back using namespace std; int dp[3005][3005]; string ans = ""; int main() { ios::sync_with_stdio(false); string s, t; cin >> s >> t; int n = s.size(), m = t.size(); for (int i = 0; i < 3005; i++) dp...
#include <bits/stdc++.h> #define ll long long int #define mk make_pair #define pb push_back #define ppb pop_back using namespace std; int dp[3005][3005]; string ans = ""; int main() { ios::sync_with_stdio(false); string s, t; cin >> s >> t; int n = s.size(), m = t.size(); for (int i = 0; i < 3005; i++) dp...
replace
29
32
29
30
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fl(i, a, b) for (int i = a; i < b; i++) #define ll long long #define endl '\n' #define pb push_back #define ff first #define ss second #define mod 1000000007 #define mx 200005 #define inf 2e9 #define fast ...
#include <bits/stdc++.h> using namespace std; #define fl(i, a, b) for (int i = a; i < b; i++) #define ll long long #define endl '\n' #define pb push_back #define ff first #define ss second #define mod 1000000007 #define mx 200005 #define inf 2e9 #define fast ...
replace
36
37
36
37
0
p03165
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define int long long int #define mp make_pair using namespace std; string s, t; int dp[3002][3002]; int l1, l2; int fun(int pos1, int pos2) { if (pos1 == l1) { return 0; } if (pos2 == l2) { return 0; } if (s[pos1] == t[pos2]) { dp[pos1][pos2] = 1 + fun(pos1 + 1, pos2 + ...
#include <bits/stdc++.h> #define int long long int #define mp make_pair using namespace std; string s, t; int dp[3002][3002]; int l1, l2; int fun(int pos1, int pos2) { if (pos1 == l1) { return 0; } if (pos2 == l2) { return 0; } if (dp[pos1][pos2] != -1) { return dp[pos1][pos2]; } if (s[pos1]...
insert
15
15
15
18
TLE
p03165
C++
Runtime Error
# 1 "f.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "f.cpp" # 1 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 1 # 12 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" # 1 "/home/tysm/dev/cpplib/bin/../stdlib/bits/stdc++.h" 1 #include <bits/stdc++.h> # 13 "/home/tysm/dev/cpplib/bin/../include/cpplib...
# 1 "f.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "f.cpp" # 1 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 1 # 12 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" # 1 "/home/tysm/dev/cpplib/bin/../stdlib/bits/stdc++.h" 1 #include <bits/stdc++.h> # 13 "/home/tysm/dev/cpplib/bin/../include/cpplib...
replace
80
81
80
81
0
p03165
C++
Runtime Error
// shan61916 #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); ...
// shan61916 #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); ...
replace
11
12
11
12
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() typedef pair<int, int> Pint; typedef pair<int64_t, int64_t> Pll; int main() { string s, t; cin >> s >> t; vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1)); for (int i = 0;...
#include <bits/stdc++.h> using namespace std; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() typedef pair<int, int> Pint; typedef pair<int64_t, int64_t> Pll; int main() { string s, t; cin >> s >> t; vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1)); for (int i = 0;...
replace
28
29
28
30
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::at: __n (which is 4) >= this->size() (which is 4)
p03165
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back string s, t; ll n, m; ll dp[4000][4000], vis[4000][4000]; string ans; ll lcs(ll i, ll j) { if (i >= n or j >= m) return 0; if (vis[i][j]) return dp[i][j]; if (s[i] == t[j]) { dp[i][j] = 1 + lcs(i + 1, j + 1);...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back string s, t; ll n, m; ll dp[4000][4000], vis[4000][4000]; string ans; ll lcs(ll i, ll j) { if (i >= n or j >= m) return 0; if (vis[i][j]) return dp[i][j]; if (s[i] == t[j]) { dp[i][j] = 1 + lcs(i + 1, j + 1);...
insert
25
25
25
26
TLE
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define ff first #define ss second #define mp make_pair #define pb push_back #define endl "\n" #define si set<int> #define vi vector<int> #define pii pair<int, int> #define vpii vector<pii> #define mii map<int, int> #define...
#include <bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define ff first #define ss second #define mp make_pair #define pb push_back #define endl "\n" #define si set<int> #define vi vector<int> #define pii pair<int, int> #define vpii vector<pii> #define mii map<int, int> #define...
delete
104
109
104
104
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (int)x.size() #defi...
#include <bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (int)x.size() #defi...
replace
62
68
62
68
0
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> #include <stack> using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; // #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(), (a).end() #define _overload3(_1, _2, _3, name, ...)...
#include <algorithm> #include <iostream> #include <vector> #include <stack> using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; // #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(), (a).end() #define _overload3(_1, _2, _3, name, ...)...
replace
92
93
92
93
0
p03165
C++
Time Limit Exceeded
/////////////////////////////////TEST CASES//////////////////////////////////// /* */ /////////////////////////////////////CODE////////////////////////////////////// #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORD(i, a, b) for (ll i = a; i > b; i--) #defin...
/////////////////////////////////TEST CASES//////////////////////////////////// /* */ /////////////////////////////////////CODE////////////////////////////////////// #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORD(i, a, b) for (ll i = a; i > b; i--) #defin...
replace
48
49
48
49
TLE
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define debug(a) cout << #a << ":" << a << endl; const int INF = 0x3f3f3f3f; const int N = 1e6 + 7; const int mod = 1e9 + 7; int maxn, minn; int T, n; string s1, s2; int len1, len2; int dp[4010][4010]; int main() { cin >> s1 >> s2; len1 = s1.size(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define debug(a) cout << #a << ":" << a << endl; const int INF = 0x3f3f3f3f; const int N = 1e6 + 7; const int mod = 1e9 + 7; int maxn, minn; int T, n; string s1, s2; int len1, len2; int dp[4010][4010]; int main() { cin >> s1 >> s2; len1 = s1.size(...
replace
28
30
28
30
0
p03165
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; char s[3001], t[3001]; int n, m, i, j, a[3001][3001]; int main() { cin >> s >> t; n = strlen(s); m = strlen(t); for (i = n; i > 0; i--) { for (j = m; j > 0; j--) { if (s[i - 1] == t[j - 1]) { a[i][j] = a[i + 1][j + 1] + 1; } els...
#include <cstring> #include <iostream> using namespace std; char s[3003], t[3003]; int n, m, i, j, a[3003][3003]; int main() { cin >> s >> t; n = strlen(s); m = strlen(t); for (i = n; i > 0; i--) { for (j = m; j > 0; j--) { if (s[i - 1] == t[j - 1]) { a[i][j] = a[i + 1][j + 1] + 1; } els...
replace
3
5
3
5
0
p03165
C++
Runtime Error
// https://atcoder.jp/contests/dp/tasks/dp_f // shauryakr #include <bits/stdc++.h> using namespace std; string a, b; int dp[3005][3005]; void solve() { for (int i = 1; i <= a.length(); i++) { for (int j = 1; j <= b.length(); j++) { if (a[i - 1] == b[j - 1]) { dp[i][j] = dp[i - 1][j - 1] + 1; }...
// https://atcoder.jp/contests/dp/tasks/dp_f // shauryakr #include <bits/stdc++.h> using namespace std; string a, b; int dp[3005][3005]; void solve() { for (int i = 1; i <= a.length(); i++) { for (int j = 1; j <= b.length(); j++) { if (a[i - 1] == b[j - 1]) { dp[i][j] = dp[i - 1][j - 1] + 1; }...
replace
28
29
28
29
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, n, m, dp[10000][10000]; string s, t, str; cin >> s; cin >> t; n = s.size(); m = t.size(); for (i = 0; i <= n; i++) { for (j = 0; j <= m; j++) { if (i == 0 || j == 0) dp[i][j] = 0; } } for (i = 1; i <= ...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, n, m, dp[3003][3003]; string s, t, str; cin >> s; cin >> t; n = s.size(); m = t.size(); for (i = 0; i <= n; i++) { for (j = 0; j <= m; j++) { if (i == 0 || j == 0) dp[i][j] = 0; } } for (i = 1; i <= n;...
replace
3
4
3
4
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> #include <functional> #include <stdio.h> using namespace std; #define ll int #define dd long double #define pb push_back #define pf push_front #define pi pair<ll, ll> #define vi vector<ll> #define vpi vector<pi> #define mi map<ll, ll> #define vvi vector<vector<ll>> #define mpi map<pi, ll> #defi...
#include <bits/stdc++.h> #include <functional> #include <stdio.h> using namespace std; #define ll int #define dd long double #define pb push_back #define pf push_front #define pi pair<ll, ll> #define vi vector<ll> #define vpi vector<pi> #define mi map<ll, ll> #define vvi vector<vector<ll>> #define mpi map<pi, ll> #defi...
replace
164
165
164
169
0
p03165
C++
Runtime Error
#include <iostream> #include <string> #include <vector> using namespace std; int len(string &s, string &t, int i, int j, vector<vector<int>> &dp) { if (i >= s.length() || j >= t.length()) { return 0; } if (dp[i][j] != -1) { return dp[i][j]; } if (s[i] == t[j]) { return dp[i][j] = 1 + len(s, t, i ...
#include <iostream> #include <string> #include <vector> using namespace std; int len(string &s, string &t, int i, int j, vector<vector<int>> &dp) { if (i >= s.length() || j >= t.length()) { return 0; } if (dp[i][j] != -1) { return dp[i][j]; } if (s[i] == t[j]) { return dp[i][j] = 1 + len(s, t, i ...
replace
47
48
47
48
0
p03165
C++
Runtime Error
/******************************** *** ******** ********** ********* *** * ****** ********* * ******** *** ** ***** ******** *** ******* *** *** **** ******* ***** ****** *** **** *** ****** ******* ***** *** ***** ** ***** +++++++++ **** *** ****** * **** *********** *** *** ******* *** ************* ** *** ******** *...
/******************************** *** ******** ********** ********* *** * ****** ********* * ******** *** ** ***** ******** *** ******* *** *** **** ******* ***** ****** *** **** *** ****** ******* ***** *** ***** ** ***** +++++++++ **** *** ****** * **** *********** *** *** ******* *** ************* ** *** ******** *...
replace
81
82
81
82
0
p03165
C++
Runtime Error
/** * author: bholuakku **/ #include <bits/stdc++.h> #define For(i, a, b) for (i = (a); i < (b); i++) #define rep(i, n) for (i = 0; i < (n); i++) #define Nfor(i, a, b) for (i = (a)-1; i >= (b); i--) #define dep(i, n) for (i = (n - 1); i >= 0; i--) #define mp make_pair #define pb push_back #define Auto(a) for (auto...
/** * author: bholuakku **/ #include <bits/stdc++.h> #define For(i, a, b) for (i = (a); i < (b); i++) #define rep(i, n) for (i = 0; i < (n); i++) #define Nfor(i, a, b) for (i = (a)-1; i >= (b); i--) #define dep(i, n) for (i = (n - 1); i >= 0; i--) #define mp make_pair #define pb push_back #define Auto(a) for (auto...
delete
61
64
61
61
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define In_The_Name_Of_Allah_The_Merciful \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.ti...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define In_The_Name_Of_Allah_The_Merciful \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.ti...
replace
12
13
12
13
0
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define in(v) \ v; \ cin >> v; #define rep(i, n) for (int i = 0, _i = (n); i < _i; ++i) #define r...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define in(v) \ v; \ cin >> v; #define rep(i, n) for (int i = 0, _i = (n); i < _i; ++i) #define r...
replace
30
31
30
31
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n, m) for (int i = (n); i < (m); i++) #define rrep(i, n, m) for (int i = (n)-1; i >= (m); i--) #define pvec(vec) \ { \ for (auto v : vec) ...
#include <bits/stdc++.h> #define rep(i, n, m) for (int i = (n); i < (m); i++) #define rrep(i, n, m) for (int i = (n)-1; i >= (m); i--) #define pvec(vec) \ { \ for (auto v : vec) ...
replace
26
28
26
28
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03165
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define in insert #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define pii pair<int, int> #define vi vec...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ff first #define ss second #define int long long #define in insert #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define pii pair<int, int> #define vi vec...
replace
61
62
61
62
0
p03165
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long int string x; int dp[3001][3001], ans = 0; // vector<vector<string> >dp; int fn(int i, int j, string s, string t) { if (i == 0 || j == 0) return 0; if (dp[i][j] != -1) { return dp[i][j]; } if (s[i - 1] == t[j - 1]) { x += s[i - 1]...
#include <bits/stdc++.h> using namespace std; #define ll long long int string x; int dp[3001][3001], ans = 0; // vector<vector<string> >dp; int fn(int i, int j, string &s, string &t) { if (i == 0 || j == 0) return 0; if (dp[i][j] != -1) { return dp[i][j]; } if (s[i - 1] == t[j - 1]) { x += s[i - ...
replace
7
8
7
8
TLE
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int mxN = 1e3 + 2; string s, t; int n, m, dp[mxN][mxN]; pair<int, int> parent[mxN][mxN]; int calc(int i, int j) { if (i < 0 || j < 0) return 0; return dp[i][j]; } int main() { cin >> s >> t; n = s.length(); m = t.length(); for (int i = 0; i < n; i+...
#include <bits/stdc++.h> using namespace std; const int mxN = 3e3 + 2; string s, t; int n, m, dp[mxN][mxN]; pair<int, int> parent[mxN][mxN]; int calc(int i, int j) { if (i < 0 || j < 0) return 0; return dp[i][j]; } int main() { cin >> s >> t; n = s.length(); m = t.length(); for (int i = 0; i < n; i+...
replace
3
4
3
4
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define FasterIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define FasterIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
83
87
83
88
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define f first #define s second #define read freopen("input.txt", "r", stdin) #define write freopen("output.txt", "w", stdout) #define mx 5e12 using namespace std; ll dp[3010][3010]; int main() { string s, t, ans; cin >> s; cin >> t; in...
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define f first #define s second #define read freopen("input.txt", "r", stdin) #define write freopen("output.txt", "w", stdout) #define mx 5e12 using namespace std; ll dp[3010][3010]; int main() { string s, t, ans; cin >> s; cin >> t; in...
replace
29
30
29
30
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long int dp[3001][3001]; int main() { IOS; memset(dp, 0, sizeof(dp)); s...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long int dp[3005][3005]; int main() { IOS; memset(dp, 0, sizeof(dp)); s...
replace
7
8
7
8
0
p03165
C++
Runtime Error
/*coderanant*/ #include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define f1(i, a, b) for (i = a; i < b; i++) #define f2(i, a, b) for (i = a; i >= b; i--) #define endl '\n' #define pb push_back #define gp " " #define ff first #define ss second #define mp make_pair const int mod =...
/*coderanant*/ #include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define f1(i, a, b) for (i = a; i < b; i++) #define f2(i, a, b) for (i = a; i >= b; i--) #define endl '\n' #define pb push_back #define gp " " #define ff first #define ss second #define mp make_pair const int mod =...
replace
22
27
22
26
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll mod = 1e9 + 7; ll const maxn = 1e3 + 5; ll const inf = 1e18; ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; } ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; } ll powm(ll x, ll n, ll M) { ll result = 1; while (n > 0) {...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll mod = 1e9 + 7; ll const maxn = 1e3 + 5; ll const inf = 1e18; ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; } ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; } ll powm(ll x, ll n, ll M) { ll result = 1; while (n > 0) {...
replace
28
32
28
32
0
p03165
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define fo(i, a, b) for (int i = a; i < b; ++i) #define rep(i, n) fo(i, 0, n) #define pln(n) printf("%lld\n", n) #define sll(n) scanf("%lld", &n) #define ss(n) scanf("%s", n) #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define ll long long #define...
#include <bits/stdc++.h> #define fo(i, a, b) for (int i = a; i < b; ++i) #define rep(i, n) fo(i, 0, n) #define pln(n) printf("%lld\n", n) #define sll(n) scanf("%lld", &n) #define ss(n) scanf("%s", n) #define vi vector<int> #define pii pair<int, int> #define pb push_back #define mp make_pair #define ll long long #define...
insert
59
59
59
61
TLE
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int const N = 1e3 + 5; string s, t; int n, m; int mem[N][N]; int oo = 0x3f3f3f3f; int DP(int i = 0, int j = 0) { if (i == n || j == m) return 0; int &ret = mem[i][j]; if (~ret) return ret; return ret = max(DP(i + 1, j), ...
#include <bits/stdc++.h> using namespace std; #define ll long long int const N = 3e3 + 5; string s, t; int n, m; int mem[N][N]; int oo = 0x3f3f3f3f; int DP(int i = 0, int j = 0) { if (i == n || j == m) return 0; int &ret = mem[i][j]; if (~ret) return ret; return ret = max(DP(i + 1, j), ...
replace
3
4
3
4
0
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; const int N = 1007; long long dp[N][N]; string s, t; int abs(int val) { return max(val, -val); } int main() { int n, tw, val, cst; cin >> s >> t; for (int i = 1; i <= s.size(); ++i) for (int j = 1; j <= t.size(); ++j) dp[i][j] = max(max...
#include <algorithm> #include <iostream> using namespace std; const int N = 3007; long long dp[N][N]; string s, t; int abs(int val) { return max(val, -val); } int main() { int n, tw, val, cst; cin >> s >> t; for (int i = 1; i <= s.size(); ++i) for (int j = 1; j <= t.size(); ++j) dp[i][j] = max(max...
replace
5
6
5
6
0
p03165
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <deque> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; const long...
#include <algorithm> #include <bitset> #include <cassert> #include <deque> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; const long...
replace
71
72
71
72
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /* */ int lcsMemo(int i, int j, string &s, string &t, vector<vector<int>> &dp) { if (i >= (int)s.size() || j >= (int)t.size() || i < 0 || j < 0) return 0; if (dp[i][j] != -1) { return dp[i][j]; } else if (s[i] == t[j]) { dp[i][j] = 1 + lcsMemo(i + 1, j + ...
#include <bits/stdc++.h> using namespace std; /* */ int lcsMemo(int i, int j, string &s, string &t, vector<vector<int>> &dp) { if (i >= (int)s.size() || j >= (int)t.size() || i < 0 || j < 0) return 0; if (dp[i][j] != -1) { return dp[i][j]; } else if (s[i] == t[j]) { dp[i][j] = 1 + lcsMemo(i + 1, j + ...
insert
30
30
30
34
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(0); cin.tie(NULL); string a = "", b = ""; cin >> a >> b; int i, j; int al = a.length(); int bl = b.length(); int dp[al + 1][bl + 1]; for (i = 0; i <= al; i++) { dp[0][i] = 0; } for (i = 1; i <= bl; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(0); cin.tie(NULL); string a = "", b = ""; cin >> a >> b; int i, j; int al = a.length(); int bl = b.length(); int dp[bl + 1][al + 1]; for (i = 0; i <= al; i++) { dp[0][i] = 0; } for (i = 1; i <= bl; i++) { ...
replace
13
14
13
14
0
p03165
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #...
replace
95
96
95
96
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) \ for (__typeof__((s).begin()...
#include <bits/stdc++.h> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) \ for (__typeof__((s).begin()...
replace
81
82
81
82
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s, t; cin >> s >> t; int dp[s.size() + 1][t.size() + 1]; dp[0][0] = 1; for (int i1 = 1; i1 <= t.size(); i1++) dp[0][i1] = 0; for (int i2 = 1; i2 <= s.size(); i2++)...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s, t; cin >> s >> t; int dp[s.size() + 1][t.size() + 1]; dp[0][0] = 1; for (int i1 = 1; i1 <= t.size(); i1++) dp[0][i1] = 0; for (int i2 = 1; i2 <= s.size(); i2++)...
replace
27
29
27
29
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define flb(i, a, b) for (int i = a; i < b; i++) #define ll long long int #define mp make_pair #define pb push_back #define inf (long long)(1e18 + 1e15) typedef pair<int, int> ii; typedef vector<ll> vi; typedef vector<pair<int, int>> vii; typedef vector<vector<int>> vvi; in...
#include <bits/stdc++.h> using namespace std; #define flb(i, a, b) for (int i = a; i < b; i++) #define ll long long int #define mp make_pair #define pb push_back #define inf (long long)(1e18 + 1e15) typedef pair<int, int> ii; typedef vector<ll> vi; typedef vector<pair<int, int>> vii; typedef vector<vector<int>> vvi; in...
replace
11
12
11
12
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { string s1, s2; cin >> s1 >> s2; int n = s1.size(); int m = s2.size(); vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0)); string ans = ""; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (s1...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { string s1, s2; cin >> s1 >> s2; int n = s1.size(); int m = s2.size(); vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0)); string ans = ""; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (s1...
replace
26
27
26
27
0
p03165
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string a, b; cin >> a; cin >> b; int dp[1001][1001]; for (int i = 0; i <= (int)a.length(); i++) dp[i][0] = 0; for (int i = 0; i <= (int)b.length(); i++) ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string a, b; cin >> a; cin >> b; int dp[3001][3001]; for (int i = 0; i <= (int)a.length(); i++) dp[i][0] = 0; for (int i = 0; i <= (int)b.length(); i++) ...
replace
12
13
12
13
0
p03165
C++
Runtime Error
// define DEBUG for debug #define DEBUG #include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define MAX 3000 #define MOD 1000000007 typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int dp[MAX + 10][MAX + 10]; string cev...
// define DEBUG for debug // #define DEBUG #include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define MAX 3000 #define MOD 1000000007 typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int dp[MAX + 10][MAX + 10]; string ...
replace
1
2
1
2
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int T, n; const int maxl = 3000 + 5; int dp[maxl][maxl]; int path[maxl][maxl]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s, t; cin >> s >> t; dp[0][0] = 0; dp[1][0] = 0; dp[0][1] = 0; path[0][0] = path[...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int T, n; const int maxl = 3000 + 5; int dp[maxl][maxl]; int path[maxl][maxl]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s, t; cin >> s >> t; for (int i = 0; i <= max(s.size(), t.size()); i++) dp[0][i] = ...
replace
17
21
17
19
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int N = 1e3 + 5; int dp[N][N]; string a, b, ans; int dpf(int i, int j) { if (dp[i][j] != -INF) return dp[i][j]; if (!i or !j) return dp[i][j] = 0; if (a[i - 1] == b[j - 1]) return dp[i][j] = 1 + dpf(i - 1, j - 1); ret...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int N = 3e3 + 5; int dp[N][N]; string a, b, ans; int dpf(int i, int j) { if (dp[i][j] != -INF) return dp[i][j]; if (!i or !j) return dp[i][j] = 0; if (a[i - 1] == b[j - 1]) return dp[i][j] = 1 + dpf(i - 1, j - 1); ret...
replace
4
5
4
5
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1 << 29; const int MOD = (int)1e9 + 7; const double EPS = 1e-9; #ifdef LOCAL_ENV #define debug(var) std::cout << #var " = " << var << std::endl #else #define debug(var) #endif #define p(var) std::cout << var << std::endl #define PI (ac...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1 << 29; const int MOD = (int)1e9 + 7; const double EPS = 1e-9; #ifdef LOCAL_ENV #define debug(var) std::cout << #var " = " << var << std::endl #else #define debug(var) #endif #define p(var) std::cout << var << std::endl #define PI (ac...
replace
81
82
81
82
0
p03165
C++
Runtime Error
#define NDEBUG NDEBUG #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <queue> #include <random> #include <set> #include <sstream> #include <string> #incl...
#define NDEBUG NDEBUG #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <queue> #include <random> #include <set> #include <sstream> #include <string> #incl...
replace
98
99
98
99
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define Fast cin.tie(0), ios::sync_with_stdio(0) #define All(x) x.begin(), x.end() #define louisfghbvc \ int t; \ cin >> t; ...
#include <bits/stdc++.h> #define Fast cin.tie(0), ios::sync_with_stdio(0) #define All(x) x.begin(), x.end() #define louisfghbvc \ int t; \ cin >> t; ...
replace
62
63
62
63
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define FAST_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define trace1(x) cerr << #x << ": " << x <<...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define FAST_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define trace1(x) cerr << #x << ": " << x <<...
replace
56
57
56
57
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
replace
27
28
27
28
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #include <ctype.h> #include <iostream> #include <stdio.h> #define lldi unsigned long long int using namespace std; string cadena; int dp[400][400] = {0}; int lcs(string s1, string s2) { int tam1 = s1.length(); int tam2 = s2.length(); for (int i = 1; i <= tam1; i++) { for (int j = 1...
#include <bits/stdc++.h> #include <ctype.h> #include <iostream> #include <stdio.h> #define lldi unsigned long long int using namespace std; string cadena; int dp[4000][4000] = {0}; int lcs(string s1, string s2) { int tam1 = s1.length(); int tam2 = s2.length(); for (int i = 1; i <= tam1; i++) { for (int j =...
replace
8
9
8
9
0
p03165
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 = 1e5 + 5; signed main() { ios::sync_with_stdio(0); cin.tie(0); string s, t; cin >> s >> t; int n = s.size(), m = t.size(); ...
#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 = 1e5 + 5; signed main() { ios::sync_with_stdio(0); cin.tie(0); string s, t; cin >> s >> t; int n = s.size(), m = t.size(); ...
replace
37
38
37
38
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[1005][1005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string a, b, t = ""; cin >> a >> b; for (int i = 1; i <= a.size(); i++) for (int j = 1; j <= b.size(); j++) if (a[i - 1] == b[j - 1]) dp[i][j] = dp[i - 1][j - 1]...
#include <bits/stdc++.h> using namespace std; int dp[3005][3005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string a, b, t = ""; cin >> a >> b; for (int i = 1; i <= a.size(); i++) for (int j = 1; j <= b.size(); j++) if (a[i - 1] == b[j - 1]) dp[i][j] = dp[i - 1][j - 1]...
replace
2
3
2
3
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define f(i, n) for (int i = 0; i < n; i++) #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define f(i, n) for (int i = 0; i < n; i++) #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
33
34
33
34
0
p03165
C++
Runtime Error
#include <iostream> #include <string> #include <utility> using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; int main() { string s, t; cin >> s >> t; int n = s.size(), m = t.size(); PP dp[100][100]; fill(dp[0], dp[0] + 100, PP(0, P(-1, -1))); for (int i = 0; i < 100; i++) { dp[i][0]...
#include <iostream> #include <string> #include <utility> using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; int main() { string s, t; cin >> s >> t; int n = s.size(), m = t.size(); PP dp[3002][3002]; fill(dp[0], dp[0] + 3002, PP(0, P(-1, -1))); for (int i = 0; i < 3002; i++) { dp[i...
replace
11
14
11
14
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; string str1, str2; int dp[1000][1000], n, m; int solve(int id1, int id2) { if (id1 == n || id2 == m) return 0; if (dp[id1][id2] != -1) return dp[id1][id2]; int ans = 0; if (str1[id1] == str2[id2]) ans = max(ans, 1 + solve(id1 + 1, id2 + 1)); else ...
#include <bits/stdc++.h> using namespace std; string str1, str2; int dp[5000][5000], n, m; int solve(int id1, int id2) { if (id1 == n || id2 == m) return 0; if (dp[id1][id2] != -1) return dp[id1][id2]; int ans = 0; if (str1[id1] == str2[id2]) ans = max(ans, 1 + solve(id1 + 1, id2 + 1)); else ...
replace
3
4
3
4
0
p03165
C++
Runtime Error
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define ld long double #define endl '\n' #define INF 10000000000000000 #define pll pair<ll, ll> #define ff first #define ss second using namespace std; const ll N = 200005; const ll MOD = 998244353; ll dp[305][305]; pll p[305][305]; int main() { ...
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define ld long double #define endl '\n' #define INF 10000000000000000 #define pll pair<ll, ll> #define ff first #define ss second using namespace std; const ll N = 200005; const ll MOD = 998244353; ll dp[3005][3005]; pll p[3005][3005]; int main(...
replace
13
15
13
15
0
p03165
C++
Runtime Error
/*==========================================================================================*\ ** _ _ _ _ _ _ _ ** ** | |__ _ _/ | |_| |__ | || | _ __ | |__ ** ** | '_ \| | | | | __| '_ \| || |_| '_ \| '_ \ ** ** ...
/*==========================================================================================*\ ** _ _ _ _ _ _ _ ** ** | |__ _ _/ | |_| |__ | || | _ __ | |__ ** ** | '_ \| | | | | __| '_ \| || |_| '_ \| '_ \ ** ** ...
replace
177
178
177
178
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int ans = 0; int main() { string s; string t; cin >> s >> t; int dp[100][100]; for (int i = 0; i <= s.length(); i++) { for (int j = 0; j <= t.length(); j++) { if (i == 0 || j == 0) { dp[i][j] = 0; continue; } if (s[i - 1] == t...
#include <bits/stdc++.h> using namespace std; int ans = 0; int main() { string s; string t; cin >> s >> t; int m = s.length(); int n = t.length(); int dp[m + 5][n + 5]; for (int i = 0; i <= m; i++) { for (int j = 0; j <= n; j++) { if (i == 0 || j == 0) { dp[i][j] = 0; continue; ...
replace
7
10
7
13
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; template <class T, class U> using P = pair<T, U>; template <class T> using Heap = priority_queue<T>; template <class T> using heaP = priority_queue<T, vector<T>...
#include <bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; template <class T, class U> using P = pair<T, U>; template <class T> using Heap = priority_queue<T>; template <class T> using heaP = priority_queue<T, vector<T>...
replace
53
54
53
54
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> // #define int int64_t #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, int(n) + 1) #define rrep(i, n) RFOR(i, 0, n) #define rrep1(i, n) RFOR(i, 1, int(n) + 1) #define...
#include <bits/stdc++.h> // #define int int64_t #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, int(n) + 1) #define rrep(i, n) RFOR(i, 0, n) #define rrep1(i, n) RFOR(i, 1, int(n) + 1) #define...
replace
13
14
13
14
0
p03165
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; int dp[3000][3000]; P pre[3000][3000]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; int dp[3001][3001]; P pre[3001][3001]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10...
replace
13
15
13
15
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 7; int dp[N][N]; // dp[i][j] 到 i,j为止最长的公共子序列长度 int main() { string s, t; cin >> s >> t; s = "0" + s; t = "0" + t; int ls = s.size(), lt = t.size(); for (int i = 1; i < ls; i++) { for (int j = 1; j < lt; j++) { dp[i][j] = max(dp[...
#include <bits/stdc++.h> using namespace std; const int N = 3e3 + 7; int dp[N][N]; // dp[i][j] 到 i,j为止最长的公共子序列长度 int main() { string s, t; cin >> s >> t; s = "0" + s; t = "0" + t; int ls = s.size(), lt = t.size(); for (int i = 1; i < ls; i++) { for (int j = 1; j < lt; j++) { dp[i][j] = max(dp[...
replace
3
4
3
4
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int memo[1005][1005]; /// ... for storing DP values ... string a, b; /// ... Two Strings ... int call(int len1, int len2) { /// if two string come to the end then there are no substring can create ... /// so we return Zero. if (len1 == (int)a.size() || len2 == (in...
#include <bits/stdc++.h> using namespace std; int memo[3005][3005]; /// ... for storing DP values ... string a, b; /// ... Two Strings ... int call(int len1, int len2) { /// if two string come to the end then there are no substring can create ... /// so we return Zero. if (len1 == (int)a.size() || len2 == (in...
replace
4
5
4
5
0
p03165
C++
Runtime Error
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { // freopen("LCS.inp","r",stdin); int i, j; string s, t, k = ""; getline(cin, s); getline(cin, t); int f[s.length()][t.length()]; for (i = 0; i <= s.length(); i++) f[i][0] = 0; for (j = 0; j <= t.length(); j++)...
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { // freopen("LCS.inp","r",stdin); int i, j; string s, t, k = ""; getline(cin, s); getline(cin, t); int f[s.length() + 1][t.length() + 1]; for (i = 0; i <= s.length(); i++) f[i][0] = 0; for (j = 0; j <= t.length...
replace
11
12
11
12
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define F first #define S second #define mp make_pair #define pb push_back #define ll long long #define LEFT(a) ((a) << 1) #define RIGHT(a) (LEFT(a) + 1) #define MID(a, b) ((a + b) >> 1) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) using namespace std; c...
#include <bits/stdc++.h> #define F first #define S second #define mp make_pair #define pb push_back #define ll long long #define LEFT(a) ((a) << 1) #define RIGHT(a) (LEFT(a) + 1) #define MID(a, b) ((a + b) >> 1) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) using namespace std; c...
replace
14
15
14
15
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define li long long int const int N = 1e3 + 5; const li mod = 1e9 + 7; string a, b; int n, m; int dp[N][N]; int go(int x, int y) { if (x >= n or y >= m) return dp[x][y] = 0; if (dp[x][y] != -1) return dp[x][y]; int ans = 0; if (a[x] == b[y]) ans = ...
#include <bits/stdc++.h> using namespace std; #define li long long int const int N = 3e3 + 5; const li mod = 1e9 + 7; string a, b; int n, m; int dp[N][N]; int go(int x, int y) { if (x >= n or y >= m) return dp[x][y] = 0; if (dp[x][y] != -1) return dp[x][y]; int ans = 0; if (a[x] == b[y]) ans = ...
replace
6
7
6
7
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define PB push_back #define PII pair<long long, long long> #define FAST \ ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define PB push_back #define PII pair<long long, long long> #define FAST \ ios::sync_with_stdio(false); ...
replace
12
13
12
13
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 4e18, N = 3001; string s, t; ll dp[N][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> s >> t; for (int i = 0; i <= s.size(); i += 1) for (int j = 0; j <= t.size(); j += 1) dp[i][j] = 0; for (in...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 4e18, N = 3001; string s, t; ll dp[N][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> s >> t; for (int i = 0; i <= s.size(); i += 1) for (int j = 0; j <= t.size(); j += 1) dp[i][j] = 0; for (in...
replace
37
38
37
38
-11
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define int long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (int)x.size() #define endl '\n' #define h...
#include <bits/stdc++.h> #define int long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (int)x.size() #define endl '\n' #define h...
replace
42
44
42
44
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define boost ios_base::sync_with_stdio(false), cin.tie(NULL); using namespace std; const int N = 1e3 + 44; const int X[] = {1, 0, -1, 0, 1, -1, 1, -1}; const int Y[] = {0, 1, 0, -1, 1, 1, -1, -1}; const int mod = 1e9 + 7; const long long INF = 1e18; const int inf = 1e9; int dp[N][N]; pair<i...
#include <bits/stdc++.h> #define boost ios_base::sync_with_stdio(false), cin.tie(NULL); using namespace std; const int N = 4e3 + 44; const int X[] = {1, 0, -1, 0, 1, -1, 1, -1}; const int Y[] = {0, 1, 0, -1, 1, 1, -1, -1}; const int mod = 1e9 + 7; const long long INF = 1e18; const int inf = 1e9; int dp[N][N]; pair<i...
replace
4
5
4
5
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define endl '\n' const long long inf = 1e18; ll dp[3005][3005]; string find(string a, string b) { ll n = a.length(); ll m = b.length(); for (int i = 0; i <= n; i++) { for (int j = 0; j <= m; j++) { if (i == 0 || j == 0) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define endl '\n' const long long inf = 1e18; ll dp[3005][3005]; string find(string a, string b) { ll n = a.length(); ll m = b.length(); for (int i = 0; i <= n; i++) { for (int j = 0; j <= m; j++) { if (i == 0 || j == 0) { ...
replace
37
38
37
38
-6
free(): invalid pointer
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; template <class T> istream &operator>>(istream &in, vector<T> &arr) { for (auto &x : arr) in >> x; return in; } template <class T> ostream &operator<<(ostream &out, const vector<T> &arr) { for ...
#include <algorithm> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; template <class T> istream &operator>>(istream &in, vector<T> &arr) { for (auto &x : arr) in >> x; return in; } template <class T> ostream &operator<<(ostream &out, const vector<T> &arr) { for ...
replace
22
23
22
23
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FOR(i, x, y) for (int i = x; i < y; i++) #define FORN(i, x, y) for (int i = x; i <= y; i++) #define DEC(i, x, y) for (int i = x; i >= y; i--) #define scan1(X) scanf("%d", &X) #define scan2(X, Y) scanf("%d%d", &X, &Y) #define scan3(X, Y, Z) scanf("%d%d%d", &X, &Y, &Z...
#include <bits/stdc++.h> using namespace std; #define FOR(i, x, y) for (int i = x; i < y; i++) #define FORN(i, x, y) for (int i = x; i <= y; i++) #define DEC(i, x, y) for (int i = x; i >= y; i--) #define scan1(X) scanf("%d", &X) #define scan2(X, Y) scanf("%d%d", &X, &Y) #define scan3(X, Y, Z) scanf("%d%d%d", &X, &Y, &Z...
replace
60
61
60
61
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\n...
replace
53
54
53
54
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define f(i, a, b) for (i = a; i < ...
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define f(i, a, b) for (i = a; i < ...
replace
26
27
26
27
0
p03165
C++
Runtime Error
// In the name of God #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e3 + 10, mod = 1e9 + 7; int dp[N][N]; pii par[N][N], lst; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s, t; cin >> s >> t; s = "!" ...
// In the name of God #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 3e3 + 10, mod = 1e9 + 7; int dp[N][N]; pii par[N][N], lst; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s, t; cin >> s >> t; s = "!" ...
replace
8
9
8
9
0
p03165
C++
Runtime Error
/*#include<iostream> #include<algorithm> using namespace std; int knapsack(int c, int items, int values[], int w[]) { int i = 0; int p; int dp[4][9]; for (; i < items; i++) { for (p = 0; p <= c; p++) { if (i == 0 || p == 0) ...
/*#include<iostream> #include<algorithm> using namespace std; int knapsack(int c, int items, int values[], int w[]) { int i = 0; int p; int dp[4][9]; for (; i < items; i++) { for (p = 0; p <= c; p++) { if (i == 0 || p == 0) ...
replace
99
101
99
105
0
p03165
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array...
replace
30
31
30
31
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long double ld; typedef set<int>::iterator sit; typedef map<int, int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 +...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long double ld; typedef set<int>::iterator sit; typedef map<int, int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 +...
replace
93
94
93
94
0
p03165
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define sz(a) int((a).size()) #define all(c) c.begin(), c.end() #define ll long long #define pb push_back #define zoom \ ios_base::sync_with_stdio(false); \ cin...
#include <bits/stdc++.h> using namespace std; #define sz(a) int((a).size()) #define all(c) c.begin(), c.end() #define ll long long #define pb push_back #define zoom \ ios_base::sync_with_stdio(false); \ cin...
replace
55
56
55
56
TLE
p03165
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int dp[s.size() + 1][t.size() + 1]; for (int i = 0; i <= s.size(); i++) dp[i][0] = 0; for (int i = 0; i <= t.size(); i++) dp[0][i] = 0; for (int i = 1; i <= s.size(); i++) { for (int j = 1; j <= t.size(); j++)...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int dp[s.size() + 1][t.size() + 1]; for (int i = 0; i <= s.size(); i++) dp[i][0] = 0; for (int i = 0; i <= t.size(); i++) dp[0][i] = 0; for (int i = 1; i <= s.size(); i++) { for (int j = 1; j <= t.size(); j++)...
replace
25
26
25
26
0
p03165
C++
Runtime Error
#include <bits/stdc++.h> #define MAXN 1100 using namespace std; int LCS[MAXN][MAXN]; char L[MAXN]; int main() { string s1, s2; cin >> s1 >> s2; int x = s1.size(); int y = s2.size(); int i, j; for (i = 0; i <= x; i++) for (j = 0; j <= y; j++) { if (i == 0 || j == 0) LCS[i][j] = 0; e...
#include <bits/stdc++.h> #define MAXN 3500 using namespace std; int LCS[MAXN][MAXN]; char L[MAXN]; int main() { string s1, s2; cin >> s1 >> s2; int x = s1.size(); int y = s2.size(); int i, j; for (i = 0; i <= x; i++) for (j = 0; j <= y; j++) { if (i == 0 || j == 0) LCS[i][j] = 0; e...
replace
1
2
1
2
0
p03165
C++
Runtime Error
using namespace std; #include <bits/stdc++.h> #define Debug(...) fprintf(stderr, __VA_ARGS__) #define st first #define nd second #define FORE(i, a, b) for (int i = (a), b_ = (b); i <= b_; ++i) #define FORD(i, a, b) for (int i = (a), b_ = (b); i >= b_; --i) #define TR(c, it) ...
using namespace std; #include <bits/stdc++.h> #define Debug(...) fprintf(stderr, __VA_ARGS__) #define st first #define nd second #define FORE(i, a, b) for (int i = (a), b_ = (b); i <= b_; ++i) #define FORD(i, a, b) for (int i = (a), b_ = (b); i >= b_; --i) #define TR(c, it) ...
replace
13
14
13
14
0
p03165
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; vector<vector<string>> st(s.size() + 1, vector<string>(t.size() + 1, "")); for (int i = 1; i <= s.size(); i++) { for (int j = 1; j <= t.size(); j++) { if (st[i - 1][j].size() > st[i][j - 1].size()) { st[i...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; vector<vector<string>> st(s.size() + 1, vector<string>(t.size() + 1, "")); for (int i = 1; i <= s.size(); i++) { for (int j = 1; j <= t.size(); j++) { if (st[i - 1][j].size() > st[i][j - 1].size()) { st[i...
replace
21
22
21
22
MLE
p03165
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int dp[1010][1010]; int main() { string a, b; cin >> a >> b; int n = a.size(), m = b.size(); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (a[i - 1] == b[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1; else ...
#include <algorithm> #include <iostream> using namespace std; int dp[3010][3010]; int main() { string a, b; cin >> a >> b; int n = a.size(), m = b.size(); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (a[i - 1] == b[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1; else ...
replace
5
6
5
6
0