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
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, m, sum = 0; bool vis[200005]; vector<int> fr[200005]; void dfs(int a) { if (vis[a]) return; vis[a] = true; sum++; for (int i = 0; i < fr[a].size(); ++i) if (!vis[fr[a][i]]) dfs(fr[a][i]); } int main() { cin >> n >> m; for (int i = 0; i < m; ...
#include <bits/stdc++.h> using namespace std; int n, m, sum = 0; bool vis[200005]; vector<int> fr[200005]; void dfs(int a) { vis[a] = true; sum++; for (int i = 0; i < fr[a].size(); ++i) if (!vis[fr[a][i]]) dfs(fr[a][i]); } int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { int x, y; c...
delete
6
8
6
6
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MAX_SIZE 200005 int parent[MAX_SIZE]; int Find(int x) { if (parent[x] == -1) { return x; } return parent[x] = Find(parent[x]); } int Union(int x, int y) { int px = Find(x), py = Find(y); if (px != py) { parent[py] = px; } } int main() { i...
#include <bits/stdc++.h> using namespace std; #define MAX_SIZE 200005 int parent[MAX_SIZE]; int Find(int x) { if (parent[x] == -1) { return x; } return parent[x] = Find(parent[x]); } void Union(int x, int y) { int px = Find(x), py = Find(y); if (px != py) { parent[py] = px; } } int main() { ...
replace
15
16
15
16
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define vll vector<long long ll> #define pb push_back #define f(i, x, n) for (i = x; i < n; i++) ll visited[1000]; vector<ll> a[1000]; ll c = 0; void dfs(ll k) { if (visited[k] != 1) { visited[k] = 1; c = c + 1; for (ll i = 0; i < (ll...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define vll vector<long long ll> #define pb push_back #define f(i, x, n) for (i = x; i < n; i++) ll visited[1000000]; vector<ll> a[1000000]; ll c = 0; void dfs(ll k) { if (visited[k] != 1) { visited[k] = 1; c = c + 1; for (ll i = 0; i...
replace
6
8
6
8
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using ll = long long int; using P = std::pair<int, int>; #define rep(i, n) for (int i = 1; i <= (n); ++i) #define rag(con) std::begin(con), std::end(con) constexpr int MAX = 1e5 + 5; std::vector<int> to[MAX]; bool used[MAX]; int dfs(int v) { int res = 1; for (int x : to[v]) { if...
#include <bits/stdc++.h> using ll = long long int; using P = std::pair<int, int>; #define rep(i, n) for (int i = 1; i <= (n); ++i) #define rag(con) std::begin(con), std::end(con) constexpr int MAX = 2 * 1e5 + 5; std::vector<int> to[MAX]; bool used[MAX]; int dfs(int v) { int res = 1; for (int x : to[v]) { ...
replace
8
9
8
9
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define f(i, a, b) for (int i = a; i < b; i++) #define f1(i, a, b) for (int i = a; i <= b; i++) #define int long long using namespace std; #define mod 1000000007 vector<int> adj[200001]; int visited[200001]; int dfs(int s) { visited[s] = 1; int count = 1; for (int i ...
#include <bits/stdc++.h> #define pb push_back #define f(i, a, b) for (int i = a; i < b; i++) #define f1(i, a, b) for (int i = a; i <= b; i++) #define int long long using namespace std; #define mod 1000000007 vector<int> adj[200001]; int visited[200001]; int dfs(int s) { visited[s] = 1; int count = 1; for (int i ...
replace
44
46
44
50
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> #include <math.h> #define ll long long int #define hell 1000000007LL using namespace std; vector<int> adj[100001]; bool v[100001]; ll power(ll x, ll y, ll z) { if (y == 0) return 1; else { ll p = power(x, y / 2, z); if (y % 2 == 0) return (p * p) % z; ...
#include <bits/stdc++.h> #include <iostream> #include <math.h> #define ll long long int #define hell 1000000007LL using namespace std; vector<int> adj[200001]; bool v[200001]; ll power(ll x, ll y, ll z) { if (y == 0) return 1; else { ll p = power(x, y / 2, z); if (y % 2 == 0) return (p * p) % z; ...
replace
6
8
6
8
0
p02573
C++
Runtime Error
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. ******************************************...
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. ******************************************...
replace
12
13
12
13
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int f[N], sum[N]; int get(int x) { if (f[x] != x) { f[x] = get(f[x]); sum[x] = sum[f[x]]; } return f[x]; } int main() { int n, m, a, b; cin >> n >> m; for (int i = 1; i <= n; i++) f[i] = i, sum[i] = 1; for (int i = 0; i < m;...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int f[N], sum[N]; int get(int x) { if (f[x] != x) { f[x] = get(f[x]); sum[x] = sum[f[x]]; } return f[x]; } int main() { int n, m, a, b; cin >> n >> m; for (int i = 1; i <= n; i++) f[i] = i, sum[i] = 1; for (int i = 0; i < m;...
replace
2
3
2
3
0
p02573
C++
Time Limit Exceeded
using namespace std; #include <bits/stdc++.h> typedef long long ll; typedef long double ld; typedef double db; typedef string str; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<db, db> pd; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<ll> vl; typedef vector<db> vd; typedef vecto...
using namespace std; #include <bits/stdc++.h> typedef long long ll; typedef long double ld; typedef double db; typedef string str; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<db, db> pd; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<ll> vl; typedef vector<db> vd; typedef vecto...
insert
548
548
548
550
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<long long> g[100100]; bool ind[100107]; long long n, m, mx, ans; void dfs(long long i) { ind[i] = 1; mx++; for (long long v : g[i]) { if (ind[v] == 0) dfs(v); } } int main() { cin >> n >> m; long long x, y; for (long long i = 0; i < m; i++) { ...
#include <bits/stdc++.h> using namespace std; vector<long long> g[200100]; bool ind[200107]; long long n, m, mx, ans; void dfs(long long i) { ind[i] = 1; mx++; for (long long v : g[i]) { if (ind[v] == 0) dfs(v); } } int main() { cin >> n >> m; long long x, y; for (long long i = 0; i < m; i++) { ...
replace
2
4
2
4
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // using namespace __gnu_pbds; ...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // using namespace __gnu_pbds; ...
replace
30
31
30
31
-11
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; const int maxn = 1e5 + 5; int n; vector<int> adj[maxn]; int vis[maxn]; int dfs(int node) { vis[node] = 1; int res = 1; for (int nei : adj[node]) { if (vis[nei]) continue; res += dfs(nei); } return r...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; const int maxn = 2e5 + 5; int n; vector<int> adj[maxn]; int vis[maxn]; int dfs(int node) { vis[node] = 1; int res = 1; for (int nei : adj[node]) { if (vis[nei]) continue; res += dfs(nei); } return r...
replace
6
7
6
7
0
p02573
C++
Time Limit Exceeded
// atcoder #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll dfs(vector<vector<ll>> adj, ll root, ll &count, vector<bool> &vis) { vis[root] = true; count++; for (int i = 0; i < adj[root].size(); i++) { if (vis[adj[root][i]] == false) dfs(adj, adj[root][i], count, vis); } ret...
// atcoder #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll dfs(vector<vector<ll>> &adj, ll root, ll &count, vector<bool> &vis) { vis[root] = true; count++; for (int i = 0; i < adj[root].size(); i++) { if (vis[adj[root][i]] == false) dfs(adj, adj[root][i], count, vis); } re...
replace
4
5
4
5
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const long double PI = (acos(-1)); const long long MOD = 1000000007; struct Edge { long long to; long long cost; }; using Graph = vector<vector<Edge>>; using P = pair<ll, ll>; const long long INF = 1LL << 60; #defin...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const long double PI = (acos(-1)); const long long MOD = 1000000007; struct Edge { long long to; long long cost; }; using Graph = vector<vector<Edge>>; using P = pair<ll, ll>; const long long INF = 1LL << 60; #defin...
replace
266
267
266
267
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define inf 1e15 vector<ll> ad[400009]; map<pair<ll, ll>, ll> mp; bool vis[400009]; ll A; ll dfs(ll a) { vis[a] = true; A++; ll i, b, l = ad[a].size(); for (i = 0; i < l; i++) { b = ad[a][i]; if (!vis[b]) { dfs(b); } } } ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define inf 1e15 vector<ll> ad[400009]; map<pair<ll, ll>, ll> mp; bool vis[400009]; ll A; void dfs(ll a) { vis[a] = true; A++; ll i, b, l = ad[a].size(); for (i = 0; i < l; i++) { b = ad[a][i]; if (!vis[b]) { dfs(b); } } ...
replace
8
9
8
9
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const int MAX = 2 * 1000 * 100 + 11; int parent[MAX]; int n, m; void make_set(int node) { parent[node] = node; } int find_set(int node) { if (node == parent[node]) { return node; } return find_set(parent[node]); } void union_sets(int firstNode, int secondNod...
#include <bits/stdc++.h> using namespace std; const int MAX = 2 * 1000 * 100 + 11; int parent[MAX]; int n, m; void make_set(int node) { parent[node] = node; } int find_set(int node) { if (node == parent[node]) { return node; } return parent[node] = find_set(parent[node]); } void union_sets(int firstNode...
replace
15
16
15
16
TLE
p02573
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #incl...
replace
25
26
25
26
0
p02573
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
66
67
66
67
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fst \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define endk ...
#include <bits/stdc++.h> using namespace std; #define fst \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define endk ...
replace
49
51
49
51
0
p02573
C++
Time Limit Exceeded
#include "bits/stdc++.h" #define MOD 1000000007 #define rep(i, n) for (ll i = 0; i < (n); i++) #define rrep(i, n) for (ll i = (n)-1; i >= 0; i--) #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() #define FOR(i, j, k) for (ll i = j; i < k; i++) #define debug_print(var) cerr << #var << "=" << var <<...
#include "bits/stdc++.h" #define MOD 1000000007 #define rep(i, n) for (ll i = 0; i < (n); i++) #define rrep(i, n) for (ll i = (n)-1; i >= 0; i--) #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() #define FOR(i, j, k) for (ll i = j; i < k; i++) #define debug_print(var) cerr << #var << "=" << var <<...
replace
188
190
188
190
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n); i >= 0; i--) #define loop(i, r, n) for (int i = (r); i < (n); i++) #define pb push_back #define all(in) in.begin(), in.end() template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; retu...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n); i >= 0; i--) #define loop(i, r, n) for (int i = (r); i < (n); i++) #define pb push_back #define all(in) in.begin(), in.end() template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; retu...
insert
37
37
37
38
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define maxn 100010 const int MOD = 1000000007; int visited[maxn]; set<int> g[maxn]; int dfs(int u) { int cur = 1; visited[u] = true; for (auto x : g[u]) { if (!visited[x]) { cur += dfs(x); } } return cur; ...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define maxn 200010 const int MOD = 1000000007; int visited[maxn]; set<int> g[maxn]; int dfs(int u) { int cur = 1; visited[u] = true; for (auto x : g[u]) { if (!visited[x]) { cur += dfs(x); } } return cur; ...
replace
6
7
6
7
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array const int mxN = 1e5, INF = 999999999; const int modr = 1e9 + 7; int n, m, a[mxN]; /* 1. If you can't keep solution in mind, then visualize it on a paper. * 2. Try to identify the type of problem - DP, Greedy, Graph, Constructive, *...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array const int mxN = 2e5 + 5, INF = 999999999; const int modr = 1e9 + 7; int n, m, a[mxN]; /* 1. If you can't keep solution in mind, then visualize it on a paper. * 2. Try to identify the type of problem - DP, Greedy, Graph, Constructive...
replace
6
7
6
7
0
p02573
C++
Runtime Error
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define MOD 1000000007 using namespace std; typedef long long ll; #include <cstring> int n, m; struct unionfind { int pa...
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define MOD 1000000007 using namespace std; typedef long long ll; #include <cstring> int n, m; struct unionfind { int pa...
replace
23
24
23
24
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) struct UnionFind { vector<int> Parent; vector<int> Size; UnionFind(int N) : Parent(N), Size(N, 1) { for (int i = 0; i < N; i++) Parent[i] = i; } int root(int A) { if (Parent[A] == A) retur...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) struct UnionFind { vector<int> Parent; vector<int> Size; UnionFind(int N) : Parent(N), Size(N, 1) { for (int i = 0; i < N; i++) Parent[i] = i; } int root(int A) { if (Parent[A] == A) retur...
replace
45
46
45
46
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; /* clang-format off */ #define MOD 1000000007 #define INF 1000000000 #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(a) (a).begin(), (a).end() #define __DEBUG__ #ifdef __DEBUG__ #define CH_P(a) cout <<"check_point("<<#a<<"...
#include <bits/stdc++.h> using namespace std; typedef long long ll; /* clang-format off */ #define MOD 1000000007 #define INF 1000000000 #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(a) (a).begin(), (a).end() #define __DEBUG__ #ifdef __DEBUG__ #define CH_P(a) cout <<"check_point("<<#a<<"...
replace
70
72
70
72
0
p02573
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int getParent(vector<int> &parent, int x) { if (parent[x] < 0) return x; return parent[x] = getParent(parent, parent[x]); } void uniteParent(vector<int> &parent, int a, int b) { a = getParent(parent, a); b = getParent(parent,...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int getParent(vector<int> &parent, int x) { if (parent[x] < 0) return x; return parent[x] = getParent(parent, parent[x]); } void uniteParent(vector<int> &parent, int a, int b) { a = getParent(parent, a); b = getParent(parent,...
replace
38
39
38
39
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define ld long double #define pi pair<int, int> #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define sz(x) ((int)x.size()) #define ln(x) ((int)x.length()) #define mp make_pair #define pb push_back #define ff first #define ss second #define end...
#include <bits/stdc++.h> #define ll long long int #define ld long double #define pi pair<int, int> #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define sz(x) ((int)x.size()) #define ln(x) ((int)x.length()) #define mp make_pair #define pb push_back #define ff first #define ss second #define end...
insert
45
45
45
46
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<int> g[1000000]; bool vis[100000]; int cnt; void dfs(int node) { if (vis[node] == 1) return; vis[node] = 1; cnt++; for (auto c : g[node]) dfs(c); } int main() { int n, m; cin >> n >> m; while (m--) { int a, b; cin >> a >> b; g[a]....
#include <bits/stdc++.h> using namespace std; vector<int> g[1000079]; bool vis[1000009]; int cnt; void dfs(int node) { if (vis[node] == 1) return; vis[node] = 1; cnt++; for (auto c : g[node]) dfs(c); } int main() { int n, m; cin >> n >> m; while (m--) { int a, b; cin >> a >> b; g[a]...
replace
2
4
2
4
0
p02573
C++
Time Limit Exceeded
#include <algorithm> #include <assert.h> #include <bitset> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include ...
#include <algorithm> #include <assert.h> #include <bitset> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include ...
replace
137
138
137
138
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long // #define rp(i, a, b) for (ll i = a; i < b; i++) #define r(i, n) for (ll i = 0; i < n; i++) #define rt return #define db double #define ldb long double #define vd void #define p(x) cout << (x) << endl; #define psc(x) cout << setprecision(50) << (x) << endl; #define precise...
#include <bits/stdc++.h> #define ll long long // #define rp(i, a, b) for (ll i = a; i < b; i++) #define r(i, n) for (ll i = 0; i < n; i++) #define rt return #define db double #define ldb long double #define vd void #define p(x) cout << (x) << endl; #define psc(x) cout << setprecision(50) << (x) << endl; #define precise...
replace
152
155
152
155
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, f, n) for (int i = (f); (i) < (n); i++) #define repe(i, f, n) for (int i = (f); (i) <= (n); i++) using namespace std; using ll = long long; #define MOD (ll)1000000007 #define PI 3.14159265359 #define debug(x) cout << #x << " :: " << x << "\n"; #define debug2(x, y) ...
#include <bits/stdc++.h> #define rep(i, f, n) for (int i = (f); (i) < (n); i++) #define repe(i, f, n) for (int i = (f); (i) <= (n); i++) using namespace std; using ll = long long; #define MOD (ll)1000000007 #define PI 3.14159265359 #define debug(x) cout << #x << " :: " << x << "\n"; #define debug2(x, y) ...
replace
89
90
89
90
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define ff first #define ss second #define ll long long #define ll_MAX LONG_LONG_MAX #define ll_MIN LONG_LONG_MIN #define pi pair<int, int> #define endl "\n" #define MAXN 100005 using namespace std; int n, m, a, b, vis[MAXN], cnt; vector<int> adj[MAXN]...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define ff first #define ss second #define ll long long #define ll_MAX LONG_LONG_MAX #define ll_MIN LONG_LONG_MIN #define pi pair<int, int> #define endl "\n" #define MAXN 200005 using namespace std; int n, m, a, b, vis[MAXN], cnt; vector<int> adj[MAXN]...
replace
10
11
10
11
0
p02573
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
insert
68
68
68
70
-11
p02573
C++
Time Limit Exceeded
#include <cstring> #include <iostream> using namespace std; int n, m, p[200005], ans = 1; int pa(int x) { if (p[x] < 0) return x; return pa(p[x]); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; memset(p, -1, sizeof(p)); for (int i = 0, a, b; i < m; i++) { cin >> a >> b;...
#include <cstring> #include <iostream> using namespace std; int n, m, p[200005], ans = 1; int pa(int x) { if (p[x] < 0) return x; return p[x] = pa(p[x]); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; memset(p, -1, sizeof(p)); for (int i = 0, a, b; i < m; i++) { cin >> ...
replace
9
10
9
10
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> // pbds #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using orderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; /// use less_equal in pbds template to...
#include <bits/stdc++.h> // pbds #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using orderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; /// use less_equal in pbds template to...
replace
23
24
23
24
0
p02573
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; /****************************************************************************/ // メモ - UnionFindとは - // // UnionFindは、グループを管理するときに便利なグラフのひとつ。 // グループをは、グループの代表(以降、「親」という)を決め、 // 「〇〇が属するグループ」と管理する。 // この時、グラフ(木)の形になる。 // // このclassでは0から...
#include <iostream> #include <vector> using namespace std; /****************************************************************************/ // メモ - UnionFindとは - // // UnionFindは、グループを管理するときに便利なグラフのひとつ。 // グループをは、グループの代表(以降、「親」という)を決め、 // 「〇〇が属するグループ」と管理する。 // この時、グラフ(木)の形になる。 // // このclassでは0から...
replace
169
171
169
171
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, z, x, y, fa[N]; inline int find(int x) { while (x != fa[x]) x = fa[x] = fa[fa[x]]; return x; } int num[N]; int ans; int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) fa[i] = i; while (m--) { cin >> x >> y; in...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, m, z, x, y, fa[N]; inline int find(int x) { while (x != fa[x]) x = fa[x] = fa[fa[x]]; return x; } int num[N]; int ans; int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) fa[i] = i; while (m--) { cin >> x >> y; in...
replace
2
3
2
3
0
p02573
C++
Runtime Error
// gauravsinghh #include <bits/stdc++.h> using namespace std; using ll = long long int; using bigint = int64_t; #define pll pair<ll, ll> #define vll vector<ll> #define vpll vector<pll> #define lob lower_bound #define upb upper_bound #define ff first #define ss second #define pb push_back #define eb emplace_back #defi...
// gauravsinghh #include <bits/stdc++.h> using namespace std; using ll = long long int; using bigint = int64_t; #define pll pair<ll, ll> #define vll vector<ll> #define vpll vector<pll> #define lob lower_bound #define upb upper_bound #define ff first #define ss second #define pb push_back #define eb emplace_back #defi...
replace
46
48
46
48
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ld long double #define f(a, b) for (ll i = a; i <= b; i++) #define pb push_back #define pf push_front #define mp make_pair using namespace std; #define N 100005 const ll INF = 1000000001; const ll MOD = 1000000007; vector<vector<ll>> g(N); // vector< pair<ll, pair<...
#include <bits/stdc++.h> #define ll long long #define ld long double #define f(a, b) for (ll i = a; i <= b; i++) #define pb push_back #define pf push_front #define mp make_pair using namespace std; #define N 200005 const ll INF = 1000000001; const ll MOD = 1000000007; vector<vector<ll>> g(N); // vector< pair<ll, pair<...
replace
8
9
8
9
-11
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define fi first #define se second #define pb push_back const ll mod = 1e9 + 7; const int N = 1e5 + 205; vector<int> v[N]; bool vis[N]; int sz; int ans; void dfs(int x) { vis[x] = true; sz++; ans = max(ans, sz); for (int...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define fi first #define se second #define pb push_back const ll mod = 1e9 + 7; const int N = 2e5 + 205; vector<int> v[N]; bool vis[N]; int sz; int ans; void dfs(int x) { vis[x] = true; sz++; ans = max(ans, sz); for (int...
replace
8
9
8
9
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll int64_t #define ul unsigned long long int #define vi vector<int> #define vl vector<int64_t> #define all(x) x.begin(), x.end() #define pb push_back #define fo(x, a, b) for (int x = a; x < b; x++) #define rfo(x, a, b) for (int x = a; x >= b; x--) #define fi first #...
#include <bits/stdc++.h> using namespace std; #define ll int64_t #define ul unsigned long long int #define vi vector<int> #define vl vector<int64_t> #define all(x) x.begin(), x.end() #define pb push_back #define fo(x, a, b) for (int x = a; x < b; x++) #define rfo(x, a, b) for (int x = a; x >= b; x--) #define fi first #...
replace
18
20
18
20
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define po pop_back #define fi first #define se second #define mxn 100005 #define ll long long int #define ldb long double #define fr(i, a, b, k) for (int i = a; i < b; i += k) #define frr(i, a, b, k) for (int i = a; i > b; i -= k...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define po pop_back #define fi first #define se second #define mxn 200005 #define ll long long int #define ldb long double #define fr(i, a, b, k) for (int i = a; i < b; i += k) #define frr(i, a, b, k) for (int i = a; i > b; i -= k...
replace
9
10
9
10
0
p02573
C++
Runtime Error
#include <algorithm> #include <array> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stac...
#include <algorithm> #include <array> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stac...
replace
209
211
209
211
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int maxx = 100005; set<int> graph[maxx]; void dfs(int curr, int &cnt, int *visited, vector<int> &duringdfs) { visited[curr] = 1; ++cnt; duringdfs.push_back(curr); for (auto &child : graph[curr]) { if (visited[child] == 0) { dfs(child, cnt, visited, d...
#include <bits/stdc++.h> using namespace std; const int maxx = 200010; set<int> graph[maxx]; void dfs(int curr, int &cnt, int *visited, vector<int> &duringdfs) { visited[curr] = 1; ++cnt; duringdfs.push_back(curr); for (auto &child : graph[curr]) { if (visited[child] == 0) { dfs(child, cnt, visited, d...
replace
2
3
2
3
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int fin = 0, ans = 0; bool vis[200050]; vector<int> v[200050]; int dfs(int x) { if (vis[x]) return 0; vis[x] = true; ans++; for (auto it : v[x]) if (!vis[it]) dfs(it); } int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int...
#include <bits/stdc++.h> using namespace std; int fin = 0, ans = 0; bool vis[200050]; vector<int> v[200050]; int dfs(int x) { if (vis[x]) return 0; vis[x] = true; ans++; for (auto it : v[x]) if (!vis[it]) dfs(it); return 0; } int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i+...
insert
13
13
13
14
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> 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; } const int INF = 10010...
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> 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; } const int INF = 10010...
insert
41
41
41
42
0
p02573
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; struct UnionFind { vector<int> par; UnionFind(int N) { par ...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; struct UnionFind { vector<int> par; UnionFind(int N) { par ...
replace
51
52
51
52
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define ii pair<int, int> const int N = 1e5; int cnt[N]; vector<int> adj[N]; int n, m; bool visited[N]; void dfs(int u) { if (visited[u]) return; visited[u] = 1; int cur = 1; for (auto x : adj[u]) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define ii pair<int, int> const int N = 7e5 + 5; int cnt[N]; vector<int> adj[N]; int n, m; bool visited[N]; void dfs(int u) { if (visited[u]) return; visited[u] = 1; int cur = 1; for (auto x : adj[u]) { ...
replace
9
10
9
10
0
p02573
C++
Runtime Error
using namespace std; #include <bits/stdc++.h> #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll lo...
using namespace std; #include <bits/stdc++.h> #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll lo...
replace
8
10
8
10
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define inf 1e15 #define N 300005 string s; ll n, m, x, y, d, k; ll a[N]; ll parent[N]; ll siz[N]; int find(int g) { if (parent[g] != g) { parent[g] = find(parent[g]); } return g; } int main() { ios_ba...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define inf 1e15 #define N 300005 string s; ll n, m, x, y, d, k; ll a[N]; ll parent[N]; ll siz[N]; int find(int g) { if (parent[g] != g) { parent[g] = find(parent[g]); } return parent[g]; } int main() { ...
replace
22
23
22
23
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define mod 1000000007LL using namespace std; bool visited[1000000] = {0}; ll ans; ll c; void dfs(vector<vector<ll>> ans, ll n, ll pos) { if (visited[pos]) return; visited[pos] = 1; c++; for (auto i = ans[pos].begin(); i != ans[pos...
#include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define mod 1000000007LL using namespace std; bool visited[1000000] = {0}; ll ans; ll c; void dfs(vector<vector<ll>> &ans, ll n, ll pos) { if (visited[pos]) return; visited[pos] = 1; c++; for (auto i = ans[pos].begin(); i != ans[po...
replace
8
9
8
9
TLE
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define db double using namespace std; const int M = 2e5 + 10; int sz[M], fa[M], n, m; int find(int x) { return fa[x] == x ? x : find(fa[x]); } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) sz[i] = 1, fa[i] = i; for (int i = 0, x, y; i < m; i++)...
#include <bits/stdc++.h> #define ll long long #define db double using namespace std; const int M = 2e5 + 10; int sz[M], fa[M], n, m; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) sz[i] = 1, fa[i] = i; for (int i = 0, x, y; i <...
replace
6
7
6
7
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long // #define endl '\n' void max_self(int &a, int b) { a = max(a, b); } // void min_self(int &a, int b){a = min(a, b);} const int nax = 1e5 + 5; vector<int> G[nax], vis(nax); int cnt; void dfs(int node) { vis[node] = 1; cnt++; for (int i : G[node...
#include <bits/stdc++.h> using namespace std; #define ll long long // #define endl '\n' void max_self(int &a, int b) { a = max(a, b); } // void min_self(int &a, int b){a = min(a, b);} const int nax = 2e5 + 5; vector<int> G[nax], vis(nax); int cnt; void dfs(int node) { vis[node] = 1; cnt++; for (int i : G[node...
replace
9
10
9
10
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, a, b) for (ll i = (a); i <= (b); ++i) #define req(i, a, b) for (ll i = (a); i >= (b); --i) #define name "a" #define pb push_back #define sz size() #define ff first #define ss second #define xd '\n' #define dc " " #define Truong_Thanh_Minh...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, a, b) for (ll i = (a); i <= (b); ++i) #define req(i, a, b) for (ll i = (a); i >= (b); --i) #define name "a" #define pb push_back #define sz size() #define ff first #define ss second #define xd '\n' #define dc " " #define Truong_Thanh_Minh...
replace
17
18
17
18
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int MOD = (int)1e9 + 7; const double PI = 3.14159265358979323846; template <class T, class U> void chmin(T &t, const U &u) { if (t > u) t = u; } template <class T, class U> void chmax(T &t, co...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int MOD = (int)1e9 + 7; const double PI = 3.14159265358979323846; template <class T, class U> void chmin(T &t, const U &u) { if (t > u) t = u; } template <class T, class U> void chmax(T &t, co...
insert
24
24
24
26
0
p02573
C++
Runtime Error
// #pragma GCC optimize "trapv" //-D_GLIBCXX_DEBUG #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 pm(m) \ for (auto itr = (m).begin(); itr !...
// #pragma GCC optimize "trapv" //-D_GLIBCXX_DEBUG #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 pm(m) \ for (auto itr = (m).begin(); itr !...
replace
32
33
32
33
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, from, to) for (int i = from; i < (to); ++i) #define mp(x, y) make_pair(x, y) #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define pb push_back using ll = long long; using vin = vector<int>; using vll = vector<ll>;...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, from, to) for (int i = from; i < (to); ++i) #define mp(x, y) make_pair(x, y) #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define pb push_back using ll = long long; using vin = vector<int>; using vll = vector<ll>;...
replace
44
46
44
46
0
p02573
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; const int sz = 1e5 + 1; int p[sz], w[sz]; int get(int x) { return x == p[x] ? x : p[x] = get(p[x]); } void uni(int a, int b) { if (a == b) return; a < b ? p[b] = a : p[a] = b; w[a] = w[b] += w[a]; } int main() { int N, M, u, v; scanf("%d %d", ...
#include <algorithm> #include <cstdio> using namespace std; const int sz = 2e5 + 1; int p[sz], w[sz]; int get(int x) { return x == p[x] ? x : p[x] = get(p[x]); } void uni(int a, int b) { if (a == b) return; a < b ? p[b] = a : p[a] = b; w[a] = w[b] += w[a]; } int main() { int N, M, u, v; scanf("%d %d", ...
replace
4
5
4
5
0
p02573
C++
Runtime Error
#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>; ll mod = 1000000007; const int inf = 2147483647; const int MAX_N = 21000; const int MAX_W = 20100; /*************ここから**********************/ class union_find { public: ll N; ...
#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>; ll mod = 1000000007; const int inf = 2147483647; const ll MAX_N = 2100000; const ll MAX_W = 2010000; /*************ここから**********************/ class union_find { public: ll N;...
replace
7
9
7
9
0
p02573
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define repeat(i, n) for (int i = 0; (i) < (n); ++(i)) #define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i)) using namespace std; template <class T> void setmax(T &a, T ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define repeat(i, n) for (int i = 0; (i) < (n); ++(i)) #define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i)) using namespace std; template <class T> void setmax(T &a, T ...
replace
50
51
50
51
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for (int w = 0; w < (p); w++) #define fx(p) for (int x = 0; x < (p); x++) #define fy(p) for (int y = 0; y < (p); y++) #define fz(p) for (int z = 0; z < (p); z++) #define fyg(p, g) for (int y = (g); y < (p); y++) #define fzg(p, g) for (int...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for (int w = 0; w < (p); w++) #define fx(p) for (int x = 0; x < (p); x++) #define fy(p) for (int y = 0; y < (p); y++) #define fz(p) for (int z = 0; z < (p); z++) #define fyg(p, g) for (int y = (g); y < (p); y++) #define fzg(p, g) for (int...
replace
51
53
51
53
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define INIT \ ios_base ::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define INIT \ ios_base ::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); ...
replace
17
19
17
19
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> r; UnionFind(int N) { r = vector<int>(N, -1); } int root(int x) { if (r[x] < 0) return x; return root(r[x]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x > y) swap(x, y); if (x ...
#include <bits/stdc++.h> using namespace std; struct UnionFind { 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) { x = root(x); y = root(y); if (x > y) swap(x, y); ...
replace
11
12
11
12
TLE
p02573
C++
Runtime Error
#include <algorithm> #include <functional> #include <iostream> #include <string> using namespace std; #include <climits> #include <iomanip> #include <math.h> #include <queue> #include <set> #include <vector> using Graph = vector<vector<int>>; const double PI = 3.14159265358979323846; #define int long long const int S...
#include <algorithm> #include <functional> #include <iostream> #include <string> using namespace std; #include <climits> #include <iomanip> #include <math.h> #include <queue> #include <set> #include <vector> using Graph = vector<vector<int>>; const double PI = 3.14159265358979323846; #define int long long const int S...
replace
16
17
16
17
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define inf 1001001001 #define mod 1000000007 #define mod2 998244353 #define pi acos(-1) #define all(v) v.begin(), v.end() int dx[4] = {0, -1, 0, 1}; int dy[4] = {-1, 0, 1, 0}; ll gcd(ll a, ll b) {...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define inf 1001001001 #define mod 1000000007 #define mod2 998244353 #define pi acos(-1) #define all(v) v.begin(), v.end() int dx[4] = {0, -1, 0, 1}; int dy[4] = {-1, 0, 1, 0}; ll gcd(ll a, ll b) {...
replace
62
63
62
63
0
p02573
C++
Runtime Error
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> // #include<boost/multiprecision/cpp_int.hpp> // #include<boost/multiprecision/cpp_dec_float.hpp> // namespace mp=boost::multiprecision; // #define mulint mp::cpp_int // #define mulfloat mp::cpp_dec_float_100 using namespace std; struct __INIT { __INIT() { ci...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> // #include<boost/multiprecision/cpp_int.hpp> // #include<boost/multiprecision/cpp_dec_float.hpp> // namespace mp=boost::multiprecision; // #define mulint mp::cpp_int // #define mulfloat mp::cpp_dec_float_100 using namespace std; struct __INIT { __INIT() { ci...
replace
37
39
37
39
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define forn(i, a, b) for (int i = a; i < b; i++) #define fi first #define se second #define fast ios_base::sync_with_stdio(false); using namespace std; // for debugging /* g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 */ int recur_depth = 0; #if...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define forn(i, a, b) for (int i = a; i < b; i++) #define fi first #define se second #define fast ios_base::sync_with_stdio(false); using namespace std; // for debugging /* g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 */ int recur_depth = 0; #if...
replace
46
47
46
47
-11
p02573
C++
Runtime Error
// Problem : D - Friends // Contest : AtCoder - AtCoder Beginner Contest 177 // URL : https://atcoder.jp/contests/abc177/tasks/abc177_d // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) // #pragma GCC optimize("Ofast") // #pragma GCC target("avx,avx2,fma"...
// Problem : D - Friends // Contest : AtCoder - AtCoder Beginner Contest 177 // URL : https://atcoder.jp/contests/abc177/tasks/abc177_d // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) // #pragma GCC optimize("Ofast") // #pragma GCC target("avx,avx2,fma"...
replace
83
85
83
85
0
p02573
C++
Runtime Error
// AUTHOR: ROSHAN SRIVASTAVA // WEBSITE: https://www.youtube.com/channel/UC6uQdd7kLLOdlHSVklhV7Cw #include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 vector<int> G[100009]; bool vis[100009]; int solve(int x, int par) { vis[x] = true; int ans = 1; for (auto n : G[x]) { ...
// AUTHOR: ROSHAN SRIVASTAVA // WEBSITE: https://www.youtube.com/channel/UC6uQdd7kLLOdlHSVklhV7Cw #include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 vector<int> G[200009]; bool vis[200009]; int solve(int x, int par) { vis[x] = true; int ans = 1; for (auto n : G[x]) { ...
replace
8
10
8
10
-11
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(0); const double EPS = 1e-9; const double PI = acos(-1); const int knightDir[8...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(0); const double EPS = 1e-9; const double PI = acos(-1); const int knightDir[8...
replace
54
55
54
55
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; map<ll, ll> mp; vector<ll> v[100]; ll dfs(ll node) { if (mp[node] == 0) { mp[node]++; ll i, l = v[node].size(), s = 0; for (i = 0; i < l; i++) { s += dfs(v[node][i]); } return s + 1; } else { return 0; } } int ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; map<ll, ll> mp; vector<ll> v[1000000]; ll dfs(ll node) { if (mp[node] == 0) { mp[node]++; ll i, l = v[node].size(), s = 0; for (i = 0; i < l; i++) { s += dfs(v[node][i]); } return s + 1; } else { return 0; } } ...
replace
5
6
5
6
0
p02573
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct UnionFind { 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) { x = root(x); y = root(y); ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct UnionFind { 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) { x = root(x); y = root(y); ...
insert
26
26
26
27
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> // #define int ll typedef long long ll; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const int maxn = 2e5 + 10; using namespace std; int a[maxn], b[maxn]; int find_(int x) { return x == a[x] ? x : find_(a[x]); } void solve() { int n, m, max_ = 0; cin >> n >> m; for (int j = 0; ...
#include <bits/stdc++.h> // #define int ll typedef long long ll; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const int maxn = 2e5 + 10; using namespace std; int a[maxn], b[maxn]; int find_(int x) { return x == a[x] ? x : a[x] = find_(a[x]); } void solve() { int n, m, max_ = 0; cin >> n >> m; for (int ...
replace
10
11
10
11
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define bug cout << "ok" << endl const ll INF = 1e9 + 5, N = 500 + 5, mod = 1e9 + 7, M = 1e5 + 5; int p[N], sz[N]; void make_set(int v) { p[v] = v; sz[v] =...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define bug cout << "ok" << endl const ll INF = 1e9 + 5, N = 2e5 + 5, mod = 1e9 + 7, M = 1e5 + 5; int p[N], sz[N]; void make_set(int v) { p[v] = v; sz[v] =...
replace
9
10
9
10
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0)...
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0)...
replace
35
36
35
36
-11
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define vi vector<ll> #define vvi vector<vector<ll>> #define pii pair<ll, ll> #define pb push_back #define rep0(i, n) for (ll i = 0; i < n; i++) #define rep1(i, n) for (ll i = 1; i < n; i++) #define all(v) v.begin(), v.end() #define fast ...
#include <bits/stdc++.h> #define ll long long int #define vi vector<ll> #define vvi vector<vector<ll>> #define pii pair<ll, ll> #define pb push_back #define rep0(i, n) for (ll i = 0; i < n; i++) #define rep1(i, n) for (ll i = 1; i < n; i++) #define all(v) v.begin(), v.end() #define fast ...
replace
14
15
14
15
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define bit(a) __builtin_popcount(a) #define all(x) x.begin(), x.end() #define minv(v) *min_element(all(v)) #define maxv(v) *max_element(all(v)) #define unq(v) sort(all(v)), v.erase(unique(all(v)), v.end()) #define w(x) while (x--) #define rep(i, a, b) for (i = a; i <= b; i...
#include <bits/stdc++.h> using namespace std; #define bit(a) __builtin_popcount(a) #define all(x) x.begin(), x.end() #define minv(v) *min_element(all(v)) #define maxv(v) *max_element(all(v)) #define unq(v) sort(all(v)), v.erase(unique(all(v)), v.end()) #define w(x) while (x--) #define rep(i, a, b) for (i = a; i <= b; i...
replace
54
56
54
56
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <iostream> using namespace std; #define io \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define io \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie...
replace
34
35
34
35
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int mxn = 1e5 + 5; // check for forloop // intialize variable // overflow // go for easy solution #define mod 1000000007 ll INF = 1000000000000000005LL; #define endl '\n' void rishabh() { ios_base::sync_with_stdi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int mxn = 2e5 + 5; // check for forloop // intialize variable // overflow // go for easy solution #define mod 1000000007 ll INF = 1000000000000000005LL; #define endl '\n' void rishabh() { ios_base::sync_with_stdi...
replace
4
5
4
5
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 int parent_find(int x, vector<int> &parent) { while (parent[x] != x) { x = parent[x]; } return x; } void combine(int x, int y, vector<int> &parent, vector<int> &rank) { int t = parent_find(x, parent); int w = parent_find(y, parent); ...
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 int parent_find(int x, vector<int> &parent) { while (parent[x] != x) { x = parent[x]; } return x; } void combine(int x, int y, vector<int> &parent, vector<int> &rank) { int t = parent_find(x, parent); int w = parent_find(y, parent); ...
replace
15
17
15
23
TLE
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define N ((int)2e5 + 5) using namespace std; bool vis[N]; int dis[N]; vector<int> vec[N]; int bfs(int src) { memset(vis, 0, sizeof vis); int cnt = 1; queue<int> que; que.push(src); vis[src] = 1; dis[src] = 0; while (!que.empty()) { int a = que.front(); ...
#include <bits/stdc++.h> #define ll long long #define N ((int)2e5 + 5) using namespace std; bool vis[N]; int dis[N]; vector<int> vec[N]; int bfs(int src) { int cnt = 1; queue<int> que; que.push(src); vis[src] = 1; dis[src] = 0; while (!que.empty()) { int a = que.front(); que.pop(); for (int b : ...
delete
8
9
8
8
TLE
p02573
C++
Runtime Error
#include <stdio.h> typedef struct { int Parent, Rank; } UnionFind; UnionFind uft[100000]; static inline int Root(int x) { return (uft[x].Parent != x) ? uft[x].Parent = Root(uft[x].Parent) : x; } static inline int Unite(int x, int y) { x = Root(x), y = Root(y); if (x != y) uft[x].Parent = y, uft[y].Rank += u...
#include <stdio.h> typedef struct { int Parent, Rank; } UnionFind; UnionFind uft[200000]; static inline int Root(int x) { return (uft[x].Parent != x) ? uft[x].Parent = Root(uft[x].Parent) : x; } static inline int Unite(int x, int y) { x = Root(x), y = Root(y); if (x != y) uft[x].Parent = y, uft[y].Rank += u...
replace
4
5
4
5
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define w(x) \ int x; \ cin >> x; \ while (x--) #define ll long l...
#include <bits/stdc++.h> using namespace std; #define w(x) \ int x; \ cin >> x; \ while (x--) #define ll long l...
replace
17
19
17
19
0
p02573
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long; struct UnionFind { 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) { x = root(x); y = root(y); if (x == y...
#include "bits/stdc++.h" using namespace std; using ll = long long; struct UnionFind { 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) { x = root(x); y = root(y); if (x == y...
insert
36
36
36
37
-11
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define rep0(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(x) (x).begin(), (x).end() #define debug(a) \ if (flagdebug) { ...
#include <bits/stdc++.h> #define rep0(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(x) (x).begin(), (x).end() #define debug(a) \ if (flagdebug) { ...
replace
96
97
96
97
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MM = 1000000000; const int MOD = MM + 7; const int MAX = 510000; #define rep(i, n) for (ll i = 0; i < n; i++) #define Rep(i, j, n) for (ll i = j; i < n; i++) #define all(vec) vec.begin(), vec.end() template <class T> inline bool chmin(T &a, T...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MM = 1000000000; const int MOD = MM + 7; const int MAX = 510000; #define rep(i, n) for (ll i = 0; i < n; i++) #define Rep(i, j, n) for (ll i = j; i < n; i++) #define all(vec) vec.begin(), vec.end() template <class T> inline bool chmin(T &a, T...
replace
63
72
63
65
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define LL long long using namespace std; const int N = 2e6 + 1000; const LL P = 1e9 + 7; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0...
#include <bits/stdc++.h> #define LL long long using namespace std; const int N = 2e6 + 1000; const LL P = 1e9 + 7; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0...
replace
30
31
30
31
0
p02573
C++
Runtime Error
/* * @Author: dnhirapara * @Problem: abc177_d * @Time: 11-September-2020 : ( 16:17:57 ) */ #include <bits/stdc++.h> using namespace std; /************defination************/ #define endl "\n" #define logger(x) cout << __LINE__ << ": " << #x << " -> " << (x) << endl; #define ll long long int #define ull unsigned ...
/* * @Author: dnhirapara * @Problem: abc177_d * @Time: 11-September-2020 : ( 16:17:57 ) */ #include <bits/stdc++.h> using namespace std; /************defination************/ #define endl "\n" #define logger(x) cout << __LINE__ << ": " << #x << " -> " << (x) << endl; #define ll long long int #define ull unsigned ...
replace
16
18
16
18
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef long long ll; #define pb push_back #define fi first #define se second #define rep(i, a, b) for (int i = (a); i <= (int)(b); i++) #define per(i, a, b) for (int i = (a); i >= (int)(b); i--) const int mod = 1e9 + 7; c...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef long long ll; #define pb push_back #define fi first #define se second #define rep(i, a, b) for (int i = (a); i <= (int)(b); i++) #define per(i, a, b) for (int i = (a); i >= (int)(b); i--) const int mod = 1e9 + 7; c...
replace
11
12
11
12
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define sz(a) a.size() #define re return #define all(a) a.begin(), a.end() #define int long long using namespace std; const int dx[4] = {-1, 1, 0, 0}; const int dy[4] = {0, 0, -1, 1}; vector<int> v[100005]; int vis[100005]; int dfs(int now) { vis[now]...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define sz(a) a.size() #define re return #define all(a) a.begin(), a.end() #define int long long using namespace std; const int dx[4] = {-1, 1, 0, 0}; const int dy[4] = {0, 0, -1, 1}; vector<int> v[200005]; int vis[200005]; int dfs(int now) { vis[now]...
replace
10
12
10
12
0
p02573
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int getID(vector<int> &v, int idx) { if (v[idx] == -1) return -1; int cnt = 0; while (1) { if (v[idx] == idx) break; idx = v[idx]; if (cnt++ == 10000) break; } return idx; } int main() { int N, M; cin >> N >> M; vector<int> d(N,...
#include <bits/stdc++.h> using namespace std; int getID(vector<int> &v, int idx) { if (v[idx] == idx) return idx; v[idx] = getID(v, v[idx]); return v[idx]; } int main() { int N, M; cin >> N >> M; vector<int> d(N, 0); vector<int> v(N, -1); for (int i = 0; i < M; i++) { int s[2]; cin >> s[0]...
replace
4
15
4
8
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define fo(i, n) for (i = 0; i < n; i++) #define fo1(i, n) for (i = 1; i <= n; i++) #define foab(i, a, b) for (i = a; i <= b; i++) #define of(i, n) for...
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define fo(i, n) for (i = 0; i < n; i++) #define fo1(i, n) for (i = 1; i <= n; i++) #define foab(i, a, b) for (i = a; i <= b; i++) #define of(i, n) for...
replace
108
109
108
109
0
p02573
C++
Runtime Error
/// Bismillahir Rahmanir Rahim /* Mohammad Morsalin Dept of ICE, NSTU */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ll long long #define pb push_back #define mp make_pair #define endl "\n" #define int long long #define f0...
/// Bismillahir Rahmanir Rahim /* Mohammad Morsalin Dept of ICE, NSTU */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ll long long #define pb push_back #define mp make_pair #define endl "\n" #define int long long #define f0...
replace
70
72
70
72
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("O3") using ll = long long; using namespace std; #define pb push_back #define eb emplace_back #define F first #define S second #define ar array const int N = 1e5 + 9; vector<int> g[N]; bool used[N]; int val[N]; int n, m; int dfs(int u) { used[u] = 1; int y = 1; for ...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using ll = long long; using namespace std; #define pb push_back #define eb emplace_back #define F first #define S second #define ar array const int N = 2e5 + 9; vector<int> g[N]; bool used[N]; int val[N]; int n, m; int dfs(int u) { used[u] = 1; int y = 1; for ...
replace
10
11
10
11
0
p02573
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define foi(n) for (ll i = 0; i < n; i++) #define foj(n) for (ll j = 0; j < n; j++) #define pb push_back using namespace std; ll a[100005]; vector<ll> v[100005]; bool visited[100005] = {false}; void bfs(ll i, ll cnt) { visited[i] = true; a[i] = cnt; foj(v[i].size())...
#include <bits/stdc++.h> #define ll long long #define foi(n) for (ll i = 0; i < n; i++) #define foj(n) for (ll j = 0; j < n; j++) #define pb push_back using namespace std; ll a[200005]; vector<ll> v[200005]; bool visited[200005] = {false}; void bfs(ll i, ll cnt) { visited[i] = true; a[i] = cnt; foj(v[i].size())...
replace
7
10
7
10
0
p02573
C++
Runtime Error
// Problem : D - Friends // Contest : AtCoder - AtCoder Beginner Contest 177 // URL : https://atcoder.jp/contests/abc177/tasks/abc177_d // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define trace(...) __f(...
// Problem : D - Friends // Contest : AtCoder - AtCoder Beginner Contest 177 // URL : https://atcoder.jp/contests/abc177/tasks/abc177_d // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define trace(...) __f(...
replace
55
57
55
57
0
p02573
C++
Time Limit Exceeded
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
replace
65
82
65
67
TLE
p02573
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ll n, m, t, a[100005], ctr = 0, val[200005]; bool vis[200005]; vector<ll> adj[100005]; #define ari \ for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ll n, m, t, a[100005], ctr = 0, val[200005]; bool vis[200005]; vector<ll> adj[200005]; #define ari \ for (int i = 0; i < n; i++) ...
replace
6
7
6
7
0
p02573
C++
Runtime Error
/* power code taken from geeks for geeks */ // cout << setprecision (2) << fixed << 1.2; #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll INF = 1e18 + 5; const ll MAX_N = 2e5 + 5; const ll MODD = 1e9 + 7; const ld PI = 3.14159265358979323846; ll max(ll a, ll b) { ...
/* power code taken from geeks for geeks */ // cout << setprecision (2) << fixed << 1.2; #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll INF = 1e18 + 5; const ll MAX_N = 2e5 + 5; const ll MODD = 1e9 + 7; const ld PI = 3.14159265358979323846; ll max(ll a, ll b) { ...
replace
54
55
54
55
0