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
p02936
C++
Runtime Error
/* * atcoder/abc138_2nd/d.cpp */ // C++ 14 #include <algorithm> #include <cassert> #include <cmath> #include <cstring> // memset #include <iostream> #include <vector> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) template <class T> ostream &op...
/* * atcoder/abc138_2nd/d.cpp */ // C++ 14 #include <algorithm> #include <cassert> #include <cmath> #include <cstring> // memset #include <iostream> #include <vector> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) template <class T> ostream &op...
replace
36
37
36
37
0
p02936
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; typedef pair<int, int> P; typedef tuple<ll, ll, ll> T; const long long INF = 1LL << 60; const int MOD = 1000000000 + 7; #define rev(s) (string((s).rbegin(), (s).rend())) template <typename T> inline strin...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef tuple<ll, ll, ll> T; const long long INF = 1LL << 60; const int MOD = 1000000000 + 7; #define rev(s) (string((s).rbegin(), (s).rend())) template <typename T> inline strin...
replace
23
27
23
27
0
p02936
C++
Runtime Error
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */ // codeforces1038D #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define mp make_pair #define pb push_back void parseArray(ll *A, ll...
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */ // codeforces1038D #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define mp make_pair #define pb push_back void parseArray(ll *A, ll...
replace
30
34
30
34
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; ll a[maxn], b[maxn]; vector<int> v[maxn]; void f(int n) { for (int i = 0; i < v[n].size(); i++) { int k = v[n][i]; a[k] += (b[n] + b[k]); b[k] += b[n]; for (int i = 0; i < v[k].size(); i++) { int l = v...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 5; ll a[maxn], b[maxn]; vector<int> v[maxn]; void f(int n) { for (int i = 0; i < v[n].size(); i++) { int k = v[n][i]; a[k] += (b[n] + b[k]); b[k] += b[n]; for (int i = 0; i < v[k].size(); i++) { int l = v...
replace
3
4
3
4
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 10; ll a[maxn]; ll ans[maxn]; int ru[maxn]; int tot = 0, head[maxn], ne[maxn], to[maxn]; vector<int> s[maxn]; void add(int x, int y) { tot++; to[tot] = y; ne[tot] = head[x]; head[x] = tot; } void dfs(int x, int pre) { a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 4e5 + 10; ll a[maxn]; ll ans[maxn]; int ru[maxn]; int tot = 0, head[maxn], ne[maxn], to[maxn]; vector<int> s[maxn]; void add(int x, int y) { tot++; to[tot] = y; ne[tot] = head[x]; head[x] = tot; } void dfs(int x, int pre) { a...
replace
3
4
3
4
0
p02936
Python
Runtime Error
def c(i, p, f, g, k, vis): if vis[i]: return vis[i] = True w = f[i] + p k[i] = w ch = g[i] for x in ch: c(x, w, f, g, k, vis) def main(): import sys sys.setrecursionlimit(200000) n, q, *abpx = map(int, sys.stdin.read().split()) g = [[] for _ in range(n + 1)] ...
def c(i, p, f, g, k, vis): if vis[i]: return vis[i] = True w = f[i] + p k[i] = w ch = g[i] for x in ch: c(x, w, f, g, k, vis) def main(): import sys sys.setrecursionlimit(300000) n, q, *abpx = map(int, sys.stdin.read().split()) g = [[] for _ in range(n + 1)] ...
replace
14
15
14
15
0
p02936
Python
Runtime Error
from collections import deque def solve(string): n, q, *abpx = map(int, string.split()) ab, px = abpx[: 2 * n - 2], abpx[2 * n - 2 :] check = [True] * (n + 1) t = {i: [] for i in range(n + 1)} c = [0] * (n + 1) d = deque([1]) for a, b in zip(*[iter(ab)] * 2): t[a].append(b) ...
from collections import deque def solve(string): n, q, *abpx = map(int, string.split()) ab, px = abpx[: 2 * n - 2], abpx[2 * n - 2 :] check = [True] * (n + 1) t = {i: [] for i in range(n + 1)} c = [0] * (n + 1) d = deque([1]) for a, b in zip(*[iter(ab)] * 2): t[a].append(b) ...
replace
27
28
27
30
EOFError: EOF when reading a line
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02936/Python/s487174146.py", line 28, in <module> print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n + m)]))) File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02936/P...
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; typedef pair<ll, ll> P; const int MAX = 2 * 1e5 + 10; const int INF = 1e9; const int MOD = 1e9 + 7; int N, Q; vector<int> G[MAX]; vector<int> ans(MAX); void dfs(int n, int x, map<int, int> m) { ans[...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; typedef pair<ll, ll> P; const int MAX = 2 * 1e5 + 10; const int INF = 1e9; const int MOD = 1e9 + 7; int N, Q; vector<int> G[MAX]; vector<int> ans(MAX); void dfs(int n, int x, map<int, int> &m) { ans...
replace
15
16
15
16
TLE
p02936
C++
Runtime Error
/*input 6 2 1 2 1 3 2 4 3 6 2 5 1 10 1 10 */ // assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) // is(65-90) and 32 for space #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define...
/*input 6 2 1 2 1 3 2 4 3 6 2 5 1 10 1 10 */ // assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) // is(65-90) and 32 for space #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define...
replace
38
39
38
39
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long typedef pair<ll, ll> P; #define M 1000000007 int n, q, a, b, x, y; vector<vector<int>> d(100010); vector<int> t(100010, 0), v(100010); int c = 0; void dfs(int p) { c += t[p]; v[p] = c; for (auto au : d[p]) { dfs(au); } c -= t[p]; } int mai...
#include <bits/stdc++.h> using namespace std; #define ll long long typedef pair<ll, ll> P; #define M 1000000007 int n, q, a, b, x, y; vector<vector<int>> d(200010); vector<int> t(200010, 0), v(200010); int c = 0; void dfs(int p) { c += t[p]; v[p] = c; for (auto au : d[p]) { dfs(au); } c -= t[p]; } int mai...
replace
6
8
6
8
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int N, Q; cin >> N >> Q; vector<vector<int>> t(N); for (int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; a--; b--; t[a].push_back(b); } vector<int> point(N); for (int i = 0; i < Q; i++) { int p, x; cin >> p >> x;...
#include <bits/stdc++.h> using namespace std; int main() { int N, Q; cin >> N >> Q; vector<vector<int>> t(N); for (int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; a--; b--; t[a].push_back(b); } vector<int> point(N); for (int i = 0; i < Q; i++) { int p, x; cin >> p >> x;...
replace
20
29
20
31
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) using namespace std; typedef long long ll; const int MOD = 1000000007; vector<int> to[20005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u : to[v]) { if (u ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) using namespace std; typedef long long ll; const int MOD = 1000000007; vector<int> to[200005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u : to[v]) { if (u...
replace
10
11
10
11
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define hell 1000000007 #define lcm(a, b) (a * b) / __gcd(a, b) #define ll long long #define vll vector<ll> #define vi vector<int> #define pll vector<pair<ll, ll>> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define lbnd lower_bound #define ubnd upper_bound #def...
#include <bits/stdc++.h> #define hell 1000000007 #define lcm(a, b) (a * b) / __gcd(a, b) #define ll long long #define vll vector<ll> #define vi vector<int> #define pll vector<pair<ll, ll>> #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define lbnd lower_bound #define ubnd upper_bound #def...
replace
29
30
29
30
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = pow(10, 9) + 7; // const ll MOD = 998244353; // const ll MOD = ; ll mod(ll A, ll M) { return (A % M + M) % M; } const ll INF = 1LL << 60; template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = pow(10, 9) + 7; // const ll MOD = 998244353; // const ll MOD = ; ll mod(ll A, ll M) { return (A % M + M) % M; } const ll INF = 1LL << 60; template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return ...
replace
31
34
31
34
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int increment(vector<vector<int>> &c, int parent, int start, int x, vector<ll> steps, vector<ll> &scores) { x += steps.at(start); scores.at(start) = x; for (int node : c.at(start)) { if (node == parent) { continue; } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int increment(vector<vector<int>> &c, int parent, int start, int x, vector<ll> &steps, vector<ll> &scores) { x += steps.at(start); scores.at(start) = x; for (int node : c.at(start)) { if (node == parent) { continue; }...
replace
5
6
5
6
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; ++i) #define ALL(a) (a).begin(), (a).end() using namespace std; using ll = long long; using pll = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll LINF = 1LL << 60; const int INF = 1e9 + 7; struct node { vector<ll> child; ll counter = 0; }; vector<...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; ++i) #define ALL(a) (a).begin(), (a).end() using namespace std; using ll = long long; using pll = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll LINF = 1LL << 60; const int INF = 1e9 + 7; struct node { vector<ll> child; ll counter = 0; }; vector<...
replace
18
19
18
19
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define FOR(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++) #define DEC(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--) typedef pair<ll, ll> pi; typedef pair<pi, ll> pii; typedef pair<pi, pi> pipi; #define f first #define s second typ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define FOR(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++) #define DEC(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--) typedef pair<ll, ll> pi; typedef pair<pi, ll> pii; typedef pair<pi, pi> pipi; #define f first #define s second typ...
replace
37
40
37
40
0
p02936
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <string.h> #include <string> #include <vector> using namespace std; long long dp[3][100100] ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <string.h> #include <string> #include <vector> using namespace std; long long dp[3][100100] ...
replace
282
284
282
284
0
p02936
C++
Runtime Error
#include <cctype> #include <cstdio> #define getc \ (l == r && (r = (l = c) + fread(c, 1, 1 << 21, stdin), l == r) ? EOF : *l++) char c[1 << 21], *l = c, *r = c; inline int read() { int x = 0; char ch = getc; while (!isdigit(ch)) ch = getc; ...
#include <cctype> #include <cstdio> #define getc \ (l == r && (r = (l = c) + fread(c, 1, 1 << 21, stdin), l == r) ? EOF : *l++) char c[1 << 21], *l = c, *r = c; inline int read() { int x = 0; char ch = getc; while (!isdigit(ch)) ch = getc; ...
replace
18
19
18
19
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; vector<int> edges[MAXN]; long long a[MAXN], add[MAXN]; bool vis[MAXN]; void dfs(int u, long long qtt) { vis[u] = true; a[u] = add[u] + qtt; for (int v : edges[u]) { if (!vis[v]) dfs(v, qtt + add[u]); } } int main() { ios::s...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; vector<int> edges[MAXN]; long long a[MAXN], add[MAXN]; bool vis[MAXN]; void dfs(int u, long long qtt) { vis[u] = true; a[u] = add[u] + qtt; for (int v : edges[u]) { if (!vis[v]) dfs(v, qtt + add[u]); } } int main() { ios::s...
replace
3
4
3
4
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; void solve(int v, const vector<vector<int>> G, vector<bool> &seen, vector<long long> &cost) { seen[v] = 1; for (auto nv : G[v]) { if (seen[nv]) continue; cost[nv] += cost[v]; solve(nv, G, seen, cost); } } int main() { int N, Q; scanf("...
#include <bits/stdc++.h> using namespace std; void solve(int v, const vector<vector<int>> &G, vector<bool> &seen, vector<long long> &cost) { seen[v] = 1; for (auto nv : G[v]) { if (seen[nv]) continue; cost[nv] += cost[v]; solve(nv, G, seen, cost); } } int main() { int N, Q; scanf(...
replace
2
3
2
3
TLE
p02936
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #def...
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #def...
replace
92
93
92
93
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007; #define INF 1000000000000000001; #define ll long long vector<int> g[200005]; vector<pair<int, int>> wg[123456]; int level[123456]; void dfs(int s, int pre) { for (auto i : g[s]) { if (i != pre) { level[i] += level[s]; dfs(i, s); ...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007; #define INF 1000000000000000001; #define ll long long vector<int> g[200005]; vector<pair<int, int>> wg[123456]; int level[200005]; void dfs(int s, int pre) { for (auto i : g[s]) { if (i != pre) { level[i] += level[s]; dfs(i, s); ...
replace
7
8
7
8
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; ++i) #define all_map(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++) #define ALL(a) (a).begin(), (a).end() using namespace std; using ll = long long; using pll = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll LINF = 1LL << 62; const int IN...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; ++i) #define all_map(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++) #define ALL(a) (a).begin(), (a).end() using namespace std; using ll = long long; using pll = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll LINF = 1LL << 62; const int IN...
replace
14
16
14
16
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++) #define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--) #define ALL(x) (x).begin(), (x).end()...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++) #define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--) #define ALL(x) (x).begin(), (x).end()...
replace
24
28
24
28
-11
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll MOD = 1000000007; vector<int> to[20005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u = 0; u < int(to[v].size()); u++) { int x = to[v][u]; if (x == p) continue; ans[x] += ans[v]; dfs(x, v); } } int main() {...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll MOD = 1000000007; vector<int> to[200005]; vector<int> ans; void dfs(int v, int p = -1) { for (int u = 0; u < int(to[v].size()); u++) { int x = to[v][u]; if (x == p) continue; ans[x] += ans[v]; dfs(x, v); } } int main() ...
replace
6
7
6
7
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; typedef vector<ll> vi; typedef vector<pi> vpi; #define f first #define s second #define FOR(i, s, e) for (ll i = s; i <= ll(e); ++i) #define DEC(i, s, e) for (ll i = s; i >= ll(e); --i) #define pb push_back #define all(x) (x)....
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; typedef vector<ll> vi; typedef vector<pi> vpi; #define f first #define s second #define FOR(i, s, e) for (ll i = s; i <= ll(e); ++i) #define DEC(i, s, e) for (ll i = s; i >= ll(e); --i) #define pb push_back #define all(x) (x)....
replace
19
20
19
20
0
p02936
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <stack> #include <unordered_map> #include <vector> using namespace std; using ll = long long; const long long INF = (long long)1e18...
#include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <stack> #include <unordered_map> #include <vector> using namespace std; using ll = long long; const long long INF = (long long)1e18...
replace
19
20
19
20
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #ifdef ENABLE_DEBUG_OUTPUT #define DEBUG_LOG(s) cout << s << endl; #else #define DEBUG_LOG(s) void(); #endif vector<vector<int>> g; vector<bool> v; vector<int64_t> c; vector<int64_t> p; void dfs(const int s, int64_t x) { if (v[s]) return; v[s] = true; x += p[s];...
#include <bits/stdc++.h> using namespace std; #ifdef ENABLE_DEBUG_OUTPUT #define DEBUG_LOG(s) cout << s << endl; #else #define DEBUG_LOG(s) void(); #endif vector<vector<int>> g; vector<bool> v; vector<int64_t> c; vector<int64_t> p; void dfs(const int s, int64_t x) { if (v[s]) return; v[s] = true; x += p[s];...
insert
38
38
38
39
-11
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define LLINF 9223372036854775807 #define MOD ll(1e9 + 7) #define all(x) (x).begin(), (x).end() #define dbg(x) cerr << #x << ": " << x << endl vector<bool> visited(100005, false); int main() { l...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define LLINF 9223372036854775807 #define MOD ll(1e9 + 7) #define all(x) (x).begin(), (x).end() #define dbg(x) cerr << #x << ": " << x << endl vector<bool> visited(200005, false); int main() { l...
replace
10
11
10
11
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define Sort(a) sort(a.begin(), a.end()) typedef long long int ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; templa...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define Sort(a) sort(a.begin(), a.end()) typedef long long int ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; templa...
replace
25
27
25
27
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) #define rep2(i, a, b) for (ll i = (a); i < (b); i++) typedef uint64_t ull; typedef int64_t ll; typedef std::pair<ll, ll> PLL; using namespace std; ll N, Q; vector<ll> edges[100100]; ll c[100100]; void dfs(ll ix, ll carry, ll par) { c[ix] += c...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) #define rep2(i, a, b) for (ll i = (a); i < (b); i++) typedef uint64_t ull; typedef int64_t ll; typedef std::pair<ll, ll> PLL; using namespace std; ll N, Q; vector<ll> edges[300100]; ll c[300100]; void dfs(ll ix, ll carry, ll par) { c[ix] += c...
replace
11
13
11
13
0
p02936
C++
Runtime Error
// https://youtu.be/mRHBP3xwgn4 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef long long unsigned llu; typedef pair<long long, long long> pll; const long long inf = 2000000000000000000LL; // 2e18 #define pi acos(-1.0) #define fast ...
// https://youtu.be/mRHBP3xwgn4 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef long long unsigned llu; typedef pair<long long, long long> pll; const long long inf = 2000000000000000000LL; // 2e18 #define pi acos(-1.0) #define fast ...
replace
27
30
27
30
0
p02936
C++
Runtime Error
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; vector<int> Graph[20010]; int Score[20010]; bool flag[20010]; void dfs...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; vector<int> Graph[200010]; int Score[200010]; bool flag[200010]; void ...
replace
12
15
12
15
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define __sel(_1, _2, x, ...) x #define repn(i, n) for (ll i = 0; i < (n); i++) #define repr(i, a, b) for (ll i = (a); i < (b); i++) #define rep(i, ...) __sel(__VA_ARGS__, repr, repn)(i, __VA_ARGS__) #define rrepn(i, n) for (ll i = (n - 1); i >= 0; i--) #define rrepr(i, a, b) for (ll i = (b ...
#include <bits/stdc++.h> #define __sel(_1, _2, x, ...) x #define repn(i, n) for (ll i = 0; i < (n); i++) #define repr(i, a, b) for (ll i = (a); i < (b); i++) #define rep(i, ...) __sel(__VA_ARGS__, repr, repn)(i, __VA_ARGS__) #define rrepn(i, n) for (ll i = (n - 1); i >= 0; i--) #define rrepr(i, a, b) for (ll i = (b ...
insert
155
155
155
156
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD 1000000007 #define INF 1LL << 30 #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() int s[100010]; vector<vector<int>> G; void dfs(int v, int p, int x) { s[v] += x; for (auto u : G[v]) { if (u ==...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD 1000000007 #define INF 1LL << 30 #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() int s[200010]; vector<vector<int>> G; void dfs(int v, int p, int x) { s[v] += x; for (auto u : G[v]) { if (u ==...
replace
8
9
8
9
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REPR(i, n) for (int i = (int)(n); i > 0; i--) #define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define INF 2e9 #define ALL(v) (v).begin(), (v).end() template <typename Iter> std::string join(Iter begin, Iter end, std::st...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REPR(i, n) for (int i = (int)(n); i > 0; i--) #define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define INF 2e9 #define ALL(v) (v).begin(), (v).end() template <typename Iter> std::string join(Iter begin, Iter end, std::st...
replace
19
20
19
20
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; #define fi first #define se second #define pb push_back #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } templ...
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; #define fi first #define se second #define pb push_back #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } templ...
replace
46
48
46
47
0
p02936
C++
Runtime Error
/*input */ #include <bits/stdc++.h> using namespace std; #define all(a) a.begin(), a.end() #define ff first #define ss second #define pb push_back using ll = long long; using pii = pair<int, int>; template <typename T> using V = vector<T>; const int N = 1e5 + 10; ll add[N], ans[N]; vector<int> adj[N]; void dfs(in...
/*input */ #include <bits/stdc++.h> using namespace std; #define all(a) a.begin(), a.end() #define ff first #define ss second #define pb push_back using ll = long long; using pii = pair<int, int>; template <typename T> using V = vector<T>; const int N = 2e5 + 10; ll add[N], ans[N]; vector<int> adj[N]; void dfs(in...
replace
15
16
15
16
0
p02936
C++
Runtime Error
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <s...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <s...
replace
86
87
86
87
-11
p02936
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; typedef pair<int, int> ii; struct node { int counter = 0; vector<int> neighbors; bool visited = false; }; void dfs(vector<node> &nodes, int subroot) { auto parent = nodes[subroot]; for (int neighbor : nodes[subroot].neighbors) { auto n = nodes[...
#include <iostream> #include <vector> using namespace std; typedef pair<int, int> ii; struct node { int counter = 0; vector<int> neighbors; bool visited = false; }; void dfs(vector<node> &nodes, int subroot) { auto parent = nodes[subroot]; for (int neighbor : parent.neighbors) { auto &n = nodes[neighbo...
replace
14
16
14
16
-11
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, q, cnt, h[200005], nex[200005], to[200005 << 1], ans[200005]; void addedge(int x, int y) { nex[++cnt] = h[x]; to[cnt] = y; h[x] = cnt; } void dfs(int x, int f) { ans[x] += ans[f]; for (int i = h[x]; i; i = nex[i]) if (to[i] != f) dfs(to[i], x);...
#include <bits/stdc++.h> using namespace std; int n, q, cnt, h[200005], nex[200005 << 1], to[200005 << 1], ans[200005]; void addedge(int x, int y) { nex[++cnt] = h[x]; to[cnt] = y; h[x] = cnt; } void dfs(int x, int f) { ans[x] += ans[f]; for (int i = h[x]; i; i = nex[i]) if (to[i] != f) dfs(to[i]...
replace
3
4
3
4
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int mod = 1e9 + 7; int INF = 2e18; struct leaves { int up; vector<int> down; int point = 0; }; int N, Q; int ans[100100]; leaves tree[100100]; void dfs(int direct, int point) { tree[direct].point += point; for (int i = 0; i < tree[direct]....
#include <bits/stdc++.h> using namespace std; #define int long long int mod = 1e9 + 7; int INF = 2e18; struct leaves { int up; vector<int> down; int point = 0; }; int N, Q; int ans[250000]; leaves tree[250000]; void dfs(int direct, int point) { tree[direct].point += point; for (int i = 0; i < tree[direct]....
replace
13
15
13
15
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; #define fi first #define se second #define repl(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define rep(i, n) repl(i, 0, n) #define all(x) (x).begin(), (x).end() #define dbg(x) cout << #x "=...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; #define fi first #define se second #define repl(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define rep(i, n) repl(i, 0, n) #define all(x) (x).begin(), (x).end() #define dbg(x) cout << #x "=...
replace
25
27
25
27
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5; vector<int> arr[N]; vector<int> val(N, 0); vector<int> ans(N); bool seen[N]; void sol(int v, int value) { ans[v] = val[v] + value; seen[v] = true; for (int i = 0; i < arr[v].size(); i++) { if (!seen[arr[v][i]]) sol(arr[v][i], value + v...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; vector<int> arr[N]; vector<int> val(N, 0); vector<int> ans(N); bool seen[N]; void sol(int v, int value) { ans[v] = val[v] + value; seen[v] = true; for (int i = 0; i < arr[v].size(); i++) { if (!seen[arr[v][i]]) sol(arr[v][i], value...
replace
3
4
3
4
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define vi vector<int> #define vll vector<ll> #define pll pair<ll, ll> #define pii pair<int, int> #define pb push_back #define mp make_pair #define SIZE 100005 vll tree[SIZE]; ll arr[SIZE]; int main() { // #ifndef ONLINE_JUDGE // freopen("input.txt...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define vi vector<int> #define vll vector<ll> #define pll pair<ll, ll> #define pii pair<int, int> #define pb push_back #define mp make_pair #define SIZE 200005 vll tree[SIZE]; ll arr[SIZE]; int main() { // #ifndef ONLINE_JUDGE // freopen("input.txt...
replace
9
10
9
10
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<long long> adj[20005]; vector<long long> res; void dfs(long long v, long long p = -1) { for (auto itr : adj[v]) { if (itr == p) continue; res[itr] += res[v]; // dfs(itr, v); } } int main() { long long n, q; cin >> n >> q; long long a, b...
#include <bits/stdc++.h> using namespace std; vector<long long> adj[200005]; vector<long long> res; void dfs(long long v, long long p = -1) { for (auto itr : adj[v]) { if (itr == p) continue; res[itr] += res[v]; // dfs(itr, v); } } int main() { long long n, q; cin >> n >> q; long long a, ...
replace
3
4
3
4
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define P pair<ll, ll> #define FOR(I, A, B) for (ll I = ll(A); I < ll(B); ++I) #define FORR(I, A, B) for (ll I = ll((B)-1); I >= ll(A); --I) #define TO(x, t, f) ((x) ? (t) : (f)) #define SORT(x) (sort(x.begin(), x.end())) // 0 2 2 3 4 5 8 9 #define POS...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define P pair<ll, ll> #define FOR(I, A, B) for (ll I = ll(A); I < ll(B); ++I) #define FORR(I, A, B) for (ll I = ll((B)-1); I >= ll(A); --I) #define TO(x, t, f) ((x) ? (t) : (f)) #define SORT(x) (sort(x.begin(), x.end())) // 0 2 2 3 4 5 8 9 #define POS...
replace
28
31
28
31
0
p02936
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define llong long long #define INF (__INT32_MAX__ / 2) #define EPS 10e-8 #define MAX_N 100000 using namespa...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define llong long long #define INF (__INT32_MAX__ / 2) #define EPS 10e-8 #define MAX_N 200000 using namespa...
replace
15
16
15
16
0
p02936
C++
Time Limit Exceeded
// https://atcoder.jp/contests/abc138/tasks/abc138 #include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = lon...
// https://atcoder.jp/contests/abc138/tasks/abc138 #include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = lon...
replace
48
61
48
60
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) using namespace std; using Graph = vector<vector<int>>; typedef long long ll; typedef pair<int, int> P; const int inf = 1 << 21; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) using namespace std; using Graph = vector<vector<int>>; typedef long long ll; typedef pair<int, int> P; const int inf = 1 << 21; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; ...
replace
23
24
23
24
-11
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if (!(p)) #define until(p) while (!(p)) using ll = std::int64_t; using P = std::tuple<int, int>; int N, Q; std::vector<int> G[200100]; ll cnt[200100]; int l[200100], r[200100]; int p, ...
#include <bits/stdc++.h> #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if (!(p)) #define until(p) while (!(p)) using ll = std::int64_t; using P = std::tuple<int, int>; int N, Q; std::vector<int> G[200100]; ll cnt[400100]; int l[200100], r[200100]; int p, ...
replace
13
14
13
14
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, x) for (int i = 0; i < (int)(x); i++) #define REPS(i, x) for (int i = 1; i <= (int)(x); i++) #define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin...
#include <bits/stdc++.h> #define REP(i, x) for (int i = 0; i < (int)(x); i++) #define REPS(i, x) for (int i = 1; i <= (int)(x); i++) #define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin...
replace
12
15
12
15
0
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define N 200000 vector<int> v[N]; int n, q, tot, d[N], l[N], r[N], s[N]; void dfs(int x, int fa) { d[x] = ++tot, l[x] = r[x] = tot; for (int i = 0; i < v[x].size(); i++) { if (v[x][i] == fa) continue; dfs(v[x][i], x); l[x] = min(...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define N 300000 vector<int> v[N]; int n, q, tot, d[N], l[N], r[N], s[N]; void dfs(int x, int fa) { d[x] = ++tot, l[x] = r[x] = tot; for (int i = 0; i < v[x].size(); i++) { if (v[x][i] == fa) continue; dfs(v[x][i], x); l[x] = min(...
replace
3
4
3
4
0
p02936
C++
Runtime Error
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define N (1000000000 + 7) #define M (998244353) #define INF 1e16 typedef long long ll; typedef pai...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define N (1000000000 + 7) #define M (998244353) #define INF 1e16 typedef long long ll; typedef pai...
replace
20
21
20
21
0
p02936
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { int n, q; cin >> n >> q; vector<int> parent(n); // [0]->error for (int i = 1; i < n; i++) { int a, b; cin >> a >> b; parent[b - 1] = a - 1; } vector<ll> cost(n, 0); for (int i =...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { int n, q; cin >> n >> q; vector<int> parent(n); // [0]->error for (int i = 1; i < n; i++) { int a, b; cin >> a >> b; parent[b - 1] = a - 1; } vector<ll> cost(n, 0); for (int i =...
replace
23
29
23
27
TLE
p02936
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using Point = pair<int, int>; // int point[5001][5001] = {0}; vector<bool> used(100, false); void bfs(vector<vector<int>> &data, vector<long long> &ans, int t) { used[t] = true; // ans[t].first = time; for (int i = 0; i < data[t].size(); i++) { if (!used[data[t...
#include <bits/stdc++.h> using namespace std; using Point = pair<int, int>; // int point[5001][5001] = {0}; vector<bool> used(200000, false); void bfs(vector<vector<int>> &data, vector<long long> &ans, int t) { used[t] = true; // ans[t].first = time; for (int i = 0; i < data[t].size(); i++) { if (!used[dat...
replace
6
7
6
7
0
p02936
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int w, h; void dfs(vector<vector<int>> g, int v, vector<bool> &seen, vector<long long> &add_x, vector<long long> &count, long long add) { seen[v] = true; add += add_x[v]; count[v] += add; for (auto i : g[v]) { if (seen[i]) { continue; } ...
#include <bits/stdc++.h> using namespace std; int w, h; void dfs(vector<vector<int>> &g, int v, vector<bool> &seen, vector<long long> &add_x, vector<long long> &count, long long add) { seen[v] = true; add += add_x[v]; count[v] += add; for (auto i : g[v]) { if (seen[i]) { continue; } ...
replace
5
6
5
6
TLE
p02937
C++
Runtime Error
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <locale> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <vector> using namespace std; #define FORN(i, m, n) for (int i = m; i < (n); i++) #define PRINT...
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <locale> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <vector> using namespace std; #define FORN(i, m, n) for (int i = m; i < (n); i++) #define PRINT...
replace
40
41
40
41
0
p02937
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define eb ...
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define eb ...
insert
82
82
82
86
0
p02937
C++
Runtime Error
/* ID:dyx_6661 TASK: LANG: */ #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll; typedef double db; typedef string str; typedef pa...
/* ID:dyx_6661 TASK: LANG: */ #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll; typedef double db; typedef string str; typedef pa...
replace
25
26
25
26
0
p02937
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <ciso646> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #inc...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <ciso646> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #inc...
replace
301
302
301
302
0
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define ll long long #define P pair<int, int> #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define ll long long #define P pair<int, int> #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
replace
30
36
30
36
TLE
p02937
C++
Runtime Error
#include <bits/stdc++.h> const int N = 1e5 + 7; char s[N], t[N]; int lens, lent; using ll = long long; ll ans = 0, last = 0; std::vector<int> ref[30]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cin >> (s + 1) >> (t + 1); lens = strlen(s + 1), lent = strlen(t + 1); for (int i = 1;...
#include <bits/stdc++.h> const int N = 1e5 + 7; char s[N], t[N]; int lens, lent; using ll = long long; ll ans = 0, last = 0; std::vector<int> ref[200]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cin >> (s + 1) >> (t + 1); lens = strlen(s + 1), lent = strlen(t + 1); for (int i = 1...
replace
7
8
7
8
0
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 6; vector<int> e[30]; int main() { string s, t; cin >> s >> t; int len = s.length(); int len2 = t.length(); for (int i = 0; i < len; i++) { e[s[i] - 'a'].push_back(i); } ll now = 0; ll cnt = 0; int flag = 1...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 6; vector<int> e[30]; int main() { string s, t; cin >> s >> t; int len = s.length(); int len2 = t.length(); for (int i = 0; i < len; i++) { e[s[i] - 'a'].push_back(i); } ll now = 0; ll cnt = 0; int flag = 1...
replace
34
35
34
35
TLE
p02937
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define INF 100000000000 #define MOD 1000000007 #define ll long long int // #define int long long int using namespace std; ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define INF 100000000000 #define MOD 1000000007 #define ll long long int // #define int long long int using namespace std; ...
insert
63
63
63
66
0
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string s, t; cin >> s >> t; string ss = s; int tlong = t.size(); int64_t ans = 0; int64_t x = 0; for (int i = 0; i < tlong; i++) { x = ss.find_first_of(t.at(i)); ss.erase(ss.begin(), ss...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string s, t; cin >> s >> t; string ss = s; int tlong = t.size(); int64_t ans = 0; int64_t x = 0; for (int i = 0; i < tlong; i++) { x = ss.find_first_of(t.at(i)); ss.erase(ss.begin(), ss...
replace
14
15
14
16
TLE
p02937
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int lenS = (int)s.size(), lenT = (int)t.size(); vector<vector<int>> s_index(26); for (int i = 0; i < lenS; i++) { int c = s.at(i) - 'a'; s_index.at(c).push_back(i); } for (int i = 0; i < lenS; i++) { int c...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int lenS = (int)s.size(), lenT = (int)t.size(); vector<vector<int>> s_index(26); for (int i = 0; i < lenS; i++) { int c = s.at(i) - 'a'; s_index.at(c).push_back(i); } for (int i = 0; i < lenS; i++) { int c...
insert
24
24
24
25
0
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; #define INF 10000000000000 #define rep(i, n) for (ll i = 0; i < (int)(n); i++) 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 &...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; #define INF 10000000000000 #define rep(i, n) for (ll i = 0; i < (int)(n); i++) 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 &...
replace
40
53
40
49
TLE
p02937
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; int main() { string s, t; cin >> s >> t; map<char, set<int>> mp; vector<vector<int>> v; rep(i, s.size()) { v[s[i] - 'a'].push_back(i); } int id = -1; ll ans = 0; rep(i, t.size()) { in...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { string s, t; cin >> s >> t; map<char, set<int>> mp; vector<vector<int>> v(26); rep(i, s.size()) { v[s[i] - 'a'].push_back(i); } int id = -1; ll ans = 0; rep(i, t.size()) { ...
replace
9
10
9
10
-11
p02937
C++
Time Limit Exceeded
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author tatsumack */ #include <fstream> #include <iostream> #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author tatsumack */ #include <fstream> #include <iostream> #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #...
replace
70
71
70
71
TLE
p02937
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; string ss = s + s; vector<int> v[26]; for (int i = 0; i < ss.size(); i++) { v[ss[i] - 'a'].emplace_back(i); } long long curr = v[t[0] - 'a'][0]; if (t.size() == 1) { cout << curr + 1 << endl; return 0; }...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; string ss = s + s; vector<int> v[26]; for (int i = 0; i < ss.size(); i++) { v[ss[i] - 'a'].emplace_back(i); } if (v[t[0] - 'a'].empty()) { cout << -1 << endl; return 0; } long long curr = v[t[0] - 'a'][0...
insert
9
9
9
13
0
p02937
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i = p; i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) #define dump(a) (cerr << #a << "=" << (a) << endl) #define DUMP(list) \ cout << "{ "; ...
#include <bits/stdc++.h> #define ll long long #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i = p; i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) #define dump(a) (cerr << #a << "=" << (a) << endl) #define DUMP(list) \ cout << "{ "; ...
insert
43
43
43
44
0
p02937
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned int uint; typedef unsigned char uchar; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; #define REP(i, x) for (int i = 0; i < (int)(x); i++) #define REPS(i, x) for (int ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned int uint; typedef unsigned char uchar; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; #define REP(i, x) for (int i = 0; i < (int)(x); i++) #define REPS(i, x) for (int ...
replace
119
120
119
120
0
p02937
C++
Runtime Error
#include <algorithm> #include <climits> #include <cstdlib> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <string.h> #include <string> #include <vector> #define LOOP(N) for (int i = 0; i < (N); ++i) #define REP(i, N) for (int i = 0; i < (N); ++i) #define FOR(i, start, end) for ...
#include <algorithm> #include <climits> #include <cstdlib> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <string.h> #include <string> #include <vector> #define LOOP(N) for (int i = 0; i < (N); ++i) #define REP(i, N) for (int i = 0; i < (N); ++i) #define FOR(i, start, end) for ...
insert
51
51
51
52
0
p02937
C++
Time Limit Exceeded
// vim: shiftwidth=2 expandtab foldmethod=marker // include {{{ #include <cmath> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> // }}} // misc {{{ using namespace std; typedef long long ll; #define rep(i, n)...
// vim: shiftwidth=2 expandtab foldmethod=marker // include {{{ #include <cmath> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> // }}} // misc {{{ using namespace std; typedef long long ll; #define rep(i, n)...
replace
118
119
118
119
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { string s, t; cin >> s >> t; int n = s.size(), m = t.size(); map<char, vector<int>> mp; rep(i, n) mp[s[i]].push_back(i); rep(i, m) if (mp[t[i]].empty()) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { string s, t; cin >> s >> t; int n = s.size(), m = t.size(); map<char, vector<int>> mp; rep(i, n) mp[s[i]].push_back(i); rep(i, m) if (mp[t[i]].empty()) ...
replace
20
30
20
27
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define REP(i, a, n) for (int i = a; i < n; ++i) #define REPR(i, a, n) for (int i = a; i > n; --i) #define RUP(a, b) ((a + b - 1) / (b)) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define mp make_pair #define mt make_...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define REP(i, a, n) for (int i = a; i < n; ++i) #define REPR(i, a, n) for (int i = a; i > n; --i) #define RUP(a, b) ((a + b - 1) / (b)) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define mp make_pair #define mt make_...
replace
64
74
64
70
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define inf 10e17 #define rep(i, n) for (long long i = 0; i < n; i++) #define repr(i, n, m) for (long long i = m; i < n; i++) #define mod 1000000007 #define sorti(x) sort(x.begin(), x.end()) #define sortd(x) sort(x.begin(), x.end(), std::greater<long l...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define inf 10e17 #define rep(i, n) for (long long i = 0; i < n; i++) #define repr(i, n, m) for (long long i = m; i < n; i++) #define mod 1000000007 #define sorti(x) sort(x.begin(), x.end()) #define sortd(x) sort(x.begin(), x.end(), std::greater<long l...
replace
40
42
40
42
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; int main() { string s, t; cin >> s >> t; vector<vector<ll>> ma(26); for (ll i = 0; i < (ll)s.length(); ++i) { ll u = s[i] - 'a'; ma[u].push_back(i + 1); } ll a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; int main() { string s, t; cin >> s >> t; vector<vector<ll>> ma(26); for (ll i = 0; i < (ll)s.length(); ++i) { ll u = s[i] - 'a'; ma[u].push_back(i + 1); } ll a...
replace
30
37
30
36
TLE
p02937
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { string s, t; cin >> s; cin >> t; long long n = s.size(); long long m = t.size(); vector<vector<long long>> index(30); for (long long i = 0; i < 30; i++) index[s[i] - 'a'].push_back(i + 1)...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { string s, t; cin >> s; cin >> t; long long n = s.size(); long long m = t.size(); vector<vector<long long>> index(30); for (long long i = 0; i < n; i++) index[s[i] - 'a'].push_back(i + 1);...
replace
16
17
16
17
-11
p02937
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; const ll INF = 1e18; const ll N = 1e5; const ll M = 1e9 + 7; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s, t; cin >> s >> t; vll p[26]; for (ll i = 0; i < s.size(); ++i) p[s[i] -...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; const ll INF = 1e18; const ll N = 1e5; const ll M = 1e9 + 7; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s, t; cin >> s >> t; vll p[26]; for (ll i = 0; i < s.size(); ++i) p[s[i] -...
insert
22
22
22
26
0
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; typedef pair<ll, ll> P; const int MAX = 1e5 + 10; const int INF = 1e9; const int MOD = 1e9 + 7; string s, t; int main() { cin >> s >> t; map<char, vector<int>> m; rep(i, s.size()) { char c ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; typedef pair<ll, ll> P; const int MAX = 1e5 + 10; const int INF = 1e9; const int MOD = 1e9 + 7; string s, t; int main() { cin >> s >> t; map<char, vector<int>> m; rep(i, s.size()) { char c ...
replace
27
28
27
28
TLE
p02937
C++
Time Limit Exceeded
#include <cstdio> #include <cstring> typedef long long ll; const int N = 100010; int ls, lt, cnt[26], v[26][N]; ll ans; char s[N], t[N]; int main() { scanf("%s%s", s + 1, t + 1); ls = strlen(s + 1); lt = strlen(t + 1); for (int i = 1; i <= ls; ++i) { int x = s[i] - 'a'; v[x][++cnt[x]] = i; } for (i...
#include <cstdio> #include <cstring> typedef long long ll; const int N = 100010; int ls, lt, cnt[26], v[26][N]; ll ans; char s[N], t[N]; int main() { scanf("%s%s", s + 1, t + 1); ls = strlen(s + 1); lt = strlen(t + 1); for (int i = 1; i <= ls; ++i) { int x = s[i] - 'a'; v[x][++cnt[x]] = i; } for (i...
replace
22
29
22
34
TLE
p02937
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <vector> using namespace std; #define int long long #define double long double #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; #define ic(n) ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <vector> using namespace std; #define int long long #define double long double #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; #define ic(n) ...
replace
341
343
341
343
0
p02937
C++
Time Limit Exceeded
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using na...
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using na...
replace
329
330
329
331
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { string s; string t; cin >> s; cin >> t; const uint s_len = s.size(); const uint t_len = t.size(); vector<int> index['z' + 1]; int last_index['z' + 1]{0}; for (uint i = 0; i < s_len; i++) index[s[i]].push_back(i); uint64_t n = 0; i...
#include <bits/stdc++.h> using namespace std; int main() { string s; string t; cin >> s; cin >> t; const uint s_len = s.size(); const uint t_len = t.size(); vector<int> index['z' + 1]; int last_index['z' + 1]{0}; for (uint i = 0; i < s_len; i++) index[s[i]].push_back(i); uint64_t n = 0; i...
replace
26
27
26
27
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<ll, double> P; typedef tuple<ll, ll, ll> T; const long long INF = 1LL << 60; const int MOD = 1000000000 + 7; #define rev(s) (string((s).rbegin(), (s).rend())) template <typename T> inline str...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<ll, double> P; typedef tuple<ll, ll, ll> T; const long long INF = 1LL << 60; const int MOD = 1000000000 + 7; #define rev(s) (string((s).rbegin(), (s).rend())) template <typename T> inline str...
replace
49
50
49
56
TLE
p02937
C++
Runtime Error
// Bismillahirrahmanirrahim #include <bits/stdc++.h> using namespace std; string s, t; vector<int> harf_indexs[26]; void cons() { for (int i = 0; i < s.size(); i++) { int m_harf = s[i] - 'a'; harf_indexs[m_harf].push_back(i); } } int bin_search(int m_harf, int k) { int l = 0, r = harf_indexs[m_harf].siz...
// Bismillahirrahmanirrahim #include <bits/stdc++.h> using namespace std; string s, t; vector<int> harf_indexs[26]; void cons() { for (int i = 0; i < s.size(); i++) { int m_harf = s[i] - 'a'; harf_indexs[m_harf].push_back(i); } } int bin_search(int m_harf, int k) { int l = 0, r = harf_indexs[m_harf].siz...
replace
45
46
45
46
9
p02937
C++
Runtime Error
#include <cmath> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using std::vector; template <typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); } template <typename T, typename... Args> void ndarray(vector<T> &vec, int len, Ar...
#include <cmath> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using std::vector; template <typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); } template <typename T, typename... Args> void ndarray(vector<T> &vec, int len, Ar...
replace
46
47
46
47
-6
malloc(): corrupted top size
p02937
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
replace
269
274
269
272
TLE
p02937
C++
Runtime Error
#include <cstdio> #include <cstring> #define maxn 100005 #define ll long long using namespace std; char s[maxn * 2]; int last[maxn * 2][26], v[26]; int main() { scanf("%s", s + 1); int n = strlen(s + 1); for (int i = 1; i <= n; i++) s[i + n] = s[i]; for (int i = 2 * n; i >= 0; i--) { for (int j = 0; j <...
#include <cstdio> #include <cstring> #define maxn 100005 #define ll long long using namespace std; char s[maxn * 2]; int last[maxn * 2][26], v[26]; int main() { scanf("%s", s + 1); int n = strlen(s + 1); for (int i = 1; i <= n; i++) s[i + n] = s[i]; for (int i = 2 * n; i >= 0; i--) { for (int j = 0; j <...
replace
15
16
15
17
0
p02937
C++
Runtime Error
#include <bits/stdc++.h> // g++ -std=c++11 using namespace std; typedef long long ll; #define rep(i, n) for (long long i = 0; i < (n); ++i) #define DIV 1000000007 // 10^9+7 ll memo[30]; ll memo2[100005][30]; int main() { string s, t; cin >> s >> t; string ss = s + s; rep(i, 30) memo[i] = -1; for (ll i ...
#include <bits/stdc++.h> // g++ -std=c++11 using namespace std; typedef long long ll; #define rep(i, n) for (long long i = 0; i < (n); ++i) #define DIV 1000000007 // 10^9+7 ll memo[30]; ll memo2[200005][30]; int main() { string s, t; cin >> s >> t; string ss = s + s; rep(i, 30) memo[i] = -1; for (ll i ...
replace
10
11
10
11
0
p02937
C++
Runtime Error
const int mod1 = 1000000007, mod2 = 998244353; const int mod = mod1; #include <bits/stdc++.h> #include <type_traits> using namespace std; // Andrew He's modular-arithmetic class template <int MOD_> struct modnum { static constexpr int MOD = MOD_; static_assert(MOD_ > 0, "MOD must be positive"); private: using ll...
const int mod1 = 1000000007, mod2 = 998244353; const int mod = mod1; #include <bits/stdc++.h> #include <type_traits> using namespace std; // Andrew He's modular-arithmetic class template <int MOD_> struct modnum { static constexpr int MOD = MOD_; static_assert(MOD_ > 0, "MOD must be positive"); private: using ll...
insert
817
817
817
821
0
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) using namespace std; typedef long long ll; typedef pair<int, int> P; const int inf = 1 << 21; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; const int dx[4] = {-1, 0, 1, 0}; co...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) using namespace std; typedef long long ll; typedef pair<int, int> P; const int inf = 1 << 21; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; const int dx[4] = {-1, 0, 1, 0}; co...
replace
21
23
21
22
TLE
p02937
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; string s, t; int nex[101010][27]; int main() { cin >> s >> t; int s_sz = s.size(); int t_sz = t.size(); s = s + s; for (int i = 0; i < 26; i++) nex[2 * s_sz][i] = 2 * s_sz; for (int i = 2 * s_sz - 1; 0 <= i; i--) { for (int j = 0; j < 26; j++) { ...
#include <bits/stdc++.h> using namespace std; string s, t; int nex[201010][27]; int main() { cin >> s >> t; int s_sz = s.size(); int t_sz = t.size(); s = s + s; for (int i = 0; i < 26; i++) nex[2 * s_sz][i] = 2 * s_sz; for (int i = 2 * s_sz - 1; 0 <= i; i--) { for (int j = 0; j < 26; j++) { ...
replace
5
6
5
6
0
p02937
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { string s, t; cin >> s >> t; int s_len = s.length(); s = s + s; vector<vector<int>> next(s_len, vector<int>('z' - 'a', -1)); ll out = 0; int j = 0; int j0, jstop; for (int i = 0; i < t.l...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { string s, t; cin >> s >> t; int s_len = s.length(); s = s + s; vector<vector<int>> next(s_len, vector<int>('z' - 'a' + 1, -1)); ll out = 0; int j = 0; int j0, jstop; for (int i = 0; i <...
replace
11
12
11
12
0
p02937
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; vector<vector<int>> point(26, vector<int>()); int main() { string s, t; cin >> s >> t; for (int i = 0; i < s.length(); i++) { point[s[i] - 'a'].push_back(i); } for (int i = 0; i < t.length(); i++) { if ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; vector<vector<int>> point(26, vector<int>()); int main() { string s, t; cin >> s >> t; for (int i = 0; i < s.length(); i++) { point[s[i] - 'a'].push_back(i); } for (int i = 0; i < t.length(); i++) { if ...
replace
23
36
23
30
TLE
p02937
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s, t; cin >> s >> t; vector<vector<int>> positions(26); for (int i = 0; i < s.size(); ++i) positions[s[i] - 'a'].push_back(i); ll ans = 0; int tpos = 0; int pointer = -1; while (tpos < t.size()) { if (positi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s, t; cin >> s >> t; vector<vector<int>> positions(26); for (int i = 0; i < s.size(); ++i) positions[s[i] - 'a'].push_back(i); ll ans = 0; int tpos = 0; int pointer = -1; while (tpos < t.size()) { if (positi...
replace
18
29
18
25
TLE
p02937
C++
Runtime Error
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; // template #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, a, b) for (int i = (a); i > (b); i--) #define ALL(v) (v).begin(), (v).end() typedef long long int ll; typedef pair<ll, ll> P; template <class T> inline bool chmax(T &...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; // template #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, a, b) for (int i = (a); i > (b); i--) #define ALL(v) (v).begin(), (v).end() typedef long long int ll; typedef pair<ll, ll> P; template <class T> inline bool chmax(T &...
replace
36
37
36
37
0
5 2 0