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
p02467
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; class Prime { private: vector<long long> divisor; public: Prime(long long n) { for (long long i = 0; i < n; ++i) divisor.emplace_back(i); for (long long i = 2; i <= n / i; ++i) if (divisor[i] == i) { for (long long j = i * i; j < n; j += i...
#include <bits/stdc++.h> using namespace std; class Prime { private: vector<long long> divisor; public: Prime(long long n) { for (long long i = 0; i < n; ++i) divisor.emplace_back(i); for (long long i = 2; i <= n / i; ++i) if (divisor[i] == i) { for (long long j = i * i; j < n; j += i...
replace
77
78
77
78
MLE
p02467
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int isprime(int n) { if (n < 2) return 0; else for (int i = 2; i * i <= n; i++) { if (n % i == 0) return 0; } return 1; } // dfs, void solve(int n) { int sum = 0; cout << n << ":"; whil...
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int isprime(int n) { if (n < 2) return 0; else for (int i = 2; i * i <= n; i++) { if (n % i == 0) return 0; } return 1; } // dfs, void solve(int n) { if (isprime(n)) { cout << n << ": "...
insert
16
16
16
20
TLE
p02467
C++
Time Limit Exceeded
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, i; cin >> n; cout << n << ":"; for (i = 2; n != 1; i++) { if (i > n / 2) { cout << " " << n; n = 1; continue; } while (n % i == 0) { cout << " " << i; n /= i; } } ...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, i; cin >> n; cout << n << ":"; for (i = 2; n != 1; i++) { if (i > sqrt(n)) { cout << " " << n; n = 1; continue; } while (n % i == 0) { cout << " " << i; n /= i; } }...
replace
13
14
13
14
TLE
p02467
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; // 素数判定(素数ならtrue) bool Prime(int prime) { // 偶数除く if (prime == 2) { return true; } else if (prime % 2 == 0 || prime < 2) { return false; } float Asqrt = sqrtf(prime); for (int i = 3; i <= Asqrt; i += 2) { if (prime % i == 0) { re...
#include <cmath> #include <iostream> using namespace std; // 素数判定(素数ならtrue) bool Prime(int prime) { // 偶数除く if (prime == 2) { return true; } else if (prime % 2 == 0 || prime < 2) { return false; } float Asqrt = sqrtf(prime); for (int i = 3; i <= Asqrt; i += 2) { if (prime % i == 0) { re...
insert
44
44
44
49
TLE
p02467
C++
Time Limit Exceeded
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, i; cin >> n; cout << n << ":"; for (i = 2; n != 1; i++) { while (n % i == 0) { cout << " " << i; n /= i; } } cout << endl; return 0; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, i; cin >> n; cout << n << ":"; for (i = 2; n != 1; i++) { if (i > sqrt(n)) { cout << " " << n; n = 1; continue; } while (n % i == 0) { cout << " " << i; n /= i; } }...
insert
13
13
13
18
TLE
p02468
C++
Runtime Error
#include <bits/stdc++.h> #define int long long int #define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORE(i, a, b) for (int i = (a); i <= (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define RFORE(i, a, b) for (int i = (b); i >= (a); --i) #de...
#include <bits/stdc++.h> #define int long long int #define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORE(i, a, b) for (int i = (a); i <= (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define RFORE(i, a, b) for (int i = (b); i >= (a); --i) #de...
delete
116
117
116
116
0
MP(n,m) = (2,3)
p02468
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; bool judge(int s) { for (int i = 2; i * i <= s; i++) { if (s % i != 0 && (i + 1) * (i + 1) > s) { return true; } if (s % i == 0) { return false; break; } } } int main() { unsigned long long a; int m, n, b; cin >> m >> n; a = m...
#include <bits/stdc++.h> using namespace std; bool judge(int s) { for (int i = 2; i * i <= s; i++) { if (s % i != 0 && (i + 1) * (i + 1) > s) { return true; } if (s % i == 0) { return false; break; } } } int main() { unsigned long long a; int m, n, b; cin >> m >> n; a = m...
replace
35
36
35
36
TLE
p02468
C++
Time Limit Exceeded
#include <iostream> using namespace std; typedef long long ll; /* AOJ power http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B&lang=jp 繰り返し2乗法 */ ll power(int m, int n) { ll ans = 1; while (n > 0) { if (n == 1) return (ans * m) % ll(1e9 + 7); ans *= m * m; ans %= ll(1e9 + 7);...
#include <iostream> using namespace std; typedef long long ll; /* AOJ power http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B&lang=jp 繰り返し2乗法 */ ll power(int m, int n) { if (n == 0) return 1; if (n & 1) return m * power(m, n - 1) % ll(1e9 + 7); ll k = power(m, n / 2); return k * k...
replace
11
20
11
17
TLE
p02468
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; class Inverse { private: long long mod; vector<long long> inv; public: Inverse() {} Inverse(long long mod, long long n = 10000000) : mod(mod) { inv = vector<long long>(n, 1); for (int i = 2; i < n; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod...
#include <bits/stdc++.h> using namespace std; class Inverse { private: long long mod; vector<long long> inv; public: Inverse() {} Inverse(long long mod, long long n = 1000000) : mod(mod) { inv = vector<long long>(n, 1); for (int i = 2; i < n; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;...
replace
12
13
12
13
MLE
p02468
C++
Runtime Error
#include <iostream> using namespace std; #define MOD 1000000007LL long long power(int a, int b) { if (b == 0) { return 1LL; } return power(a, b - 1) * a % MOD; } int main() { int n, m; cin >> m >> n; cout << power(m, n) << endl; return 0; }
#include <iostream> using namespace std; #define MOD 1000000007LL long long power(int a, int b) { if (b == 0) { return 1LL; } if (b % 2 == 1) { return power(a, b / 2) * power(a, b / 2) % MOD * a % MOD; } return power(a, b / 2) * power(a, b / 2) % MOD; } int main() { int n, m; cin >> m >> n;...
replace
11
12
11
16
0
p02468
C++
Time Limit Exceeded
#include <math.h> #include <stdio.h> int main(void) { long long n, i, m, mt, mt2; scanf("%lld%lld", &m, &n); mt = m, mt2 = m; m = 1; long long a = log2(n), b = n - (int)pow(2, a); while (a) { for (i = 0; i < a; ++i) { mt *= mt; mt %= 1000000007; } a = log2(b); m *= mt; m %= ...
#include <math.h> #include <stdio.h> int main(void) { long long n, i, m, mt, mt2; scanf("%lld%lld", &m, &n); mt = m, mt2 = m; m = 1; long long a = log2(n), b = n - (int)pow(2, a); while (a) { for (i = 0; i < a; ++i) { mt *= mt; mt %= 1000000007; } a = log2(!b ? 1 : b); m *= mt; ...
replace
14
15
14
15
TLE
p02468
C++
Time Limit Exceeded
#include <iostream> int main() { int64_t m, n, q = 1000000007; std::cin >> m >> n; int64_t r = m % q; for (int64_t i = 1; i < n; i++) { r = (r * m) % q; } std::cout << r << "\n"; return 0; }
#include <iostream> int main() { int64_t m, n, q = 1000000007; std::cin >> m >> n; int64_t r = 1; int64_t m2 = m * m; int64_t m4 = m * m * m * m; int64_t i = 0; for (int64_t j = 0; j < n / 4; j++) { r = (r * m4) % q; i += 4; } for (; i < n; i++) { r = (r * m) % q; } std::cout << r <<...
replace
6
8
6
15
TLE
p02469
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define int long long #define MOD 1000000007 int gcd(int a, int b) { if (a % b == 0) return b; return gcd(a, b % a); } int lcm(int a, int b) { return a / gcd(a, b) * b; } signed main() { int n; int a[11]; cin >> n;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define int long long #define MOD 1000000007 int gcd(int a, int b) { if (a % b == 0) return b; return gcd(b, a % b); } int lcm(int a, int b) { return a / gcd(a, b) * b; } signed main() { int n; int a[11]; cin >> n;...
replace
8
9
8
9
TLE
p02469
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; inline int gcd(int x, int y) { if (!y) return x; return gcd(y, x % y); } inline int lcm(int x, int y) { return (x * y) / gcd(y, x % y); } int main() { int n, x; vector<int> v; cin >> n; for (int i = 1; i <= n; ++i) cin >> x, v.push_back(x); ...
#include <iostream> #include <vector> using namespace std; inline int gcd(int x, int y) { if (!y) return x; return gcd(y, x % y); } inline int lcm(int x, int y) { return (x * y) / gcd(y, x % y); } int main() { int n, x; vector<int> v; cin >> n; for (int i = 1; i <= n; ++i) cin >> x, v.push_back(x); ...
replace
15
16
15
16
-8
p02469
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; int gcd(int m, int n) { if (n == 0) return m; return gcd(n, m % n); } int lcm(int m, int n) { return m * n / gcd(m, n); } int main() { int n, A[n - 1]; cin >> n; for (int i = 0; i <= n - 1; i++) cin >> A[i]; int ans = A[0]; for (int i ...
#include <cstdio> #include <iostream> using namespace std; int gcd(int m, int n) { if (n == 0) return m; return gcd(n, m % n); } int lcm(int m, int n) { return m * n / gcd(m, n); } int main() { int n, A[10]; cin >> n; for (int i = 0; i <= n - 1; i++) cin >> A[i]; int ans = A[0]; for (int i = 1...
replace
13
14
13
14
-11
p02469
C++
Runtime Error
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; // < "D:\D_Download\Visual Studio // 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; // < "D:\D_Download\Visual Studio // 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D...
replace
129
130
129
130
-8
p02471
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define mp make_pair typedef long long ll; typedef pair<int, int> pii; int ExtendedGCD(int a, int b, int &x, int &y) { if (b == 0) { x = 1, y = 0; return a; } else { int g = ExtendedGCD(b, a % b, x, y); tie(x, y) = make_tuple(y, x - a / b * y); re...
#include <bits/stdc++.h> using namespace std; #define mp make_pair typedef long long ll; typedef pair<int, int> pii; int ExtendedGCD(int a, int b, int &x, int &y) { if (b == 0) { x = 1, y = 0; return a; } else { int g = ExtendedGCD(b, a % b, x, y); tie(x, y) = make_tuple(y, x - a / b * y); re...
replace
34
35
34
35
TLE
p02471
C++
Runtime Error
#include <cmath> #include <iostream> using namespace std; long long d = 0; bool flag = 0; long long gcd(long long a, long long b) { if (a % b == 0) return b; return gcd(b, a % b); } long long judge(long long x, long long y) { return abs(x) + abs(y); } pair<long long, long long> calc(long long a, long long ...
#include <cmath> #include <iostream> using namespace std; long long d = 0; bool flag = 0; long long gcd(long long a, long long b) { if (a % b == 0) return b; return gcd(b, a % b); } long long judge(long long x, long long y) { return abs(x) + abs(y); } pair<long long, long long> calc(long long a, long long ...
insert
38
38
38
42
0
p02471
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long using namespace std; ll s1, s2, s, t1, t2, t; void xgcd(ll x, ll y) { if (x % y == 0) return; ll q = x / y; s = s2 - q * s1; t = t2 - q * t1; s2 = s1, t2 = t1, s1 = s, t1 = t; xgcd(y, x % y); } int main() { ll a, b; while (1) { cin >> a >> b; ...
#include <bits/stdc++.h> #define ll long long using namespace std; ll s1, s2, s, t1, t2, t; void xgcd(ll x, ll y) { if (x % y == 0) return; ll q = x / y; s = s2 - q * s1; t = t2 - q * t1; s2 = s1, t2 = t1, s1 = s, t1 = t; xgcd(y, x % y); } int main() { ll a, b; // while(1) { cin >> a >> b; s1...
replace
18
27
18
27
TLE
p02472
Python
Runtime Error
a = int(input()) b = int(input()) print(a + b)
print(sum(map(int, input().split())))
replace
0
3
0
1
ValueError: invalid literal for int() with base 10: '5 8'
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02472/Python/s921485887.py", line 1, in <module> a = int(input()) ValueError: invalid literal for int() with base 10: '5 8'
p02477
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define maxn 400010 #define ll long long const double pi = acos(-1); typedef complex<double> cp; int n, rev[maxn]; cp omega[maxn], iomega[maxn]; void init(int N) { n = N; for (int i = 0; i < n; i++) { omega[i] = cp(cos(2 * pi / n * i), sin(2 * pi / n * i)); iome...
#include <bits/stdc++.h> using namespace std; #define maxn 800010 #define ll long long const double pi = acos(-1); typedef complex<double> cp; int n, rev[maxn]; cp omega[maxn], iomega[maxn]; void init(int N) { n = N; for (int i = 0; i < n; i++) { omega[i] = cp(cos(2 * pi / n * i), sin(2 * pi / n * i)); iome...
replace
2
3
2
3
0
p02534
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main(void) { int n; while (n--) { cout << "ACL"; } }
#include <iostream> using namespace std; int main(void) { int n; cin >> n; while (n--) { cout << "ACL"; } }
insert
5
5
5
6
TLE
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int par[100010]; int parent(int i) { if (par[i] == i) return i; else { return par[i] = parent(par[i]); } } int main() { int N, M; cin >> N >> M; for (int i = 0; i < N; i++) par[i] = i; for (int i = 0; i < M; i++) { int A, B; cin >> A >...
#include <bits/stdc++.h> using namespace std; int par[100010]; int parent(int i) { if (par[i] == i) return i; else { return par[i] = parent(par[i]); } } int main() { int N, M; cin >> N >> M; for (int i = 0; i < N; i++) par[i] = i; for (int i = 0; i < M; i++) { int A, B; cin >> A >...
replace
25
28
25
34
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int root(int x, vector<int> &city) { if (city.at(x) == x) { return x; } else { return city.at(x) = root(city.at(x), city); } } int main() { int n, m; cin >> n >> m; vector<int> city(n); vector<int> rank(n); vector<int> unionCity(n); for (int i = ...
#include <bits/stdc++.h> using namespace std; int root(int x, vector<int> &city) { if (city.at(x) == x) { return x; } else { return city.at(x) = root(city.at(x), city); } } int main() { int n, m; cin >> n >> m; vector<int> city(n); vector<int> rank(n); vector<int> unionCity(n); for (int i = ...
replace
28
35
28
39
0
p02536
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; struct union_find { vector<int> r; union_find(int n) : r(n, -1) {} int root(int a) { if (r[a] < 0) { return a; } else { return root(r[a]); } } void add(int a, int b) { int ra = root(a); int rb = root(b); if (r[ra] > r[rb]) { ...
#include <bits/stdc++.h> using namespace std; struct union_find { vector<int> r; union_find(int n) : r(n, -1) {} int root(int a) { if (r[a] < 0) { return a; } else { return root(r[a]); } } void add(int a, int b) { int ra = root(a); int rb = root(b); if (r[ra] > r[rb]) { ...
insert
18
18
18
20
TLE
p02536
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; int P(int i, vector<int> &p) { if (p[i] == i) return i; else return p[i] = P(p[i], p); } void C(int a, int b, vector<int> &p) { p[P(a, p)] = P(b, p); } int main() { int N, M; cin >> N >> M; vector<int> p(N); int i; for (i = 0; i < N; i...
#include <iostream> #include <vector> using namespace std; int P(int i, vector<int> &p) { if (p[i] == i) return i; else return p[i] = P(p[i], p); } void C(int a, int b, vector<int> &p) { p[P(a, p)] = P(b, p); } int main() { int N, M; cin >> N >> M; vector<int> p(N); int i; for (i = 0; i < N; i...
replace
24
25
24
25
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using iii = pair<ii, int>; #define vt vector #define pq priority_queue #define pb push_back #define mp make_pair #define fi first #define se second const int MOD = 1e9 + 7; const int INF = 2e9; const int N = 1e5 + 5; int n, ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using iii = pair<ii, int>; #define vt vector #define pq priority_queue #define pb push_back #define mp make_pair #define fi first #define se second const int MOD = 1e9 + 7; const int INF = 2e9; const int N = 1e5 + 5; int n, ...
replace
26
27
26
27
0
p02536
C++
Runtime Error
#include <iostream> #include <stdlib.h> #include <string> #include <vector> using namespace std; struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); } ...
#include <iostream> #include <stdlib.h> #include <string> #include <vector> using namespace std; struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); } ...
insert
39
39
39
41
0
p02536
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; class UnionFind { public: explicit UnionFind(int N) : root(N, -1), size(N, 1) {} int getRoot(int u) { return root[u] == -1 ? u : root[u] = getRoot(root[u]); } int getSize(int u) { return size[getRoot(u)]; } bool same(int a, int b) { return getRoot(a) ...
#include <iostream> #include <vector> using namespace std; class UnionFind { public: explicit UnionFind(int N) : root(N, -1), size(N, 1) {} int getRoot(int u) { return root[u] == -1 ? u : root[u] = getRoot(root[u]); } int getSize(int u) { return size[getRoot(u)]; } bool same(int a, int b) { return getRoot(a) ...
insert
33
33
33
35
0
p02536
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 int groups; UnionFind(int N) : par(N) { // 最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] = i; groups = N; } int root(int x) { // データxが属する木の根を再帰で得る:root...
#include <iostream> #include <vector> using namespace std; struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 int groups; UnionFind(int N) : par(N) { // 最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] = i; groups = N; } int root(int x) { // データxが属する木の根を再帰で得る:root...
insert
45
45
45
47
0
p02536
C++
Runtime Error
// #include "bits/stdc++.h" #include <bits/stdc++.h> using namespace std; // using namespace atcoder; using ll = long long; template <typename T> void print_vec(const vector<T> &v, bool is_reverse = false, ll num = 0) { if (num == 0) num = (ll)v.size(); cout << endl; cout << "i= "; for (ll i = 0; i < num;...
// #include "bits/stdc++.h" #include <bits/stdc++.h> using namespace std; // using namespace atcoder; using ll = long long; template <typename T> void print_vec(const vector<T> &v, bool is_reverse = false, ll num = 0) { if (num == 0) num = (ll)v.size(); cout << endl; cout << "i= "; for (ll i = 0; i < num;...
replace
98
99
98
99
0
p02536
C++
Runtime Error
#include <algorithm> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; struct UnionFind { vector<int> parent; int N; UnionFind(int n) : N(n) { // メンバイニシャライザを実行している for (int ...
#include <algorithm> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; struct UnionFind { vector<int> parent; int N; UnionFind(int n) : parent(n), N(n) { // メンバイニシャライザを実行している ...
replace
15
17
15
17
-11
p02536
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; struct UnionFind { vector<int> parent; UnionFind(int N) : parent(N) { for (int i = 0; i < N; i++) { ...
#include <algorithm> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; struct UnionFind { vector<int> parent; UnionFind(int N) : parent(N) { for (int i = 0; i < N; i++) { ...
replace
25
26
25
27
TLE
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; class DisjointSet { public: vector<int> rank, p; DisjointSet() {} DisjointSet(int size) { rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size; i++) { makeSet(i); } } void ...
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; class DisjointSet { public: vector<int> rank, p; DisjointSet() {} DisjointSet(int size) { rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size; i++) { makeSet(i); } } void ...
replace
51
52
51
52
0
p02536
C++
Runtime Error
////////////////<------------- Xorcestor_X -------------->//////////////// #include <algorithm> #include <bits/stdc++.h> #include <deque> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include <string> ...
////////////////<------------- Xorcestor_X -------------->//////////////// #include <algorithm> #include <bits/stdc++.h> #include <deque> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include <string> ...
replace
540
541
540
541
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define endl "\...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define endl "\...
replace
15
16
15
16
-11
p02536
C++
Runtime Error
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
insert
68
68
68
70
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { int rx = root(x); ...
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { int rx = root(x); ...
replace
42
43
42
43
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() using namespace std; typedef long long ll; typedef unsigned long long ull; const long long MOD = 1e9 + 7; const long long LINF = 1e18; const int INF = 0x3f3f3f3f; const int MAXN = 200050; int fa[MAXN]; int find(int x) { if (fa[x] == x) return x; else...
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() using namespace std; typedef long long ll; typedef unsigned long long ull; const long long MOD = 1e9 + 7; const long long LINF = 1e18; const int INF = 0x3f3f3f3f; const int MAXN = 200050; int fa[MAXN]; int find(int x) { if (fa[x] == x) return x; else...
replace
27
28
27
28
0
p02536
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int father(vector<int> &f, int x) { return (f[x] == x) ? x : (father(f, f[x])); } int merge(vector<int> &f, int x, int y) { x = father(f, x); y = father(f, y); if (x == y) return 0; f[x] = y; return 1; } int main() { int n; int m; cin >> n >> m; vect...
#include <bits/stdc++.h> using namespace std; int father(vector<int> &f, int x) { return (f[x] == x) ? x : (f[x] = father(f, f[x])); } int merge(vector<int> &f, int x, int y) { x = father(f, x); y = father(f, y); if (x == y) return 0; f[x] = y; return 1; } int main() { int n; int m; cin >> n >> m;...
replace
3
4
3
4
TLE
p02536
C++
Runtime Error
#include <cstdio> #include <iostream> #include <vector> #define maxn 1000 using namespace std; vector<int> G[maxn]; bool vis[maxn] = {false}; int m, n; void dfs(int v) { vis[v] = true; for (int i = 0; i < G[v].size(); i++) { if (vis[G[v][i]] == false) { dfs(G[v][i]); } } } int main() { scanf("...
#include <cstdio> #include <iostream> #include <vector> #define maxn 200000 using namespace std; vector<int> G[maxn]; bool vis[maxn] = {false}; int m, n; void dfs(int v) { vis[v] = true; for (int i = 0; i < G[v].size(); i++) { if (vis[G[v][i]] == false) { dfs(G[v][i]); } } } int main() { scanf...
replace
3
4
3
4
0
p02536
C++
Runtime Error
#line 1 "main.cpp" #define _CRT_SECURE_NO_WARNINGS #pragma GCC target("avx") #pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <...
#line 1 "main.cpp" #define _CRT_SECURE_NO_WARNINGS #pragma GCC target("avx") #pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <...
replace
125
127
125
127
0
p02536
C++
Runtime Error
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; #define fi first #define se second #define all(v) (v).begin(), (v).end() const ll inf = (1e18); // const ll mod=998244353; const ll mod = 1000000007; const vecto...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; #define fi first #define se second #define all(v) (v).begin(), (v).end() const ll inf = (1e18); // const ll mod=998244353; const ll mod = 1000000007; const vecto...
insert
72
72
72
74
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) rep(i, 0, n) struct UnionFind { vector<int> data; UnionFind(int sz) { data.assign(sz, -1); } bool unite(int x, int y) { x = find(x), y = find(y); if (x == y) r...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) rep(i, 0, n) struct UnionFind { vector<int> data; UnionFind(int sz) { data.assign(sz, -1); } bool unite(int x, int y) { x = find(x), y = find(y); if (x == y) r...
insert
46
46
46
48
0
p02536
C++
Runtime Error
#include <iostream> using namespace std; int dsu[100010]; int fnd(int x) { return (x == dsu[x]) ? x : dsu[x] = fnd(dsu[x]); } int merge(int u, int v) { dsu[fnd(u)] = fnd(v); } int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { dsu[i] = i; } int x, y, cnt = 0; for (int i = 1; i <= m; i+...
#include <iostream> using namespace std; int dsu[100010]; int fnd(int x) { return (x == dsu[x]) ? x : dsu[x] = fnd(dsu[x]); } void merge(int u, int v) { dsu[fnd(u)] = fnd(v); } int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { dsu[i] = i; } int x, y, cnt = 0; for (int i = 1; i <= m; i...
replace
4
5
4
5
0
p02536
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; vector<vector<int>> michi(n, vector<int>(0)); vector<int> checked(n, 0); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; michi.at(a).push_back(b); michi.at(b).push_back(a); } ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; vector<vector<int>> michi(n, vector<int>(0)); vector<int> checked(n, 0); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; michi.at(a).push_back(b); michi.at(b).push_back(a); } ...
replace
37
38
37
38
TLE
p02536
C++
Runtime Error
#include <cstdio> #include <vector> using namespace std; int a[10005]; vector<int> g[10005]; bool vis[10005]; void dfs(int x) { vis[x] = true; for (int i : g[x]) { if (!vis[i]) { dfs(i); } } } int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int a, b; sca...
#include <cstdio> #include <vector> using namespace std; const int N = 1e5 + 5; int a[N]; vector<int> g[N]; bool vis[N]; void dfs(int x) { vis[x] = true; for (int i : g[x]) { if (!vis[i]) { dfs(i); } } } int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int a,...
replace
5
8
5
9
0
p02536
C++
Runtime Error
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #includ...
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #includ...
replace
97
98
97
98
0
p02536
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { // 最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] ...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { // 最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] ...
insert
41
41
41
43
0
p02536
C++
Runtime Error
//@formatter:off #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < int(n); ++i) #define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--) #define rep2(i, s, n) for (int i = int(s); i < int(n); ++i) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define pb push_back #define eb emplace...
//@formatter:off #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < int(n); ++i) #define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--) #define rep2(i, s, n) for (int i = int(s); i < int(n); ++i) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define pb push_back #define eb emplace...
insert
112
112
112
114
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<vector<int>> adj; vector<bool> vis; void dfs(int v, int p) { vis[v] = 1; for (auto x : adj[v]) { if (x != p) dfs(x, v); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; adj = vector<vector<in...
#include <bits/stdc++.h> using namespace std; vector<vector<int>> adj; vector<bool> vis; void dfs(int v, int p) { vis[v] = 1; for (auto x : adj[v]) { if (x != p && !vis[x]) dfs(x, v); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; adj = vecto...
replace
10
11
10
11
0
p02536
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; int n, m, fa[1000001], x, y, ans; int father(int a) { if (fa[a] != a) fa[a] = father(a); return fa[a]; } int main() { scanf("%d%d", &n, &m); ans = n - 1; for (int i = 1; i <= n; i++) fa[i] = i; for (int i = 1; i <= m; i++) { scanf("%d%d"...
#include <cstdio> #include <iostream> using namespace std; int n, m, fa[1000001], x, y, ans; int father(int a) { if (fa[a] != a) fa[a] = father(fa[a]); return fa[a]; } int main() { scanf("%d%d", &n, &m); ans = n - 1; for (int i = 1; i <= n; i++) fa[i] = i; for (int i = 1; i <= m; i++) { scanf("%...
replace
6
7
6
7
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define fbo find_by_order #define ook order_of_key #define fi first #define se second #define long long long typedef pair<int, int> ii; typedef pair<int, ii>...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define fbo find_by_order #define ook order_of_key #define fi first #define se second #define long long long typedef pair<int, int> ii; typedef pair<int, ii>...
replace
24
25
24
25
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; struct UnionFind { vector<int> Parent; UnionFind(int n) { Parent = vector<int>(n, -1); } int root(int a) { if (Parent[a] < 0) return a; return root(Parent[a]); } int size(int a) { return -Parent[ro...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; struct UnionFind { vector<int> Parent; UnionFind(int n) { Parent = vector<int>(n, -1); } int root(int a) { if (Parent[a] < 0) return a; return root(Parent[a]); } int size(int a) { return -Parent[ro...
insert
35
35
35
37
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 100010; int n, m, cnt, father[N]; int find(int x) { return x == father[x] ? x : father[x] = find(father[x]); } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) father[i] = i; for (int i = 1, x, y; i <= m; i++) { scanf("%d%d", &...
#include <bits/stdc++.h> using namespace std; const int N = 100010; int n, m, cnt, father[N]; int find(int x) { return x == father[x] ? x : father[x] = find(father[x]); } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) father[i] = i; for (int i = 1, x, y; i <= m; i++) { scanf("%d%d", &...
replace
14
15
14
15
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; using namespace std; vector<int> cities[100000]; bool visited[100000]; void dfs(int i) { visited[i] = true; for (int x : cities[i]) { if (not(visited[x])) { dfs(x); } } } int main() { int n, m; cin >> n >> m; while (m--) { int a, b; ci...
#include <bits/stdc++.h> typedef long long ll; using namespace std; vector<int> cities[100005]; bool visited[100005]; void dfs(int i) { visited[i] = true; for (int x : cities[i]) { if (not(visited[x])) { dfs(x); } } } int main() { int n, m; cin >> n >> m; while (m--) { int a, b; ci...
replace
5
7
5
7
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int cities, roads, a, b, group; vector<int> adj[10100]; bool visited[100100]; void dfs(int c) { if (!visited[c]) { visited[c] = true; for (int i = 0; i < adj[c].size(); i++) { int d = adj[c][i]; dfs(d); } } } int main() { ios_base::sync_with...
#include <bits/stdc++.h> using namespace std; int cities, roads, a, b, group; vector<int> adj[100100]; bool visited[100100]; void dfs(int c) { if (!visited[c]) { visited[c] = true; for (int i = 0; i < adj[c].size(); i++) { int d = adj[c][i]; dfs(d); } } } int main() { ios_base::sync_wit...
replace
4
5
4
5
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, m, a, b, blocks; vector<int> toc; vector<vector<int>> rd; bool used[100009]; void DFS(int i) { used[i] = 1; for (int j = 0; j < toc[i]; j++) { DFS(rd[i][j]); } } int main() { cin >> n >> m; rd.resize(n); toc.resize(n); for (int i = 0; i < m; i++) { ...
#include <bits/stdc++.h> using namespace std; int n, m, a, b, blocks; vector<int> toc; vector<vector<int>> rd; bool used[100009]; void DFS(int i) { used[i] = 1; for (int j = 0; j < toc[i]; j++) { if (used[rd[i][j]]) continue; DFS(rd[i][j]); } } int main() { cin >> n >> m; rd.resize(n); toc.res...
insert
9
9
9
11
-11
p02536
C++
Runtime Error
#include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> vi(n, 0); vector<vector<int>> v(n, vector<int>(n, -1)); map<int, vector<int>> mp; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; mp...
#include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> vi(n, 0); map<int, vector<int>> mp; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; mp[x].push_back(y); mp[y].push_back(x); } ...
delete
11
12
11
11
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<int> rec; int find(int u) { return u == rec[u] ? u : rec[u] = find(rec[u]); } int main() { int n, m; cin >> n >> m; rec.resize(n); for (int i = 0; i < n; ++i) { rec[i] = i; } int c = n - 1; for (int i = 0; i < m; ++i) { int u, v; cin >> u >>...
#include <bits/stdc++.h> using namespace std; vector<int> rec; int find(int u) { return u == rec[u] ? u : rec[u] = find(rec[u]); } int main() { int n, m; cin >> n >> m; rec.resize(n); for (int i = 0; i < n; ++i) { rec[i] = i; } int c = n - 1; for (int i = 0; i < m; ++i) { int u, v; cin >> u >>...
insert
15
15
15
17
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) class UnionFind { vector<int> par; vector<int> siz; public: UnionFind(int n) : par(n), siz(n, 1) { for (int i = 0; i < n; i++) { par[i] = i; } } int root(int x) { if (par[x] == ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) class UnionFind { vector<int> par; vector<int> siz; public: UnionFind(int n) : par(n), siz(n, 1) { for (int i = 0; i < n; i++) { par[i] = i; } } int root(int x) { if (par[x] == ...
replace
45
46
45
47
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, x, n) for (int i = x; i < (int)n; i++) #define rep(i, n) REP(i, 0, n) #define sp(p) cout << setprecision(16) << fixed << p << endl; #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define SORT(a) sort(all(a)) #define RSORT(a) sort(rall(...
#include <bits/stdc++.h> using namespace std; #define REP(i, x, n) for (int i = x; i < (int)n; i++) #define rep(i, n) REP(i, 0, n) #define sp(p) cout << setprecision(16) << fixed << p << endl; #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define SORT(a) sort(all(a)) #define RSORT(a) sort(rall(...
replace
153
154
153
154
0
p02536
C++
Runtime Error
// In the name of god #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define all(x) x.begin(), x.end() #define use_file \ freopen("input.txt", "r", stdin); \ freopen("output.txt",...
// In the name of god #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define all(x) x.begin(), x.end() #define use_file \ freopen("input.txt", "r", stdin); \ freopen("output.txt",...
replace
11
12
11
12
0
p02536
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; void dfs(int node, vector<vector<int>> arr, char c[]) { if (c[node] == 'g') { return; } c[node] = 'g'; for (int i = 0; i < arr[node].size(); i++) { if (c[arr[node][i]] == 'w') { dfs(arr[node][i], arr, c); } } } int main() { /* #ifndef ONLI...
#include <bits/stdc++.h> using namespace std; void dfs(int node, vector<vector<int>> &arr, char c[]) { if (c[node] == 'g') { return; } c[node] = 'g'; for (int i = 0; i < arr[node].size(); i++) { if (c[arr[node][i]] == 'w') { dfs(arr[node][i], arr, c); } } } int main() { /* #ifndef ONL...
replace
3
4
3
4
TLE
p02536
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define vv(T) vector<vector<T>> #define coa \ cout << ans << endl; \ return 0; using namespace std; using ll = long long; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define vv(T) vector<vector<T>> #define coa \ cout << ans << endl; \ return 0; using namespace std; using ll = long long; ...
insert
60
60
60
62
0
p02536
C++
Runtime Error
/* Author: Ritik Patel */ //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER //&&&&&&&&&&&&&&&&&&&&&&&&&&& // #define _GLIBCXX_DEBUG // Iterator safety; out-of-bounds access for // Containers, etc. #pragma GCC optimize "trapv" // abort() on (signed) integer // overflow. //&&&&&&&&&&&&&&&&&&&&&&&&&&...
/* Author: Ritik Patel */ //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER //&&&&&&&&&&&&&&&&&&&&&&&&&&& // #define _GLIBCXX_DEBUG // Iterator safety; out-of-bounds access for // Containers, etc. #pragma GCC optimize "trapv" // abort() on (signed) integer // overflow. //&&&&&&&&&&&&&&&&&&&&&&&&&&...
replace
77
78
77
78
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // using Graph = vector<vector<int>>; struct UnionFind { vector<int> par; vector<int> rank; int num; UnionFind(int N) { num = N; rank.resize(N); par.resize(N); for (int i = 0; i < N; i++) { rank[i] = 0; par[i] = i; } } int find(i...
#include <bits/stdc++.h> using namespace std; // using Graph = vector<vector<int>>; struct UnionFind { vector<int> par; vector<int> rank; int num; UnionFind(int N) { num = N; rank.resize(N); par.resize(N); for (int i = 0; i < N; i++) { rank[i] = 0; par[i] = i; } } int find(i...
insert
48
48
48
50
0
p02536
C++
Time Limit Exceeded
#include <iostream> #include <map> #include <string> using namespace std; int par[100000]; // 添え字として0~99999を許容する int root(int i) { if (par[i] == i) { return i; } return root(par[i]); } int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { par[i] = i; } for (int i = 0; i < m; ++i)...
#include <iostream> #include <map> #include <string> using namespace std; int par[100000]; // 添え字として0~99999を許容する int root(int i) { if (par[i] == i) { return i; } return par[i] = root(par[i]); } int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { par[i] = i; } for (int i = 0; i ...
replace
11
12
11
12
TLE
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #define FI first #define SE second #de...
#include <bits/stdc++.h> using namespace std; #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #define FI first #define SE second #de...
insert
52
52
52
54
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long vector<int> graph[1000005]; int color[1000005]; int dfs(int v) { color[v] = 1; for (auto i : graph[v]) { if (color[i] == 0) dfs(i); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m;...
#include <bits/stdc++.h> using namespace std; #define int long long vector<int> graph[1000005]; int color[1000005]; int dfs(int v) { color[v] = 1; for (auto i : graph[v]) { if (color[i] == 0) dfs(i); } return 0; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; ci...
insert
13
13
13
14
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = unsigned long long int; vector<int> adj[30002]; bool v[30002]; int tam; void dfs(int i) { if (v[i]) return; v[i] = true; tam++; for (int j = 0; j < adj[i].size(); j++) { dfs(adj[i][j]); } } int main() { int n, m; cin >> n >> m; set<int> ...
#include <bits/stdc++.h> using namespace std; using ll = unsigned long long int; vector<int> adj[100002]; bool v[100002]; int tam; void dfs(int i) { if (v[i]) return; v[i] = true; tam++; for (int j = 0; j < adj[i].size(); j++) { dfs(adj[i][j]); } } int main() { int n, m; cin >> n >> m; set<int...
replace
3
5
3
5
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 998244353; int modP(int a, int b) { if (a == 1) return 1; if (b == 0) return 1; if (b % 2 == 0) { a *= a; a = a % mod; return modP(a, b / 2) % mod; } return a * modP(a, b - 1) % mod; } int add(int a, int b...
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 998244353; int modP(int a, int b) { if (a == 1) return 1; if (b == 0) return 1; if (b % 2 == 0) { a *= a; a = a % mod; return modP(a, b / 2) % mod; } return a * modP(a, b - 1) % mod; } int add(int a, int b...
replace
32
33
32
33
0
p02536
C++
Runtime Error
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> using namespace std; const int maxn = 4e6 + 10; vector<int> G[maxn]; bool vis[maxn]; void dfs(int u, int fa) { vis[u] = true; for (int i = 0; i < G[u].size(); i++) { int v = G[u][i]; ...
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> using namespace std; const int maxn = 4e6 + 10; vector<int> G[maxn]; bool vis[maxn]; void dfs(int u, int fa) { vis[u] = true; for (int i = 0; i < G[u].size(); i++) { int v = G[u][i]; ...
replace
16
17
16
17
127
/tmp/f0821b5e-faa7-4bee-af42-ac6b824f4e76.out: error while loading shared libraries: libc.so.6: failed to map segment from shared object
p02536
C++
Runtime Error
#include <bits/stdc++.h> #include <map> #include <set> #include <unordered_map> #include <vector> #define lli long long int #define loop(i, x, n) for (int i = x; i < n; i++) #define loopr(i, x, n) for (int i = n - 1; i >= x; i--) #define st set<lli> #define v vector<lli> #define um unordered_map<lli, lli> #define vpl v...
#include <bits/stdc++.h> #include <map> #include <set> #include <unordered_map> #include <vector> #define lli long long int #define loop(i, x, n) for (int i = x; i < n; i++) #define loopr(i, x, n) for (int i = n - 1; i >= x; i--) #define st set<lli> #define v vector<lli> #define um unordered_map<lli, lli> #define vpl v...
replace
31
32
31
32
0
p02536
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long; struct UnionFind { // 自身が親であれば、その集合に属する頂点数に-1を掛けたもの // そうでなければ親のid vector<int> r; UnionFind(int N) { r = vector<int>(N, -1); } int root(int x) { if (r[x] < 0) return x; return r[x] = root(r[x]); } bool unite(int x, int y...
#include "bits/stdc++.h" using namespace std; using ll = long long; struct UnionFind { // 自身が親であれば、その集合に属する頂点数に-1を掛けたもの // そうでなければ親のid vector<int> r; UnionFind(int N) { r = vector<int>(N, -1); } int root(int x) { if (r[x] < 0) return x; return r[x] = root(r[x]); } bool unite(int x, int y...
insert
39
39
39
41
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; const int mxn = 2e5 + 5; class DisjointSet { public: vector<int> parent; DisjointSet(int n) : parent(n) { for (int i = 0; i < n; i++) { parent[i] = i; } } void join(int a, int b) { parent[find(b)] = find(a); } int find(int a)...
#include <bits/stdc++.h> #define ll long long using namespace std; const int mxn = 2e5 + 5; class DisjointSet { public: vector<int> parent; DisjointSet(int n) : parent(n) { for (int i = 0; i < n; i++) { parent[i] = i; } } void join(int a, int b) { parent[find(b)] = find(a); } int find(int a)...
insert
30
30
30
32
0
p02536
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <cstdio> #include <tuple> #define MAX 1000007 #define MP make_pair #define ii long long #define dd double #define MAX_SIZE 1e7 #define mod 1000000007 #define gc getchar_unlocked #define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1) #define ll long long #define...
#include <bits/stdc++.h> #include <cstdio> #include <tuple> #define MAX 1000007 #define MP make_pair #define ii long long #define dd double #define MAX_SIZE 1e7 #define mod 1000000007 #define gc getchar_unlocked #define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1) #define ll long long #define...
replace
61
62
61
62
TLE
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define local #ifdef local template <class T> void _E(T x) { cerr << x; } void _E(double x) { cerr << fixed << setprecision(6) << x; } void _E(string s) { cerr << "\"" << s << "\""; } template <class A, class B> void _E(pair<A, B> x) { cerr << '('; _E(x.first); c...
#include <bits/stdc++.h> using namespace std; #define local #ifdef local template <class T> void _E(T x) { cerr << x; } void _E(double x) { cerr << fixed << setprecision(6) << x; } void _E(string s) { cerr << "\"" << s << "\""; } template <class A, class B> void _E(pair<A, B> x) { cerr << '('; _E(x.first); c...
replace
100
101
100
101
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define lli long long int #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define test ...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define test ...
replace
28
30
28
30
0
p02536
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); ++i) struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { // 最初は全てが根であるとして初期化 ...
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); ++i) struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { // 最初は全てが根であるとして初期化 ...
replace
46
47
46
47
0
p02536
C++
Runtime Error
#include "stdio.h" #include <vector> using namespace std; vector<int> gra[10001]; int v[10002]; int DFS(int s) { v[s] = 1; for (int i = 0; i < gra[s].size(); i++) { if (v[gra[s][i]] == 0) DFS(gra[s][i]); } return 0; } int main() { int N, M; scanf("%d%d", &N, &M); for (int i = 1; i <= N; i++) ...
#include "stdio.h" #include <vector> using namespace std; vector<int> gra[100010]; int v[100020]; int DFS(int s) { v[s] = 1; for (int i = 0; i < gra[s].size(); i++) { if (v[gra[s][i]] == 0) DFS(gra[s][i]); } return 0; } int main() { int N, M; scanf("%d%d", &N, &M); for (int i = 1; i <= N; i++...
replace
4
6
4
6
0
p02536
C++
Runtime Error
#define _GLIBCXX_DEBUG #include <algorithm> //next_permutation #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define dec(n) cout << fixed << setprecision(n); #define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define small "abcdefghijklmnopqrstuvwxyz" using namespace...
#define _GLIBCXX_DEBUG #include <algorithm> //next_permutation #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define dec(n) cout << fixed << setprecision(n); #define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define small "abcdefghijklmnopqrstuvwxyz" using namespace...
insert
63
63
63
65
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #include <cstdlib> #include <numeric> #define ll long long int #define all(x) x.begin(), x.end() #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #include <cstdlib> #include <numeric> #define ll long long int #define all(x) x.begin(), x.end() #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
replace
41
42
41
42
0
p02536
C++
Runtime Error
// luogu-judger-enable-o2 #include <bits/stdc++.h> using namespace std; int n, m, k; int x, y; int p[5000]; int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } map<int, bool> mp; int main() { cin >> n >> m; for (int i = 0; i < n; ++i) p[i] = i; for (int i = 0; i < m; ++i) { cin >> x...
// luogu-judger-enable-o2 #include <bits/stdc++.h> using namespace std; int n, m, k; int x, y; int p[100001]; int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } map<int, bool> mp; int main() { cin >> n >> m; for (int i = 0; i < n; ++i) p[i] = i; for (int i = 0; i < m; ++i) { cin >>...
replace
5
6
5
6
0
p02536
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 ll long long #define X first #define Y second #define all(x) x.begin(), x.end() #define ordered_set ...
#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 ll long long #define X first #define Y second #define all(x) x.begin(), x.end() #define ordered_set ...
replace
99
100
99
101
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; /*---------------------DEBUGGING--------------------------------------------*/ void __print(int x) {...
#include <bits/stdc++.h> #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; /*---------------------DEBUGGING--------------------------------------------*/ void __print(int x) {...
replace
72
73
72
73
0
p02536
C++
Runtime Error
#include <iostream> using namespace std; #define ll long long #include <set> #include <vector> // vector<ll>adj[100001]; ll parent[100001]; ll tao[100001]; ll find(ll i) { if (parent[i] == i) return i; else return parent[i] = find(parent[i]); } ll union_set(ll a, ll b) { ll x = find(a); ll y = find(b); ...
#include <iostream> using namespace std; #define ll long long #include <set> #include <vector> // vector<ll>adj[100001]; ll parent[100001]; ll tao[100001]; ll find(ll i) { if (parent[i] == i) return i; else return parent[i] = find(parent[i]); } void union_set(ll a, ll b) { ll x = find(a); ll y = find(b)...
replace
14
15
14
15
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define pii pair<int, int> #define int long long int #define vec vector<int> #define inf 1e18 using namespace std; vector<int> adj[100001]; int vis[100001]; int dfs(int node) { vis[node] = 1; for (int ch : adj[node]) { if (!vis[ch]) dfs(ch); } } int32_t main...
#include <bits/stdc++.h> #define pb push_back #define pii pair<int, int> #define int long long int #define vec vector<int> #define inf 1e18 using namespace std; vector<int> adj[100001]; int vis[100001]; void dfs(int node) { vis[node] = 1; for (int ch : adj[node]) { if (!vis[ch]) dfs(ch); } } int32_t mai...
replace
9
10
9
10
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> const int mmax = 1e5; using namespace std; long long n, m, ans; bool vis[mmax]; vector<int> adj[mmax]; void dfs(int u) { vis[u] = 1; for (int v : adj[u]) if (!vis[v]) dfs(v); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("test.inp", "r", ...
#include <bits/stdc++.h> const int mmax = 1e6; using namespace std; long long n, m, ans; bool vis[mmax]; vector<int> adj[mmax]; void dfs(int u) { vis[u] = 1; for (int v : adj[u]) if (!vis[v]) dfs(v); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("test.inp", "r", ...
replace
1
2
1
2
0
p02536
C++
Runtime Error
/* -> Written by <- ----------- |K_A_Z_A_M_A| |___________| | _ | | (^_^) | | /( | )\ | |____|_|____| H O A N G */ #define Task "" #define F first #define S second #define push_back pb #define bit(x, i) (x >> i) & 1 #define inf 1e9 + 7 #define INF 1e18 + 7 #define all(x) x.begin(), x.end...
/* -> Written by <- ----------- |K_A_Z_A_M_A| |___________| | _ | | (^_^) | | /( | )\ | |____|_|____| H O A N G */ #define Task "" #define F first #define S second #define push_back pb #define bit(x, i) (x >> i) & 1 #define inf 1e9 + 7 #define INF 1e18 + 7 #define all(x) x.begin(), x.end...
insert
50
50
50
52
0
p02536
C++
Runtime Error
//_nebula_ #include <bits/stdc++.h> using namespace std; #define int long long #define double long double int t; const int M = 1e9 + 7; const int inf = INT64_MAX; int max(int a, int b, int c) { return max(a, max(b, c)); } int min(int a, int b, int c) { return min(a, min(b, c)); } int fspow(int x, int y) { int ans; ...
//_nebula_ #include <bits/stdc++.h> using namespace std; #define int long long #define double long double int t; const int M = 1e9 + 7; const int inf = INT64_MAX; int max(int a, int b, int c) { return max(a, max(b, c)); } int min(int a, int b, int c) { return min(a, min(b, c)); } int fspow(int x, int y) { int ans; ...
replace
34
35
34
35
0
p02536
C++
Runtime Error
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools #include <bits/stdc++.h> // #include "atcoder/all" using namespace std; using i64 = long long; const i64 MOD = 1e9 + 7; const i64 INF = i64(1e18) + 7; template <typename T> bool chmin(T &x, T y) { if (x > y) { x = y; return true; } ...
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools #include <bits/stdc++.h> // #include "atcoder/all" using namespace std; using i64 = long long; const i64 MOD = 1e9 + 7; const i64 INF = i64(1e18) + 7; template <typename T> bool chmin(T &x, T y) { if (x > y) { x = y; return true; } ...
replace
52
53
52
53
0
p02536
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (int i = 0; i < (int)n; i++) // n回繰り返す #define rrep(i, n) for...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (int i = 0; i < (int)n; i++) // n回繰り返す #define rrep(i, n) for...
replace
66
67
66
68
TLE
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define mkp make_pair struct dsu { public: dsu() : _n(0) {} dsu(int n) : _n(n), parent_or_size(n, -1) {} int merge(int a, int b) { assert(0 <= a && a < _n); assert(0 <= b && b < _n); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define mkp make_pair struct dsu { public: dsu() : _n(0) {} dsu(int n) : _n(n), parent_or_size(n, -1) {} int merge(int a, int b) { assert(0 <= a && a < _n); assert(0 <= b && b < _n); ...
insert
78
78
78
80
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ALL(v) v.begin(), v.end() #define V vector #define P pair using ll = long long; struct UnionFind { vector<int> d; // n要素で初期化 UnionFind(int n) : d(n, -1) {} // 木の根を決める int root(int x) { if (d[x] < 0) return x; return d[x] = root(d[x]); } ...
#include <bits/stdc++.h> using namespace std; #define ALL(v) v.begin(), v.end() #define V vector #define P pair using ll = long long; struct UnionFind { vector<int> d; // n要素で初期化 UnionFind(int n) : d(n, -1) {} // 木の根を決める int root(int x) { if (d[x] < 0) return x; return d[x] = root(d[x]); } ...
replace
49
50
49
50
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; i++) #define ALL(x) (x).begin(), (x).end() // sortなどの引数を省略したい #ifdef _D...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; i++) #define ALL(x) (x).begin(), (x).end() // sortなどの引数を省略したい #ifdef _D...
replace
119
120
119
120
0
p02536
C++
Runtime Error
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; using Graph = vector<vector<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 >=...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; using Graph = vector<vector<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 >=...
replace
26
28
26
28
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // Graph class represents a undirected graph // using adjacency list representation class Graph { // No. of vertices int V; // Pointer to an array containing adjacency lists list<int> *adj; // A function used by DFS void DFSUtil(int v, bool visited[]); publi...
#include <bits/stdc++.h> using namespace std; // Graph class represents a undirected graph // using adjacency list representation class Graph { // No. of vertices int V; // Pointer to an array containing adjacency lists list<int> *adj; // A function used by DFS void DFSUtil(int v, bool visited[]); publi...
replace
80
81
80
82
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update /* * coder :: ATUL_PANDEY_2608 * >>> INDIA <<< */ using namespace std; using namespace __gn...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update /* * coder :: ATUL_PANDEY_2608 * >>> INDIA <<< */ using namespace std; using namespace __gn...
replace
86
87
86
87
0
p02536
C++
Runtime Error
#include <bits/stdc++.h> #ifdef DEBUG #define PRINT(x) \ cout << "func " << __func__ << ": line " << __LINE__ << ": " << #x << " = " \ << (x) << endl; #define PRINTA(a, first, last) \ cout << "func...
#include <bits/stdc++.h> #ifdef DEBUG #define PRINT(x) \ cout << "func " << __func__ << ": line " << __LINE__ << ": " << #x << " = " \ << (x) << endl; #define PRINTA(a, first, last) \ cout << "func...
insert
160
160
160
162
0