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 | #include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define forr(i, p, n) for (ll i = p; i < n; i++)
#define tam 4000
#define offset 8010
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ii> iii;
typedef pair<map<ll, ll>, ll> mi;
ty... | #include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define forr(i, p, n) for (ll i = p; i < n; i++)
#define tam 410000
#define offset 8010
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ii> iii;
typedef pair<map<ll, ll>, ll> mi;
... | replace | 6 | 7 | 6 | 7 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <un... | #include <algorithm>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <un... | replace | 50 | 51 | 50 | 51 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#incl... | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#incl... | insert | 269 | 269 | 269 | 270 | -11 | |
p02936 | Python | Time Limit Exceeded | import sys
sys.setrecursionlimit(10000000)
N, Q = [int(x) for x in input().split()]
# V = [set() for _ in range(N)]
V = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = [int(x) for x in input().split()]
a -= 1
b -= 1
# V[a].add(b)
V[a].append(b)
C = [0] * N
for _ in range(Q):
p, x = [int... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
N, Q = [int(x) for x in input().split()]
# V = [set() for _ in range(N)]
V = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = [int(x) for x in input().split()]
a -= 1
b -= 1
# V[a].add(b)
V[a].append(b)
C = [0] * N
for _ ... | insert | 1 | 1 | 1 | 3 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int n, q;
;
cin >> n >> q;
rep(i,... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int n, q;
;
cin >> n >> q;
rep(i,... | insert | 26 | 26 | 26 | 27 | -11 | |
p02936 | Python | Runtime Error | def solve(N, Q, ABs, PXs):
values = {i: 0 for i in range(Q + 1)}
ans = [-1 for i in range(N + 1)]
vertexes = {}
for a, b in ABs:
vertexes.setdefault(a, []).append(b)
vertexes.setdefault(b, []).append(a)
for p, x in PXs:
values[p] += x
queue = []
queue.append((1, 0))... | def solve(N, Q, ABs, PXs):
values = {i: 0 for i in range(N + 1)}
ans = [-1 for i in range(N + 1)]
vertexes = {}
for a, b in ABs:
vertexes.setdefault(a, []).append(b)
vertexes.setdefault(b, []).append(a)
for p, x in PXs:
values[p] += x
queue = []
queue.append((1, 0))... | replace | 1 | 2 | 1 | 2 | KeyError: 4 | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02936/Python/s276659083.py", line 29, in <module>
print(solve(N, Q, ABs, PXs))
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02936/Python/s276659083.py", line 17, in solve
value = p... |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
using namespace std;
typedef pair<int, int> P;
int main(void) {
int n, q, i, a, b, v[100001], x, p1, x1;
P pp[100001];
scanf("%d %d", &n, &q);
for (i = 0; i < n - 1; i++)
scanf("%d %d", &pp[i].first, &pp[i].second);
sort(pp, p... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
using namespace std;
typedef pair<int, int> P;
int main(void) {
int n, q, i, a, b, v[200001], x, p1, x1;
P pp[200001];
scanf("%d %d", &n, &q);
for (i = 0; i < n - 1; i++)
scanf("%d %d", &pp[i].first, &pp[i].second);
sort(pp, p... | replace | 7 | 9 | 7 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
int n, q, tot;
int head[200005], fa[200005], ans[200005];
struct node {
int to, net;
} e[200005];
void add(int x, int y) {
e[++tot].to = y;
e[tot].net = head[x];
head[x] = tot;
}
int a[200005];
void dfs(int x, int last) {
for (int ... | #include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
int n, q, tot;
int head[200005], fa[200005], ans[200005];
struct node {
int to, net;
} e[400005];
void add(int x, int y) {
e[++tot].to = y;
e[tot].net = head[x];
head[x] = tot;
}
int a[200005];
void dfs(int x, int last) {
for (int ... | replace | 8 | 9 | 8 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <typename tn> void read(tn &a) {
tn x = 0, f = 1;
char c = ' ';
for (; !isdigit(c); c = getchar())
if (c == '-')
f = -1;
for (; isdigit(c); c = getchar())
x = x * 10 + c - '0';
a = x * f;
}
template <typename tn> void print(tn a) {
if (a <... | #include <bits/stdc++.h>
using namespace std;
template <typename tn> void read(tn &a) {
tn x = 0, f = 1;
char c = ' ';
for (; !isdigit(c); c = getchar())
if (c == '-')
f = -1;
for (; isdigit(c); c = getchar())
x = x * 10 + c - '0';
a = x * f;
}
template <typename tn> void print(tn a) {
if (a <... | replace | 19 | 20 | 19 | 20 | 0 | |
p02936 | C++ | Runtime Error |
#include <bits/stdc++.h>
class kin {
public:
inline void open(FILE *, int);
inline void close(void);
inline void scan(void);
inline kin &operator>(char &);
inline kin &operator>(int &);
inline kin &operator>(long long &);
inline kin &operator>(double &);
inline kin &operator>(long double &);
inline ... |
#include <bits/stdc++.h>
class kin {
public:
inline void open(FILE *, int);
inline void close(void);
inline void scan(void);
inline kin &operator>(char &);
inline kin &operator>(int &);
inline kin &operator>(long long &);
inline kin &operator>(double &);
inline kin &operator>(long double &);
inline ... | replace | 88 | 89 | 88 | 89 | -6 | free(): invalid pointer
|
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define m1(x) memset(x, -1, sizeof(x))
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589;
int n, q;
int p[2... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define m1(x) memset(x, -1, sizeof(x))
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589;
int n, q;
int p[2... | replace | 12 | 15 | 12 | 15 | 0 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
int Q;
cin >> N;
cin >> Q;
vector<int> eda(N - 1);
for (int i = 0; i < N - 1; i++) {
int a, b;
cin >> a >> b;
eda.at(b - 1) = a - 1;
}
vector<int> answer(N, 0);
for (int i = 0; i < Q; i++) {
int p;
int ... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
int Q;
cin >> N;
cin >> Q;
vector<int> eda(N);
for (int i = 0; i < N - 1; i++) {
int a, b;
cin >> a >> b;
eda.at(b - 1) = a - 1;
}
vector<int> answer(N, 0);
for (int i = 0; i < Q; i++) {
int p;
int x;
... | replace | 9 | 10 | 9 | 10 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)
|
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <numeric>
#define ll long long
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irr... | #include <bits/stdc++.h>
#include <numeric>
#define ll long long
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irr... | replace | 45 | 48 | 45 | 48 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
typedef pair<ll, ll> P;
#define bit(n) (1LL << (n))
// #define int long ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
typedef pair<ll, ll> P;
#define bit(n) (1LL << (n))
// #define int long ... | replace | 146 | 148 | 146 | 148 | 0 | |
p02936 | C++ | Runtime Error | #ifndef LOCAL
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")
#endif
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#inclu... | #ifndef LOCAL
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")
#endif
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#inclu... | replace | 450 | 451 | 450 | 453 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ULL = unsigned long long;
int x[100000] = {};
int p[100000];
int dp[100000];
int solve2(int i) {
if (dp[i] != -1)
return dp[i];
if (i == 0)
return dp[i] = x[0];
return dp[i] = solve2(p[i]) + x[i];
}
voi... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ULL = unsigned long long;
int x[200000] = {};
int p[200000];
int dp[200000];
int solve2(int i) {
if (dp[i] != -1)
return dp[i];
if (i == 0)
return dp[i] = x[0];
return dp[i] = solve2(p[i]) + x[i];
}
voi... | replace | 6 | 9 | 6 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <math.h>
#include <vector>
std::vector<long> to[20005];
std::vector<long long> ans;
void dfs(int a, int p = -1) {
// printf("a=%d\n",a);
// printf("to[%d].size()=%ld\n",a,to[a].size());
for (int i = 0; i < to[a].size(); i++) {
if (to[a][i] == p) {
continue;
}
ans[t... | #include <iostream>
#include <math.h>
#include <vector>
std::vector<long> to[200005];
std::vector<long long> ans;
void dfs(int a, int p = -1) {
// printf("a=%d\n",a);
// printf("to[%d].size()=%ld\n",a,to[a].size());
for (int i = 0; i < to[a].size(); i++) {
if (to[a][i] == p) {
continue;
}
ans[... | replace | 4 | 5 | 4 | 5 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define FOR(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i, a, b) \
for (long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a, b, c) ... | #include <bits/stdc++.h>
#define FOR(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i, a, b) \
for (long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a, b, c) ... | replace | 35 | 36 | 35 | 36 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 20;
int n, q, a, b, num[MAXN], ans[MAXN];
vector<int> adj[MAXN];
bool vis[MAXN];
void dfs(int v, int sm) {
vis[v] = true;
sm += num[v];
ans[v] = sm;
for (int u : adj[v])
if (!vis[u])
dfs(u, sm);
}
int main() {
ios::sync_w... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 * 1000 + 20;
int n, q, a, b, num[MAXN], ans[MAXN];
vector<int> adj[MAXN];
bool vis[MAXN];
void dfs(int v, int sm) {
vis[v] = true;
sm += num[v];
ans[v] = sm;
for (int u : adj[v])
if (!vis[u])
dfs(u, sm);
}
int main() {
ios::sync_w... | replace | 3 | 4 | 3 | 4 | 0 | |
p02936 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
vector<bool> seen(200005, false);
vector<int> counter;
void dfs(vector<vector<int>> vec, int v) {
seen.at(v) = true;
for (int i = 0; i < vec.at(v).size(); i++) {
if (seen.at(vec.at(v).at(i))) {
continue;
}
counter[vec[v][i]] += counter[v];
dfs(vec... | #include <bits/stdc++.h>
using namespace std;
vector<bool> seen(200005, false);
vector<int> counter;
void dfs(vector<vector<int>> &vec, int v) {
seen.at(v) = true;
for (int i = 0; i < vec.at(v).size(); i++) {
if (seen.at(vec.at(v).at(i))) {
continue;
}
counter[vec[v][i]] += counter[v];
dfs(ve... | replace | 5 | 6 | 5 | 6 | TLE | |
p02936 | C++ | Runtime Error | //
// main.cpp
// ABC
//
// Created by Amarsanaa Davaasuren on 2019/08/31.
// Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
class UnionFind {
public:
vector<int> Parent;
UnionFind(int... | //
// main.cpp
// ABC
//
// Created by Amarsanaa Davaasuren on 2019/08/31.
// Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
class UnionFind {
public:
vector<int> Parent;
UnionFind(int... | replace | 54 | 55 | 54 | 55 | -11 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> res(100001);
void dfs(int cp, vector<vector<int>> &v, vector<int> &myPoint, int sump) {
int nsump = myPoint[cp] + sump;
... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> res(1000001);
void dfs(int cp, vector<vector<int>> &v, vector<int> &myPoint, int sump) {
int nsump = myPoint[cp] + sump;
... | replace | 12 | 13 | 12 | 13 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep_down(i, n) for (int i = n - 1;... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep_down(i, n) for (int i = n - 1;... | replace | 20 | 23 | 20 | 23 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int, int>
#define ll long long
#define el '\n'
using namespace std;
const int N = 2e5 + 10;
int ans[N];
vector<int> adl[N];
int n, q;
int lazy[N];
void dfs(int node, int p)... | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int, int>
#define ll long long
#define el '\n'
using namespace std;
const int N = 2e5 + 10;
int ans[N];
vector<int> adl[N];
int n, q;
int lazy[N];
void dfs(int node, int p)... | replace | 37 | 38 | 37 | 38 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional> // std::function<void(int)>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using n... | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional> // std::function<void(int)>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using n... | replace | 24 | 25 | 24 | 25 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const double PI = acos(-1.0);
const int N =... | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const double PI = acos(-1.0);
const int N =... | replace | 32 | 36 | 32 | 36 | -11 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,... | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,... | replace | 20 | 23 | 20 | 23 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout << (#x) << "=" << (x) << endl
#define mset(d, val) memset(d, val, sizeof(d))
#define setp(x) cout << fixed << setprecision(x)
#define forn(i, a, ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout << (#x) << "=" << (x) << endl
#define mset(d, val) memset(d, val, sizeof(d))
#define setp(x) cout << fixed << setprecision(x)
#define forn(i, a, ... | replace | 29 | 30 | 29 | 30 | 0 | |
p02936 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
using namespace std;
void dfs(ll int u, ll int p, ll int c, vector<vector<ll int>> adj,
vector<ll int> pcost, vector<ll int> &cost, ll int n) {
cost[u] = pcost[u] + c;
for (auto v : adj[u]) {
if (v == p)
continue;
dfs(v, u, cost[u], adj, pcost, c... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
void dfs(ll int u, ll int p, ll int c, vector<vector<ll int>> &adj,
vector<ll int> &pcost, vector<ll int> &cost, ll int n) {
cost[u] = pcost[u] + c;
for (auto v : adj[u]) {
if (v == p)
continue;
dfs(v, u, cost[u], adj, pcost,... | replace | 3 | 5 | 3 | 5 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<ll>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(), (x).end()
#define print(a) ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<ll>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(), (x).end()
#define print(a) ... | replace | 22 | 23 | 22 | 23 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> ... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> ... | replace | 20 | 24 | 20 | 24 | 0 | |
p02936 | C++ | Runtime Error | /**
* created: 11.05.2020 23:51:19
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1... | /**
* created: 11.05.2020 23:51:19
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1... | insert | 37 | 37 | 37 | 38 | -11 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int n, q;
cin >> n >> q;
for (int i = 0; i < n; i++) {
int a, b;
... | #include <iostream>
#include <vector>
using namespace std;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int n, q;
cin >> n >> q;
for (int i = 0; i < n - 1; i++) {
int a, ... | replace | 18 | 19 | 18 | 19 | 0 | |
p02936 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int n, q;
int par[200000];
int ran[200000];
vector<int> ch[200000];
long long dp[200000];
int y[200000];
bool used[200000];
void dfs(int now, int mow) {
... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int n, q;
int par[200000];
int ran[200000];
vector<int> ch[200000];
long long dp[200000];
int y[200000];
bool used[200000];
void dfs(int now, int mow) {
... | replace | 21 | 22 | 21 | 22 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const int INF = 1001001001;
vector<int> tos[20005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : tos[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
i... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const int INF = 1001001001;
vector<int> tos[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : tos[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
... | replace | 7 | 8 | 7 | 8 | 0 | |
p02936 | C++ | Time Limit Exceeded | #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 | 35 | 35 | 35 | 37 | TLE | |
p02936 | Python | Time Limit Exceeded | import sys
sys.setrecursionlimit(3 * 10**5)
def main() -> None:
def dfs(v, par, cnt):
ans[v] = cnt + vs[v]
for c in edges[v]:
if c == par:
continue
dfs(c, v, ans[v])
N, Q = map(int, input().split())
edges = [[] for _ in range(N)]
for _ in range... | import sys
sys.setrecursionlimit(3 * 10**5)
input = sys.stdin.buffer.readline
def main() -> None:
def dfs(v, par, cnt):
ans[v] = cnt + vs[v]
for c in edges[v]:
if c == par:
continue
dfs(c, v, ans[v])
N, Q = map(int, input().split())
edges = [[] for... | insert | 3 | 3 | 3 | 4 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
// #define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int, int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define OREP(i, n) for (i... | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
// #define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int, int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define OREP(i, n) for (i... | replace | 20 | 21 | 20 | 21 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define l_ength size
const int inf = (1 << 30);
const int mod = 1000000007;
using ll = long long;
using namespace std;
vector<int> graph[250000];
bool besucht[250000];
ll query[250000];
ll res[250000];
void dfs(int p, ll sum) {
// if( besucht[p] ) return;
besucht[p] = true;
res[p] = sum... | #include <bits/stdc++.h>
#define l_ength size
const int inf = (1 << 30);
const int mod = 1000000007;
using ll = long long;
using namespace std;
vector<int> graph[250000];
bool besucht[250000];
ll query[250000];
ll res[250000];
void dfs(int p, ll sum) {
// if( besucht[p] ) return;
besucht[p] = true;
res[p] = sum... | delete | 30 | 31 | 30 | 30 | -11 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const double... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const double... | replace | 20 | 21 | 20 | 21 | 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;
vector<vector<int>> v(1000000);
vector<int> ans(1000000, 0);
void rec(int i, int j = -1) {
for (int k : v[i]) {
if (k == j)
continue;
ans[k] += ans[i];
rec(k, j);
}
}
void solve() ... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
vector<vector<int>> v(1000000);
vector<int> ans(1000000, 0);
void rec(int i, int j = -1) {
for (int k : v[i]) {
if (k == j)
continue;
ans[k] += ans[i];
rec(k, i);
}
}
void solve() ... | replace | 12 | 13 | 12 | 13 | -11 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rev(i, n) for (int i = n; i >= 0; i--)
#define Rep(i, m, n) for (int i = m; i < n; i++)
#define repeatrev(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long lon... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rev(i, n) for (int i = n; i >= 0; i--)
#define Rep(i, m, n) for (int i = m; i < n; i++)
#define repeatrev(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long lon... | insert | 48 | 48 | 48 | 49 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p02936 | C++ | Runtime Error | using namespace std;
#include <bits/stdc++.h>
#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) \
for (__typeof((c).begin()) i... | using namespace std;
#include <bits/stdc++.h>
#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) \
for (__typeof((c).begin()) i... | replace | 9 | 10 | 9 | 10 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", std... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", std... | replace | 36 | 40 | 36 | 40 | 0 | |
p02936 | C++ | Runtime Error | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
#include <bits/stdc++.h>
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define ppb pop_back
using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typ... | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
#include <bits/stdc++.h>
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define ppb pop_back
using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typ... | replace | 16 | 18 | 16 | 18 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
vector<int> to[100005];
int cnt[100005], ans[100005];
void dfs(int x, int fa, int sum) {
// cout<<sum<<' '<<x<<endl;
sum += cnt[x];
ans[x] = sum;
if (to[x].... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
vector<int> to[200005];
int cnt[200005], ans[200005];
void dfs(int x, int fa, int sum) {
// cout<<sum<<' '<<x<<endl;
sum += cnt[x];
ans[x] = sum;
if (to[x].... | replace | 10 | 12 | 10 | 12 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> g[20000 + 5];
int a[20000 + 5];
int f(int u, int p, int sum) {
a[u] += sum;
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i];
if (v == p) {
continue;
}
f(v, u, a[u]);
}
}
int main() {
int n, q;
cin >> n >> q;
for (in... | #include <bits/stdc++.h>
using namespace std;
vector<int> g[200000 + 1];
int a[200000 + 1];
int f(int u, int p, int sum) {
a[u] += sum;
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i];
if (v == p) {
continue;
}
f(v, u, a[u]);
}
}
int main() {
int n, q;
cin >> n >> q;
for (... | replace | 4 | 6 | 4 | 6 | 0 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define lli long long int
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, q, i, j;
cin >> n >> q;
vector<vector<int>> adj;
adj.resize(n);
lli a, b;
for (i = 0; i < n - 1; i++) {
cin >> a >> b;
adj[a - 1].pus... | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define lli long long int
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, q, i, j;
cin >> n >> q;
vector<vector<int>> adj;
adj.resize(n);
lli a, b;
for (i = 0; i < n - 1; i++) {
cin >> a >> b;
adj[a - 1].pus... | insert | 25 | 25 | 25 | 26 | -11 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
const int SIZE = 100024;
int N, Q;
int p[SIZE];
long long cnt[SIZE];
long long sum[SIZE];
long long Solve(int t) {
if (t == 1)
return cnt[1];
if (sum[t] < 0) {
sum[t] = Solv... | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
const int SIZE = 200024;
int N, Q;
int p[SIZE];
long long cnt[SIZE];
long long sum[SIZE];
long long Solve(int t) {
if (t == 1)
return cnt[1];
if (sum[t] < 0) {
sum[t] = Solv... | replace | 9 | 10 | 9 | 10 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define hell 1000000007
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define ios ... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define hell 1000000007
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define ios ... | replace | 17 | 19 | 17 | 19 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);
const int MAX_N = (int)(1e5 + 5);
int n, q;
vector<int> graph[MAX_N];
ll lazy[MAX_N];
ll actual[MAX_N];
int main(void) {
// Here your code !
scanf("%d %d", &n, &q);
for (in... | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);
const int MAX_N = (int)(2e5 + 5);
int n, q;
vector<int> graph[MAX_N];
ll lazy[MAX_N];
ll actual[MAX_N];
int main(void) {
// Here your code !
scanf("%d %d", &n, &q);
for (in... | replace | 8 | 9 | 8 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> graph[100000];
vector<int> counter(100000, 0);
vector<int> ans(100000, 0);
void dfs(int n, int c) {
ans[n] = c + counter[n];
for (auto t : graph[n]) {
dfs(t, ans[n]);
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, Q;
... | #include <bits/stdc++.h>
using namespace std;
vector<int> graph[200000];
vector<int> counter(200000, 0);
vector<int> ans(200000, 0);
void dfs(int n, int c) {
ans[n] = c + counter[n];
for (auto t : graph[n]) {
dfs(t, ans[n]);
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, Q;
... | replace | 4 | 7 | 4 | 7 | 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) < (n); (i)++)
ll N, Q;
vector<ll> G[200000];
vector<ll> result(20000, 0);
vector<bool> F(200000, false);
void dfs(ll v, ll p = -1) {
if (!F[v]) {
F[v] = true;
if (p != -1) {
result[v] += result[p]... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
ll N, Q;
vector<ll> G[200000];
vector<ll> result(200000, 0);
vector<bool> F(200000, false);
void dfs(ll v, ll p = -1) {
if (!F[v]) {
F[v] = true;
if (p != -1) {
result[v] += result[p... | replace | 7 | 8 | 7 | 8 | 0 | |
p02936 | C++ | Runtime Error | #pragma region
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef ... | #pragma region
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef ... | replace | 85 | 87 | 85 | 87 | 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;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
// 典型問題、木を直線化する
int main() {
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
// 典型問題、木を直線化する
int main() {
... | insert | 29 | 29 | 29 | 30 | -11 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, // less_equal
tree_order_statistics_node_update>... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, // less_equal
tree_order_statistics_node_update>... | replace | 10 | 11 | 10 | 11 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define M (1000000007)
#define N (100010)
int n, Q, ans[N];
vector<int> G[N], q[N];
void dfs(int x, int fa, int sum) {
for (int i = 0; i < q[x].size(); i++)
sum += q[x][i];
ans[x] = sum;
for (int i = 0; i < G[x].size(); i++) {
int y = G[x... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define M (1000000007)
#define N (200010)
int n, Q, ans[N];
vector<int> G[N], q[N];
void dfs(int x, int fa, int sum) {
for (int i = 0; i < q[x].size(); i++)
sum += q[x][i];
ans[x] = sum;
for (int i = 0; i < G[x].size(); i++) {
int y = G[x... | replace | 4 | 5 | 4 | 5 | 0 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 10;
const int MAXQ = 1e5 + 10;
int n, q;
int a[MAXN], b[MAXN], p[MAXQ], x[MAXQ];
bool visited[MAXN];
ll cnt[MAXN];
vector<int> graph[MAXN];
void dfs(int cur) {
visited[cur] = true;
for (int i = 0; i < graph[cu... | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 10;
const int MAXQ = 2e5 + 10;
int n, q;
int a[MAXN], b[MAXN], p[MAXQ], x[MAXQ];
bool visited[MAXN];
ll cnt[MAXN];
vector<int> graph[MAXN];
void dfs(int cur) {
visited[cur] = true;
for (int i = 0; i < graph[cu... | replace | 5 | 7 | 5 | 7 | 0 | |
p02936 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long int ll;
#define EPS (1e-7)
#define INF ... | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long int ll;
#define EPS (1e-7)
#define INF ... | delete | 66 | 67 | 66 | 66 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
Graph graph(20010);
vector<int> score(20010, 0);
void dfs(int cur, int prev) {
score[cur] += score[prev];
// 各頂点にスコアを加算する
for (auto next : graph.at(cur)) {
if (next == prev)
continue;
dfs(next, cur);
}
}
int main(... | #include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
Graph graph(200100);
vector<int> score(200100, 0);
void dfs(int cur, int prev) {
score[cur] += score[prev];
// 各頂点にスコアを加算する
for (auto next : graph.at(cur)) {
if (next == prev)
continue;
dfs(next, cur);
}
}
int mai... | replace | 5 | 7 | 5 | 7 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i))
using ll = long long;
using namespace std;
int N, Q;
ll tr[101010];
vector<int> g[101010];
void solve(int v, int p, ll sum) {
for (int u : g[v]) {
if (u == p)
continue;
solve(u, v, sum + tr[v]);
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i))
using ll = long long;
using namespace std;
int N, Q;
ll tr[301010];
vector<int> g[301010];
void solve(int v, int p, ll sum) {
for (int u : g[v]) {
if (u == p)
continue;
solve(u, v, sum + tr[v]);
... | replace | 7 | 9 | 7 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
co... | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
co... | replace | 14 | 17 | 14 | 17 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std::chrono;
using namespace std;
using namespace __gnu_pbds;
#define st first
#define nd second
void debug_out() { cerr << endl; }
template <class T> ostream &prnt(ostream &out, T v)... | #include <bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std::chrono;
using namespace std;
using namespace __gnu_pbds;
#define st first
#define nd second
void debug_out() { cerr << endl; }
template <class T> ostream &prnt(ostream &out, T v)... | replace | 42 | 43 | 42 | 43 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクト... | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクト... | insert | 47 | 47 | 47 | 48 | -11 | |
p02936 | C++ | Runtime Error | /*author : Yashvardhan
Sunday, August 18, 2019
5:58 PM
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define a... | /*author : Yashvardhan
Sunday, August 18, 2019
5:58 PM
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define a... | replace | 66 | 67 | 66 | 67 | 0 |
108
|
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
vector<int> G[200005];
ll val[20005];
void dfs(int p, int u) {
for (auto v : G[u]) {
if (v != p) {
val[v] += val[u];
dfs(u, v);
}
}
}
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
vector<int> G[200005];
ll val[200005];
void dfs(int p, int u) {
for (auto v : G[u]) {
if (v != p) {
val[v] += val[u];
dfs(u, v);
}
}
}
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
... | replace | 6 | 7 | 6 | 7 | 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;
vector<int> to[20005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int n, q;
cin >>... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int n, q;
cin >... | replace | 4 | 5 | 4 | 5 | 0 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <vector>
struct youso {
int parent = -1;
int count = 0;
std::vector<int> edge;
// std::vector<int> child;
};
youso y[100000];
void maketree(int parent, int ima) {
y[ima].parent = parent;
for (int i = 0; i < y[ima].edge.size(); i++) {
if (parent == y[ima].edge[i])
cont... | #include <iostream>
#include <vector>
struct youso {
int parent = -1;
int count = 0;
std::vector<int> edge;
// std::vector<int> child;
};
youso y[200000];
void maketree(int parent, int ima) {
y[ima].parent = parent;
for (int i = 0; i < y[ima].edge.size(); i++) {
if (parent == y[ima].edge[i])
cont... | replace | 9 | 10 | 9 | 10 | 0 | |
p02936 | C++ | Time Limit Exceeded | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
int N, Q;
int main() {
cin >> N >> Q;
vector<vector<int>> e(N);
vector<int> par(N, -1); // 親
for (int i = 0; i < N - 1; i++) {
int from, to;
cin >> from >> to;
from--;
to--;
e[from].push_back(to);
e[to].push_b... | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
int N, Q;
int main() {
cin >> N >> Q;
vector<vector<int>> e(N);
vector<int> par(N, -1); // 親
for (int i = 0; i < N - 1; i++) {
int from, to;
cin >> from >> to;
from--;
to--;
e[from].push_back(to);
e[to].push_b... | replace | 29 | 37 | 29 | 35 | TLE | |
p02936 | C++ | Time Limit Exceeded | #include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, lli... | #include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, lli... | replace | 162 | 163 | 162 | 163 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define vs vector<string>
#define pii pair<int, int>
#define pis pair<int, string>
#define psi pair<string, int>
#define pll pair<ll, ll>
#defi... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define vs vector<string>
#define pii pair<int, int>
#define pis pair<int, string>
#define psi pair<string, int>
#define pll pair<ll, ll>
#defi... | replace | 50 | 51 | 50 | 51 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
struct edge {
int to, id;
};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
using graph = vector<vector<ll>>;
int jikan;
bool seen[100010];
ll sum[100010];
ll ans[100010];
void dfs(const graph ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
struct edge {
int to, id;
};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
using graph = vector<vector<ll>>;
int jikan;
bool seen[200010];
ll sum[200010];
ll ans[200010];
void dfs(const graph ... | replace | 13 | 16 | 13 | 16 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<vector<in... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<vector<in... | replace | 172 | 173 | 172 | 173 | -11 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 100005;
vector<int> v[N];
ll ans[N];
void dfs(int x, ll add, int p) {
if (x)
ans[x] += add;
for (int i = 0; i < v[x].size(); i++)
if (v[x][i] != p)
dfs(v[x][i], ans[x], x);
}
int main() {
int n, q;
cin >> n >> q;
fo... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200005;
vector<int> v[N];
ll ans[N];
void dfs(int x, ll add, int p) {
if (x)
ans[x] += add;
for (int i = 0; i < v[x].size(); i++)
if (v[x][i] != p)
dfs(v[x][i], ans[x], x);
}
int main() {
int n, q;
cin >> n >> q;
fo... | replace | 3 | 4 | 3 | 4 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define N 200123
#define mod 1000000007
long long weight[N];
vector<int> adj[N];
void dfs(int u, int par) {
weight[u] += weight[par];
for (int v : adj[u])
if (v != par)
dfs(v, u);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
#ifndef ONLINE_J... | #include <bits/stdc++.h>
using namespace std;
#define N 200123
#define mod 1000000007
long long weight[N];
vector<int> adj[N];
void dfs(int u, int par) {
weight[u] += weight[par];
for (int v : adj[u])
if (v != par)
dfs(v, u);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, q, a;
... | delete | 19 | 23 | 19 | 19 | -11 | |
p02936 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
vector<bool> seen(200000, false);
void dfs(vector<vector<int>> con, int num, vector<int> &ope) {
seen.at(num) = true;
for (int con_ele : con.at(num)) {
if (seen.at(con_ele) == false) {
ope.at(con_ele) += ope.at(num);
dfs(con, con_ele, ope);
}
}
}... | #include "bits/stdc++.h"
using namespace std;
vector<bool> seen(200000, false);
void dfs(vector<vector<int>> &con, int num, vector<int> &ope) {
seen.at(num) = true;
for (int con_ele : con.at(num)) {
if (seen.at(con_ele) == false) {
ope.at(con_ele) += ope.at(num);
dfs(con, con_ele, ope);
}
}
... | replace | 5 | 6 | 5 | 6 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll, int> P;
typedef set<int> S;
int n;
vector<int> v[20001... | #include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll, int> P;
typedef set<int> S;
int n;
vector<int> v[20001... | replace | 12 | 13 | 12 | 13 | 0 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <string.h>
using namespace std;
const int N = 1e5 + 10;
typedef long long LL;
LL head[N], cnt = 0, sum[N], pre_sum[N];
struct edge {
LL to, next;
} p[N * 2];
void add(LL x, LL y) {
p[++cnt].to = y;
p[cnt].next = head[x];
head[x] = cnt;
}
void spread(LL x) {
for (LL i = head[x]; i... | #include <iostream>
#include <string.h>
using namespace std;
const int N = 2e5 + 10;
typedef long long LL;
LL head[N], cnt = 0, sum[N], pre_sum[N];
struct edge {
LL to, next;
} p[N * 2];
void add(LL x, LL y) {
p[++cnt].to = y;
p[cnt].next = head[x];
head[x] = cnt;
}
void spread(LL x) {
for (LL i = head[x]; i... | replace | 4 | 5 | 4 | 5 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MAX = 1e5 + 5;
vector<LL> GRAPH[MAX];
LL a[MAX];
bool vis[MAX];
LL b[MAX];
void DFS(LL x) {
if (vis[x])
return;
vis[x] = true;
for (int i = 0; i < GRAPH[x].size(); i++) {
if (!vis[GRAPH[x][i]]) {
b[GRAPH[x][i]] += b[x];
... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MAX = 2e5 + 5;
vector<LL> GRAPH[MAX];
LL a[MAX];
bool vis[MAX];
LL b[MAX];
void DFS(LL x) {
if (vis[x])
return;
vis[x] = true;
for (int i = 0; i < GRAPH[x].size(); i++) {
if (!vis[GRAPH[x][i]]) {
b[GRAPH[x][i]] += b[x];
... | replace | 3 | 4 | 3 | 4 | 0 | |
p02936 | C++ | Runtime Error | // includes
#include "bits/stdc++.h"
using namespace std;
// macros
#define ll long long
#define MOD 998244353 // 1000000007 // 100000000 //
#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define sz(x) ((ll)(x).size())
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n;... | // includes
#include "bits/stdc++.h"
using namespace std;
// macros
#define ll long long
#define MOD 998244353 // 1000000007 // 100000000 //
#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define sz(x) ((ll)(x).size())
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n;... | replace | 142 | 144 | 142 | 144 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define REP(i, b, e) for (int i = (b); i < (e); ++i)
#define rep(i, e) for (int i = 0; i < (e); ++i)
int dd[100010] = {};
vector<vector<int>> d(100010);
int ans[100010] = {};
int n, q, a, b, p, x;
int tmp;
void dfs(int x, int tmp) {
ans[x] += tmp;
for (auto next : d[x... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, b, e) for (int i = (b); i < (e); ++i)
#define rep(i, e) for (int i = 0; i < (e); ++i)
int dd[200010] = {};
vector<vector<int>> d(200010);
int ans[200010] = {};
int n, q, a, b, p, x;
int tmp;
void dfs(int x, int tmp) {
ans[x] += tmp;
for (auto next : d[x... | replace | 5 | 8 | 5 | 8 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
// stoi(s) : string→int stoll(s) :string→longlong int→string to_string(i)
const double PI = acos(-1.0);
// 小数点の表し方 cout << fixed << setprecision(5);
const int M... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
// stoi(s) : string→int stoll(s) :string→longlong int→string to_string(i)
const double PI = acos(-1.0);
// 小数点の表し方 cout << fixed << setprecision(5);
const int M... | replace | 9 | 10 | 9 | 10 | 0 | |
p02936 | C++ | Runtime Error | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;
vector<vector<int>> G(404040);
vector<int> score(404040, ... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;
vector<vector<int>> G(404040);
vector<int> score(404040, ... | insert | 22 | 22 | 22 | 23 | 0 | |
p02936 | C++ | Time Limit Exceeded | #include <assert.h>
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
i64 n, q;
cin >> n >> q;
vector<i64> edge[n];
for (i64 i = 0; i < n - 1; i++) {
i64 a, b;
cin >> a >> b;
a--;
b--;
edge[a].push_back(b);
edge[b].push_back(a);
}
vector<i64> ans(n);
... | #include <assert.h>
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
i64 n, q;
cin >> n >> q;
vector<i64> edge[n];
for (i64 i = 0; i < n - 1; i++) {
i64 a, b;
cin >> a >> b;
a--;
b--;
edge[a].push_back(b);
edge[b].push_back(a);
}
vector<i64> ans(n);
... | insert | 35 | 35 | 35 | 36 | TLE | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
// ki
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == v)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int N, Q;
cin >> N >> Q;
... | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
// ki
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int u : to[v]) {
if (u == p)
continue;
ans[u] += ans[v];
dfs(u, v);
}
}
int main() {
int N, Q;
cin >> N >> Q;
... | replace | 12 | 13 | 12 | 13 | -11 | |
p02936 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, Q;
cin >> N >> Q;
int a, b;
vector<vector<int>> AB(N + 5, vector<int>(N + 5));
for (int i = 0; i < N - 1; i++) {
cin >> a >> b;
AB[a].push_back(b);
AB[b].push_back(a);
}
int p, x;
int Score[200005] = {};
for (i... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, Q;
cin >> N >> Q;
int a, b;
vector<vector<int>> AB(N + 5, vector<int>());
for (int i = 0; i < N - 1; i++) {
cin >> a >> b;
AB[a].push_back(b);
AB[b].push_back(a);
}
int p, x;
int Score[200005] = {};
for (int j ... | replace | 8 | 9 | 8 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <cstring>
#include <iostream>
#include <vector>
using namespace std;
const int maxn = 200000;
int n, m, p[maxn], add[maxn], a, b;
vector<int> v[maxn];
void dfs(int node, int pa) {
for (int i : v[node]) {
if (i != pa) {
add[i] += add[node];
dfs(i, node);
}
}
}
int main() {
cin >> n ... | #include <cstring>
#include <iostream>
#include <vector>
using namespace std;
const int maxn = 200005;
int n, m, p[maxn], add[maxn], a, b;
vector<int> v[maxn];
void dfs(int node, int pa) {
for (int i : v[node]) {
if (i != pa) {
add[i] += add[node];
dfs(i, node);
}
}
}
int main() {
cin >> n ... | replace | 5 | 6 | 5 | 6 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <stdio.h>
// 入力受付用の変数
#define BUF 200002
char str[BUF];
// 入力された値
#define LIM_A 100001
int N, Q;
int a[LIM_A];
int b[LIM_A];
int p[LIM_A];
int x[LIM_A];
typedef struct {
int root;
int count;
long ans;
} Tree;
Tree v[LIM_A];
void receive_input() {
fgets(str, sizeof(str), stdin);... | #include <algorithm>
#include <stdio.h>
// 入力受付用の変数
#define BUF 200002
char str[BUF];
// 入力された値
#define LIM_A 200002
int N, Q;
int a[LIM_A];
int b[LIM_A];
int p[LIM_A];
int x[LIM_A];
typedef struct {
int root;
int count;
long ans;
} Tree;
Tree v[LIM_A];
void receive_input() {
fgets(str, sizeof(str), stdin);... | replace | 8 | 9 | 8 | 9 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> v[100010];
int n, i, j, x, y, a[100001], q, nod, val;
bool viz[100001];
void df(int nod) {
int i;
viz[nod] = 1;
for (i = 0; i < v[nod].size(); i++)
if (!viz[v[nod][i]]) {
a[v[nod][i]] += a[nod];
df(v[nod][i]);
}
}
int main() {
cin >> ... | #include <bits/stdc++.h>
using namespace std;
vector<int> v[200010];
int n, i, j, x, y, a[200001], q, nod, val;
bool viz[200001];
void df(int nod) {
int i;
viz[nod] = 1;
for (i = 0; i < v[nod].size(); i++)
if (!viz[v[nod][i]]) {
a[v[nod][i]] += a[nod];
df(v[nod][i]);
}
}
int main() {
cin >> ... | replace | 2 | 5 | 2 | 5 | 0 | |
p02936 | 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>;
void rec(int parent, int self, int cntsum, vector<set<int>> connect,
vector<int> cntarr, vector<int> &ans) {
connect[self].erase(parent);
for (auto itr = connect[self... | #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>;
void rec(int parent, int self, int cntsum, vector<set<int>> &connect,
vector<int> &cntarr, vector<int> &ans) {
connect[self].erase(parent);
for (auto itr = connect[se... | replace | 6 | 8 | 6 | 8 | TLE | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 100010, M = 2 * N;
int n, m;
int h[N], e[M], ne[M], idx;
int w[N];
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
void dfs(int u, int fa, int s) {
... | #include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 200010, M = 2 * N;
int n, m;
int h[N], e[M], ne[M], idx;
int w[N];
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
void dfs(int u, int fa, int s) {
... | replace | 10 | 11 | 10 | 11 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> g[100001];
ll score[100001];
void dfs(int v, int pa, ll sum) {
score[v] += sum;
for (int i = 0; i < g[v].size(); i++) {
if (g[v][i] != pa) {
dfs(g[v][i], v, score[v]);
}
... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> g[200001];
ll score[200001];
void dfs(int v, int pa, ll sum) {
score[v] += sum;
for (int i = 0; i < g[v].size(); i++) {
if (g[v][i] != pa) {
dfs(g[v][i], v, score[v]);
}
... | replace | 6 | 8 | 6 | 8 | 0 | |
p02936 | C++ | Runtime Error | /* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
// algorithm library
#include <algorithm>
#include <cmath>
#include <cstring>
#include <numeric>
#include <random>
// container library
#include <array>
#include <bitset>
... | /* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
// algorithm library
#include <algorithm>
#include <cmath>
#include <cstring>
#include <numeric>
#include <random>
// container library
#include <array>
#include <bitset>
... | replace | 41 | 42 | 41 | 42 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int n, q, a, b, dfn[maxn], in[maxn], out[maxn], del[maxn], sum, ans[maxn];
vector<int> to[maxn];
void dfs(int x, int f) {
dfn[++dfn[0]] = x;
in[x] = dfn[0];
for (int i = 0; i < to[x].size(); ++i) {
int t = to[x][i];
if (t == f)
... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int n, q, a, b, dfn[maxn], in[maxn], out[maxn], del[maxn], sum, ans[maxn];
vector<int> to[maxn];
void dfs(int x, int f) {
dfn[++dfn[0]] = x;
in[x] = dfn[0];
for (int i = 0; i < to[x].size(); ++i) {
int t = to[x][i];
if (t == f)
... | replace | 3 | 4 | 3 | 4 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, q;... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, q;... | replace | 16 | 21 | 16 | 23 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define mp make_pair
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
int mod = 1e9 + 7;
mt19... | #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define mp make_pair
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
int mod = 1e9 + 7;
mt19... | replace | 30 | 31 | 30 | 31 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
int label[200005];
int smd[200005];
int n, q;
void dfs_out(int node, int last, int s) {
smd[node] = label[node] + s;
for (int i = 0; i < adj[node].size(); i++) {
int other = adj[node][i];
if (other == last)
continue;
dfs_ou... | #include <bits/stdc++.h>
using namespace std;
vector<int> adj[200005];
int label[200005];
int smd[200005];
int n, q;
void dfs_out(int node, int last, int s) {
smd[node] = label[node] + s;
for (int i = 0; i < adj[node].size(); i++) {
int other = adj[node][i];
if (other == last)
continue;
dfs_ou... | replace | 3 | 4 | 3 | 4 | 0 | |
p02936 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
int N;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int e : to[v]) {
if (p == e) {
continue;
}
ans[e] += ans[v];
dfs(e, v);
}
}
int main() {
int N, Q;
cin >> N >> Q;
for (int n = 0; n < N - 1; ++n) {
int a,... | #include "bits/stdc++.h"
using namespace std;
int N;
vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
for (int e : to[v]) {
if (p == e) {
continue;
}
ans[e] += ans[v];
dfs(e, v);
}
}
int main() {
int N, Q;
cin >> N >> Q;
for (int n = 0; n < N - 1; ++n) {
int a,... | replace | 27 | 28 | 27 | 28 | 0 | |
p02936 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int n, q;
vector<int> adjList[112123];
long long v[112123];
bool seen[112123];
void dfs(int x) {
seen[x] = true;
for (int y : adjList[x]) {
if (seen[y])
continue;
v[y] += v[x];
dfs(y);
}
}
int main() {
cin >> n >> q;
for (int i = 1; i < n; i+... | #include <bits/stdc++.h>
using namespace std;
int n, q;
vector<int> adjList[212123];
long long v[212123];
bool seen[212123];
void dfs(int x) {
seen[x] = true;
for (int y : adjList[x]) {
if (seen[y])
continue;
v[y] += v[x];
dfs(y);
}
}
int main() {
cin >> n >> q;
for (int i = 1; i < n; i+... | replace | 5 | 8 | 5 | 8 | 0 | |
p02936 | C++ | Runtime Error | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
// typedef ... | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
// typedef ... | replace | 29 | 30 | 29 | 30 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.