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
p02361
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <queue> #include <vector> #define INF 10000000000000000 #define ll long long using namespace std; int main() { ll V, E, r; cin >> V >> E >> r; vector<vector<pair<ll, ll>>> edges(V); for (ll i = 0; i < E; i++) { ll s, t, d; cin >> s >> t >> d; edges...
#include <algorithm> #include <iostream> #include <queue> #include <vector> #define INF 10000000000000000 #define ll long long using namespace std; int main() { ll V, E, r; cin >> V >> E >> r; vector<vector<pair<ll, ll>>> edges(V); for (ll i = 0; i < E; i++) { ll s, t, d; cin >> s >> t >> d; edges...
replace
20
21
20
21
TLE
p02361
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define INF (INT_MAX / 2) #define PI (2 * acos(0.0)) #define EPS (1e-8) #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) REP(i, 0, n) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typede...
#include <bits/stdc++.h> using namespace std; #define INF (INT_MAX / 2) #define PI (2 * acos(0.0)) #define EPS (1e-8) #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) REP(i, 0, n) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typede...
replace
32
33
32
33
TLE
p02361
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, j) for (int i = 0; i < (int)(j); i++) constexpr int INF = 1 << 28; struct Edge { int to; ll cost; Edge(int to, ll cost) : to(to), cost(cost) {} }; using EdgeList = vector<vector<Edge>>; using Vatex = int; constexpr ll INFL = 1LL <...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, j) for (int i = 0; i < (int)(j); i++) constexpr int INF = 1 << 28; struct Edge { int to; ll cost; Edge(int to, ll cost) : to(to), cost(cost) {} }; using EdgeList = vector<vector<Edge>>; using Vatex = int; constexpr ll INFL = 1LL <...
replace
18
19
18
19
TLE
p02361
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) typedef long long LL; int V, E, S; LL d[100001]; typedef pair<LL...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) typedef long long LL; int V, E, S; LL d[100001]; typedef pair<LL...
replace
21
22
21
22
TLE
p02361
C++
Memory Limit Exceeded
#include <algorithm> #include <iostream> #include <numeric> #include <queue> #include <vector> using namespace std; #define numof(array) (sizeof(array) / sizeof *(array)) const int INF = 1000000007; const int MAX_V = 10000007; typedef long long ll; typedef pair<int, int> P; // first: ???????????¢???second: ????????...
#include <algorithm> #include <iostream> #include <numeric> #include <queue> #include <vector> using namespace std; #define numof(array) (sizeof(array) / sizeof *(array)) const int INF = 1000000007; const int MAX_V = 1000007; typedef long long ll; typedef pair<int, int> P; // first: ???????????¢???second: ?????????...
replace
11
12
11
12
MLE
p02361
C++
Runtime Error
#include <bits/stdc++.h> #define INF 1000000000 using namespace std; typedef pair<int, int> pii; namespace MyLib { class Dijkstra { struct edge { int to, cost; edge(int to_, int cost_) : to(to_), cost(cost_) {} }; bool isdirected; vector<int> d; vector<vector<edge>> G; int V, E; public: Dijkstra...
#include <bits/stdc++.h> #define INF 1000000000 using namespace std; typedef pair<int, int> pii; namespace MyLib { class Dijkstra { struct edge { int to, cost; edge(int to_, int cost_) : to(to_), cost(cost_) {} }; bool isdirected; vector<int> d; vector<vector<edge>> G; int V, E; public: Dijkstra...
replace
18
19
18
19
-6
terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size()
p02361
C++
Runtime Error
#include <bits/stdc++.h> #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it, X) for (auto it = (X).begin(); it != (X).end(); it++) #define numa(x, a) for (auto x : a) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i, n) rep2(i, 0, n) #def...
#include <bits/stdc++.h> #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it, X) for (auto it = (X).begin(); it != (X).end(); it++) #define numa(x, a) for (auto x : a) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i, n) rep2(i, 0, n) #def...
replace
116
117
116
117
0
p02361
C++
Runtime Error
#include <iostream> #include <map> #include <memory> #include <queue> #include <string> #include <vector> using namespace std; int N, M; struct Edge { int src, dst, weight; Edge *next, *prev; Edge(int s, int d, int w, Edge *n, Edge *p) : src(s), dst(d), weight(w), next(n), prev(p) {} Edge() : Edge(0, 0...
#include <iostream> #include <map> #include <memory> #include <queue> #include <string> #include <vector> using namespace std; int N, M; struct Edge { int src, dst, weight; Edge *next, *prev; Edge(int s, int d, int w, Edge *n, Edge *p) : src(s), dst(d), weight(w), next(n), prev(p) {} Edge() : Edge(0, 0...
replace
19
20
19
20
0
p02361
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #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 srep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i) #define each(a, b) for (auto &(a) : ...
#include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #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 srep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i) #define each(a, b) for (auto &(a) : ...
replace
79
81
79
81
TLE
p02362
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <vector> using namespace std; int inf = 1000000000; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; struct Node { int to, from, cost; }; int main() { int n, m, r; cin >>...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <vector> using namespace std; int inf = 1000000000; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; struct Node { int to, from, cost; }; int main() { int n, m, r; cin >>...
replace
34
35
34
35
TLE
p02362
C++
Time Limit Exceeded
#include <iostream> #include <vector> #define INF 50000000000000 std::vector<int> G[100000]; struct edge { int from, to, cost; }; int V, E, r; bool negativeflag = false; bool possiblity[100000]; edge es[500000]; long long int d[100000]; void shortest_path(int s); bool negative_path(int s); bool reachable(int v); int ...
#include <iostream> #include <vector> #define INF 50000000000000 std::vector<int> G[100000]; struct edge { int from, to, cost; }; int V, E, r; bool negativeflag = false; bool possiblity[100000]; edge es[500000]; long long int d[100000]; void shortest_path(int s); bool negative_path(int s); bool reachable(int v); int ...
insert
70
70
70
71
TLE
p02362
C++
Memory Limit Exceeded
#include <algorithm> #include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; typedef pair<long long, int> P; #define MAX_N 150000 #define INF 100000000000000 priority_queue<P, vector<P>, greater<P>> Q; vector<pair<int, long long>> X[MAX_N]; int N, M, A, B, C, O; long long dis...
#include <algorithm> #include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; typedef pair<long long, int> P; #define MAX_N 150000 #define INF 100000000000000 priority_queue<P, vector<P>, greater<P>> Q; vector<pair<int, long long>> X[MAX_N]; int N, M, A, B, C, O; long long dis...
replace
24
25
24
25
MLE
p02362
C++
Runtime Error
/*ベルマンフォード法自作ライブラリ*/ /*標準:単一始点からの他の全頂点への最短距離 & 閉ループ判定 * ,option1:単一始点&終点の最短距離。&辞書順経路復元,option2:経路復元(非辞書順)*/ #include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define dump1d_arr(array) \ RE...
/*ベルマンフォード法自作ライブラリ*/ /*標準:単一始点からの他の全頂点への最短距離 & 閉ループ判定 * ,option1:単一始点&終点の最短距離。&辞書順経路復元,option2:経路復元(非辞書順)*/ #include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define dump1d_arr(array) \ RE...
replace
41
43
41
42
0
roop_count => 0 roop_count => 1
p02362
C++
Runtime Error
#include <algorithm> #include <array> #include <climits> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <queue> #include <string> #include <vector> using namespace std; const double pi = 4 * atan(1.0); using cWeightEdges = std::vector<std::vec...
#include <algorithm> #include <array> #include <climits> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <queue> #include <string> #include <vector> using namespace std; const double pi = 4 * atan(1.0); using cWeightEdges = std::vector<std::vec...
replace
107
108
107
108
0
sh: 1: pause: not found
p02362
C++
Runtime Error
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #i...
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #i...
insert
103
103
103
104
0
p02362
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; #define int ll signed main() { using pii = pair<int, int>; using piii = pair<pii, int>; int v, e, s; cin >> v >> e >> s; vector<int> d(v, LLONG_MAX); vector<piii> edge; rep(i, e) { int fr...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; #define int ll signed main() { using pii = pair<int, int>; using piii = pair<pii, int>; int v, e, s; cin >> v >> e >> s; vector<int> d(v, LLONG_MAX); vector<piii> edge; rep(i, e) { int fr...
replace
33
34
33
34
0
p02362
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> #include <vector> #define INF 999999999 #define ll long long using namespace std; const int MAX_N = 1000; const int MAX_M = 2000; struct edge { int from; //????????? int to; //??°?????? int cost; //?????? }; int d[MAX_N]; edge es[MAX_M]; bool flag; //??????????????????...
#include <cstdio> #include <iostream> #include <vector> #define INF 999999999 #define ll long long using namespace std; const int MAX_N = 1000; const int MAX_M = 2000; struct edge { int from; //????????? int to; //??°?????? int cost; //?????? }; int d[MAX_N]; edge es[MAX_M]; bool flag; //??????????????????...
insert
40
40
40
41
TLE
p02362
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <vector> #define shosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<P> vp; typedef vector<vp> vvp; typ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <vector> #define shosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<P> vp; typedef vector<vp> vvp; typ...
replace
29
30
29
30
0
p02362
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; const int MAXN = 1005, INF = 1e9; int d[MAXN], x[MAXN], y[MAXN], w[MAXN]; int n, m, r; bool bellman_ford(int r) { fill(d, d + n, INF); d[r] = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) d[y[j]] = min(d[y[j]], d[x[j]] + w[j])...
#include <algorithm> #include <iostream> using namespace std; const int MAXN = 2005, INF = 1e9; int d[MAXN], x[MAXN], y[MAXN], w[MAXN]; int n, m, r; bool bellman_ford(int r) { fill(d, d + n, INF); d[r] = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) d[y[j]] = min(d[y[j]], d[x[j]] + w[j])...
replace
5
6
5
6
0
p02362
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS // #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, const vector<T> &); template <size_t n, class... T> typename enable_if<(n >= sizeof...(T))>::type _ot(ostream &, c...
#define _CRT_SECURE_NO_WARNINGS // #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, const vector<T> &); template <size_t n, class... T> typename enable_if<(n >= sizeof...(T))>::type _ot(ostream &, c...
insert
89
89
89
90
TLE
p02362
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 1005; struct edge { int to, cost; }; int n, m, s, cnt[maxn]; int d[maxn]; int qh, qt, q[maxn * maxn]; bool ok = 1, inq[maxn]; vector<edge> G[maxn]; int main() { cin >> n >> m >> s; for (int i = 0; i ...
#include <bits/stdc++.h> #define pb push_back using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 1005; struct edge { int to, cost; }; int n, m, s, cnt[maxn]; int d[maxn]; int qh, qt, q[maxn * maxn]; bool ok = 1, inq[maxn]; vector<edge> G[maxn]; int main() { cin >> n >> m >> s; for (int i = 0; i ...
insert
44
44
44
48
0
p02362
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(const int &x) { to = x; return *this; } operator int() ...
#include <bits/stdc++.h> using namespace std; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(const int &x) { to = x; return *this; } operator int() ...
replace
60
61
60
61
-11
p02362
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef long long LL; typedef long double LD; const LL INF = (1LL << 60); typedef pair<LL, int> PLL; bool bellman_ford(int n, vector<PLL> adjList[], int source, vector<LL> &dist); int main() { ios_base::sync_wi...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef long long LL; typedef long double LD; const LL INF = (1LL << 60); typedef pair<LL, int> PLL; bool bellman_ford(int n, vector<PLL> adjList[], int source, vector<LL> &dist); int main() { ios_base::sync_wi...
replace
71
72
71
72
TLE
p02362
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; #define MAX_V 1000 #define MAX_E 2000 #define INF 1e9 struct edge { int from, to, cost; }; int V, E; int d[MAX_V]; edge es[MAX_E]; bool find_negative_loop(int s) { for (int i = 0; i < MAX_V; i++) { d[i] = INF; } d[s] = 0; int count = 0; // bool ...
#include <iostream> #include <vector> using namespace std; #define MAX_V 1000 #define MAX_E 2000 #define INF 1e9 struct edge { int from, to, cost; }; int V, E; int d[MAX_V]; edge es[MAX_E]; bool find_negative_loop(int s) { for (int i = 0; i < MAX_V; i++) { d[i] = INF; } d[s] = 0; int count = 0; // bool ...
replace
20
21
20
21
TLE
p02363
C++
Runtime Error
#include <cstdint> #include <iostream> #include <vector> using namespace std; using s64 = int64_t; constexpr s64 INF = 1'010'000'000'000'000'000LL; template <typename T, typename U> bool chmin(T &xmin, const U &x) { if (x < xmin) { xmin = x; return true; } else { return false; } } #define FOR(i, ...
#include <cstdint> #include <iostream> #include <vector> using namespace std; using s64 = int64_t; constexpr s64 INF = 1'010'000'000'000'000'000LL; template <typename T, typename U> bool chmin(T &xmin, const U &x) { if (x < xmin) { xmin = x; return true; } else { return false; } } #define FOR(i, ...
replace
58
67
58
61
0
0 0 0 0
p02363
C++
Memory Limit Exceeded
#include <algorithm> #include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; typedef pair<long long, long long> P; #define MAX_N 1000 #define INF 1000000000000000LL vector<P> X[MAX_N]; priority_queue<P, vector<P>, greater<P>> Q; long long dist[MAX_N]; long long N, M, A, B, C;...
#include <algorithm> #include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; typedef pair<long long, long long> P; #define MAX_N 1000 #define INF 1000000000000000LL vector<P> X[MAX_N]; priority_queue<P, vector<P>, greater<P>> Q; long long dist[MAX_N]; long long N, M, A, B, C;...
replace
28
29
28
29
MLE
p02363
C++
Runtime Error
// #define MYDEBUG #include <bits/stdc++.h> using namespace std; #ifdef MYDEBUG #define dbp(x) cout << #x << ": " << x << endl #define dbp2(x, y) cout << #x << "," << #y << ": " << x << "," << y << endl #define dbp3(x, y, z) \ cout << #x << "," << #y << "," <<...
// #define MYDEBUG #include <bits/stdc++.h> using namespace std; #ifdef MYDEBUG #define dbp(x) cout << #x << ": " << x << endl #define dbp2(x, y) cout << #x << "," << #y << ": " << x << "," << y << endl #define dbp3(x, y, z) \ cout << #x << "," << #y << "," <<...
replace
57
60
57
60
0
p02363
C++
Runtime Error
/* "A quote? by me? hell no!" */ #include <algorithm> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define F first #define S second #define ll long long #define int ll #define fast() ios::sync_with_stdio(...
/* "A quote? by me? hell no!" */ #include <algorithm> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define F first #define S second #define ll long long #define int ll #define fast() ios::sync_with_stdio(...
replace
41
42
41
42
0
p02363
C++
Runtime Error
#include <algorithm> // other #include <bitset> #include <cassert> // c #include <complex> #include <fstream> #include <functional> #include <iomanip> #include <iostream> // io #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <vector> // container using name...
#include <algorithm> // other #include <bitset> #include <cassert> // c #include <complex> #include <fstream> #include <functional> #include <iomanip> #include <iostream> // io #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <vector> // container using name...
replace
185
186
185
186
-11
p02363
C++
Runtime Error
#include <algorithm> #include <array> #include <cstdio> #include <functional> #include <iostream> #include <list> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define _USE_MATH_DEFINES #include <map> #include <math.h> #define SENTINEL 1...
#include <algorithm> #include <array> #include <cstdio> #include <functional> #include <iostream> #include <list> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define _USE_MATH_DEFINES #include <map> #include <math.h> #define SENTINEL 1...
replace
37
38
37
38
0
p02364
C++
Runtime Error
#include <queue> #include <stdio.h> #include <vector> using namespace std; struct side { int n; int m; int l; }; side sides[100000]; void mergesort(int l, int r) { if (l == r) return; side temp; if (l == r - 1) { if (sides[l].l > sides[r].l) { temp = sides[l]; sides[l] = sides[r]; ...
#include <queue> #include <stdio.h> #include <vector> using namespace std; struct side { int n; int m; int l; }; side sides[100000]; void mergesort(int l, int r) { if (l == r) return; side temp; if (l == r - 1) { if (sides[l].l > sides[r].l) { temp = sides[l]; sides[l] = sides[r]; ...
insert
51
51
51
55
0
p02364
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using edge = tuple<int, int, int>; struct UnionFind { vector<int> data; UnionFind(int size) : data(size, -1) {} void unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; ...
#include <bits/stdc++.h> using namespace std; using edge = tuple<int, int, int>; struct UnionFind { vector<int> data; UnionFind(int size) : data(size, -1) {} void unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; ...
insert
26
26
26
30
0
p02364
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct UF { int N, par[100], sz[100]; void init(int _N) { N = _N; for (int i = 0; i < N; i++) { par[i] = i; sz[i] = 1; } } int find(int x) { return x == par[x] ? x : par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); ...
#include <bits/stdc++.h> using namespace std; struct UF { int N, par[10000], sz[10000]; void init(int _N) { N = _N; for (int i = 0; i < N; i++) { par[i] = i; sz[i] = 1; } } int find(int x) { return x == par[x] ? x : par[x] = find(par[x]); } void unite(int x, int y) { x = find(x...
replace
4
5
4
5
0
p02364
C++
Runtime Error
/* *******************Bismillahir Rahmanir Rahim************************ MD. ASFAKUL GHANI! *ProMAGFAT*! SECRET_warning :)->FAT CSE-25! JAHANGIRNAGAR UNIVERSITY! Dhaka,Bangladesh! */ #include <bits/stdc++.h> ...
/* *******************Bismillahir Rahmanir Rahim************************ MD. ASFAKUL GHANI! *ProMAGFAT*! SECRET_warning :)->FAT CSE-25! JAHANGIRNAGAR UNIVERSITY! Dhaka,Bangladesh! */ #include <bits/stdc++.h> ...
replace
51
53
51
53
0
p02364
C++
Runtime Error
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; #define MV 10000 #define INF 1e9 struct edge { int to, cost; }; vector<edge> G[MV]; bool used[MV]; int V, E; int d[MV]; int prim() { for (int i = 0; i < V; i++) { d[i] = INF; used[i] = false; } d[0] = 0; ...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; #define MV 10000 #define INF 1e9 struct edge { int to, cost; }; vector<edge> G[MV]; bool used[MV]; int V, E; int d[MV]; int prim() { for (int i = 0; i < V; i++) { d[i] = INF; used[i] = false; } d[0] = 0; ...
replace
36
38
36
38
-11
p02364
C++
Runtime Error
#include <algorithm> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <st...
#include <algorithm> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <st...
replace
27
28
27
28
0
p02364
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; struct Edge { int P1; int P2; int Wei; }; int main(void) { vector<Edge> EdgeCol; int V, E; cin >> V >> E; if (V == 1) cout << 1; vector<int> Select(V, 0); for (int i = 0; i < E; ++i) { int s, t...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; struct Edge { int P1; int P2; int Wei; }; int main(void) { vector<Edge> EdgeCol; int V, E; cin >> V >> E; if (V == 1) { cout << 0 << endl; return 0; } vector<int> Select(V, 0); for (int i = 0...
replace
17
19
17
21
0
p02364
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> #include <string> #include <vector> using namespace std; #define in...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> #include <string> #include <vector> using namespace std; #define in...
replace
27
28
27
28
0
p02364
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; #include <chrono> //????????? #pragma region MACRO #define putans(x) \ std::cerr << "[ answer ]: "; \ cout << (x) << endl #define dputans(x) ...
#include "bits/stdc++.h" using namespace std; #include <chrono> //????????? #pragma region MACRO #define putans(x) \ std::cerr << "[ answer ]: "; \ cout << (x) << endl #define dputans(x) ...
replace
204
205
204
205
0
p02364
C++
Runtime Error
#include <assert.h> #include <stdio.h> namespace beet { template <typename T> void swap(T &a, T &b) { T x = a; a = b; b = x; } template <typename T> struct Vector { int sz, cap; T *data; Vector() : sz(0), cap(1) { data = new T[cap]; } Vector(int sz) : sz(sz), cap(sz << 1) { data = new T[cap]; } Vecto...
#include <assert.h> #include <stdio.h> namespace beet { template <typename T> void swap(T &a, T &b) { T x = a; a = b; b = x; } template <typename T> struct Vector { int sz, cap; T *data; Vector() : sz(0), cap(1) { data = new T[cap]; } Vector(int sz) : sz(sz), cap(sz << 1) { data = new T[cap]; } Vecto...
insert
59
59
59
62
0
p02364
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; const int INF = 1145141919, MOD = 1e9 + 7; const long long LINF = 8931145141919364364, LMOD = 998244353; // const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1}; const int VMAX = 1...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; const int INF = 1145141919, MOD = 1e9 + 7; const long long LINF = 8931145141919364364, LMOD = 998244353; // const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1}; const int VMAX = 1...
insert
13
13
13
15
0
p02364
C++
Memory Limit Exceeded
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <vector> #define shosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<P> vp; typedef vector<vp> vvp; typ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <vector> #define shosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<P> vp; typedef vector<vp> vvp; typ...
replace
29
30
29
30
MLE
p02364
C++
Runtime Error
#include <algorithm> #include <queue> #include <stdio.h> using namespace std; const int V_MAX = 100; const int INF = 100000000; struct Edge { bool operator<(const Edge &e) const { return w > e.w; } int to; int w; }; int main() { int v; int e; priority_queue<Edge> edge[V_MAX]; vector<int> tree; bool c...
#include <algorithm> #include <queue> #include <stdio.h> using namespace std; const int V_MAX = 10000; const int INF = 100000000; struct Edge { bool operator<(const Edge &e) const { return w > e.w; } int to; int w; }; int main() { int v; int e; priority_queue<Edge> edge[V_MAX]; vector<int> tree; bool...
replace
5
6
5
6
0
p02364
C++
Runtime Error
// ????????????????????°??????: ??£??\????????? // Library #include <algorithm> #include <cassert> #include <functional> #include <queue> #include <vector> // Type typedef int Vertex; typedef int Weight; struct Edge { Vertex from, to; Weight weight; }; bool operator<(const Edge &lhs, const Edge &rhs) { if (lhs.w...
// ????????????????????°??????: ??£??\????????? // Library #include <algorithm> #include <cassert> #include <functional> #include <queue> #include <vector> // Type typedef int Vertex; typedef int Weight; struct Edge { Vertex from, to; Weight weight; }; bool operator<(const Edge &lhs, const Edge &rhs) { if (lhs.w...
insert
48
48
48
50
0
p02364
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define TemplateVersion "3.2.0" // Useful Marcos //====================START===================== // Compile use C++11 and above #ifdef LOCAL #define debug(args...) \ { ...
#include <bits/stdc++.h> using namespace std; #define TemplateVersion "3.2.0" // Useful Marcos //====================START===================== // Compile use C++11 and above #ifdef LOCAL #define debug(args...) \ { ...
replace
110
111
110
111
0
p02364
C++
Runtime Error
#include <bits/stdc++.h> #define rep(n) for (int i = 0; i < n; i++) #define repp(j, n) for (int j = 0; j < n; j++) #define reppp(i, m, n) for (int i = m; i < n; i++) #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define debug(x) cerr << #x << ": " << x << endl using namespace std; typedef lo...
#include <bits/stdc++.h> #define rep(n) for (int i = 0; i < n; i++) #define repp(j, n) for (int j = 0; j < n; j++) #define reppp(i, m, n) for (int i = m; i < n; i++) #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define debug(x) cerr << #x << ": " << x << endl using namespace std; typedef lo...
replace
52
53
52
53
0
p02364
C++
Runtime Error
#include <algorithm> #include <bitset> #include <iostream> #include <numeric> #include <queue> #include <vector> using namespace std; const int kInfinity = 0x3F3F3F3F; const int kNil = -1; const int kMaxV = 110; template <class T> struct Edge { using w_type = T; Edge(int u, int v, w_type w) : u(u), v(v), w(w) {}...
#include <algorithm> #include <bitset> #include <iostream> #include <numeric> #include <queue> #include <vector> using namespace std; const int kInfinity = 0x3F3F3F3F; const int kNil = -1; const int kMaxV = 10010; template <class T> struct Edge { using w_type = T; Edge(int u, int v, w_type w) : u(u), v(v), w(w) ...
replace
11
12
11
12
0
p02365
C++
Runtime Error
#include <bits/stdc++.h> using Int = int64_t; using UInt = uint64_t; using C = std::complex<double>; #define rep(i, n) for (Int i = 0; i < (Int)(n); ++i) #define guard(x) \ if (not(x)) \ ...
#include <bits/stdc++.h> using Int = int64_t; using UInt = uint64_t; using C = std::complex<double>; #define rep(i, n) for (Int i = 0; i < (Int)(n); ++i) #define guard(x) \ if (not(x)) \ ...
replace
27
28
27
33
0
p02366
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) int const INF = 1 << 29; typedef vector<int> edges; typedef vector<edges> graph; namespace articulation { int const MaxNum = 1000; int prenum[MaxNum]; int lowest[MaxNum]; int parent[...
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) int const INF = 1 << 29; typedef vector<int> edges; typedef vector<edges> graph; namespace articulation { int const MaxNum = 100000; int prenum[MaxNum]; int lowest[MaxNum]; int paren...
replace
14
15
14
15
0
p02366
C++
Runtime Error
/* ??¢?????? lowlink */ #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(c) c.begin(), c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x, y) x = ...
/* ??¢?????? lowlink */ #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(c) c.begin(), c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x, y) x = ...
replace
15
16
15
16
0
p02366
C++
Runtime Error
#include <iostream> #include <set> #include <vector> using namespace std; const int MAX_V = 100000; vector<int> G[MAX_V]; int vertex, edge; bool visited[MAX_V]; int prenum[MAX_V], parent[MAX_V], lowest[MAX_V]; int timer; set<int> ap; void dfs(int current, int prev) { prenum[current] = lowest[current] = timer; ti...
#include <iostream> #include <set> #include <vector> using namespace std; const int MAX_V = 100000; vector<int> G[MAX_V]; int vertex, edge; bool visited[MAX_V]; int prenum[MAX_V], parent[MAX_V], lowest[MAX_V]; int timer; set<int> ap; void dfs(int current, int prev) { prenum[current] = lowest[current] = timer; ti...
replace
56
57
56
57
0
p02367
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() template <typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; } template <typename A, typenam...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() template <typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; } template <typename A, typenam...
replace
37
38
37
39
TLE
p02367
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rrep2(i, a, b) for (int i = (b)-1; i >= (a); i--) #define al...
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rrep2(i, a, b) for (int i = (b)-1; i >= (a); i--) #define al...
replace
183
184
183
187
0
2 3
p02367
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, x, y) for (int i = (x); i < (y); ++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf = 1e9; const int64_t in...
#include <bits/stdc++.h> using namespace std; #define rep(i, x, y) for (int i = (x); i < (y); ++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf = 1e9; const int64_t in...
delete
99
101
99
99
0
[0,1,2,3,] [0,0,0,3,]
p02367
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #de...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #de...
replace
67
68
67
68
-11
p02367
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:...
#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:...
replace
80
81
80
81
0
p02367
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stdio.h> #include <vector> using namespace std; struct edge { int f, t; }; const int V_MAX = (int)1e5 + 10; vector<int> edges[V_MAX]; int ord[V_MAX]; int low[V_MAX]; bool used_v[V_MAX]; vector<edge> ans; bool comp(edge e1, edge e2) {...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stdio.h> #include <vector> using namespace std; struct edge { int f, t; }; const int V_MAX = (int)1e5 + 10; vector<int> edges[V_MAX]; int ord[V_MAX]; int low[V_MAX]; bool used_v[V_MAX]; vector<edge> ans; bool comp(edge e1, edge e2) {...
replace
62
63
62
64
-11
p02368
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; const int MAX_N = 10000; const int V = 10000; vector<int> G[MAX_N]; vector<int> rG[MAX_N]; vector<int> vs; //??°????????????????????? bool used[MAX_N]; //?????§???????????????????????? int cmp[MAX_N...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; const int MAX_N = 10000; const int V = 10000; vector<int> G[MAX_N]; vector<int> rG[MAX_N]; vector<int> vs; //??°????????????????????? bool used[MAX_N]; //?????§???????????????????????? int cmp[MAX_N...
replace
68
69
68
69
0
p02368
C++
Runtime Error
/* * Strongly Connected Components * A direced graph is strongly connected if every two nodes are reachable from * each other. In a strongly connected component of a directed graph, every two * nodes of the component are mutually reachable. * * Input * A directed graph G(V,E) and a sequence of queries where each...
/* * Strongly Connected Components * A direced graph is strongly connected if every two nodes are reachable from * each other. In a strongly connected component of a directed graph, every two * nodes of the component are mutually reachable. * * Input * A directed graph G(V,E) and a sequence of queries where each...
replace
68
69
68
69
0
p02368
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, b) for (int i = 0; i < int(b); i++) #define eb emplace_back using Weight = int; struct Edge { int src, dst; Weight weight; Edge(int src_, int dst_, Weight weight_) : src(src_), dst(dst_), weight(weight_) {} }; bool operator<(const Edge &e, const ...
#include <bits/stdc++.h> using namespace std; #define rep(i, b) for (int i = 0; i < int(b); i++) #define eb emplace_back using Weight = int; struct Edge { int src, dst; Weight weight; Edge(int src_, int dst_, Weight weight_) : src(src_), dst(dst_), weight(weight_) {} }; bool operator<(const Edge &e, const ...
replace
29
30
29
30
0
p02368
C++
Runtime Error
#include <algorithm> // other #include <bitset> #include <cassert> // c #include <complex> #include <fstream> #include <functional> #include <iomanip> #include <iostream> // io #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #include <stack> #inclu...
#include <algorithm> // other #include <bitset> #include <cassert> // c #include <complex> #include <fstream> #include <functional> #include <iomanip> #include <iostream> // io #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #include <stack> #inclu...
replace
240
241
240
241
0
1 1 0 0 0
p02368
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #inclu...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #inclu...
replace
101
111
101
111
0
p02368
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using VI = vector<int>; using VVI = vector<VI>; using PII = pair<int, int>; using LL = long long; using VL = vector<LL>; using VVL = vector<VL>; using PLL = pair<LL, LL>; using VS = vector<string>; #define ALL(a) begin((a)), end((a)) #define RALL(a) (a).rbegin(), (a).rend...
#include <bits/stdc++.h> using namespace std; using VI = vector<int>; using VVI = vector<VI>; using PII = pair<int, int>; using LL = long long; using VL = vector<LL>; using VVL = vector<VL>; using PLL = pair<LL, LL>; using VS = vector<string>; #define ALL(a) begin((a)), end((a)) #define RALL(a) (a).rbegin(), (a).rend...
replace
113
114
113
114
0
p02368
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; // typedef tuple<int, int, int> T; #define FOR(i, s, x) for (int i = s; i < (int)(x); i++) #define REP(i, x) FOR(i, 0, x) #define ALL(c) c.begin(), c.end() #define DUMP(x)...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; // typedef tuple<int, int, int> T; #define FOR(i, s, x) for (int i = s; i < (int)(x); i++) #define REP(i, x) FOR(i, 0, x) #define ALL(c) c.begin(), c.end() #define DUMP(x)...
replace
25
26
25
26
0
p02369
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> adj[101]; bitset<101> mark; bool Cyc; void dfs(int x) { if (mark[x]) Cyc = 1; if (Cyc) return; mark[x] = 1; for (int i = 0; i < adj[x].size(); i++) dfs(adj[x][i]); mark[x] = 0; } int main() { cin >> n >> m; for (int i = 0;...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> adj[101]; bitset<101> mark; bool Cyc; void dfs(int x) { if (mark[x]) Cyc = 1; if (Cyc) return; mark[x] = 1; for (int i = 0; i < adj[x].size(); i++) dfs(adj[x][i]); mark[x] = 0; } int main() { cin >> n >> m; for (int i = 0;...
replace
27
28
27
28
TLE
p02369
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; struct vertex { vector<int> E; // cost,to }; #define MAX_V 100 #define MAX_E 1000 bool isVisited[MAX_V]; bool isChecked[MAX_V]; vertex V[MAX_V]; bool rec(int i) { isVisited[i] = true; isChecked[i] = true; for (aut...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; struct vertex { vector<int> E; // cost,to }; #define MAX_V 100 #define MAX_E 1000 bool isVisited[MAX_V]; bool isChecked[MAX_V]; vertex V[MAX_V]; bool rec(int i) { isVisited[i] = true; isChecked[i] = true; for (aut...
replace
21
22
21
22
TLE
p02369
C++
Time Limit Exceeded
#include <bitset> #include <stdio.h> #include <vector> using namespace std; #define PB push_back const int N = 1e2 + 10; bitset<N> went, in; vector<int> graph[N]; bool f = true; void dfs(int now) { if (in[now]) { f = false; return; } in[now] = true; went[now] = true; for (int i = 0; i < graph[now].siz...
#include <bitset> #include <stdio.h> #include <vector> using namespace std; #define PB push_back const int N = 1e2 + 10; bitset<N> went, in; vector<int> graph[N]; bool f = true; void dfs(int now) { if (in[now]) { f = false; return; } else if (went[now]) return; in[now] = true; went[now] = true; fo...
replace
13
14
13
15
TLE
p02369
C++
Time Limit Exceeded
#include <algorithm> #include <climits> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; vector<int> edges[1000]; bool used[100]; bool active[100]; bool dfs(int cur) { active[cur] = true; used[cur] = tru...
#include <algorithm> #include <climits> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; vector<int> edges[1000]; bool used[100]; bool active[100]; bool dfs(int cur) { active[cur] = true; used[cur] = tru...
insert
22
22
22
25
TLE
p02369
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define MAX_V 100 using namespace std; typedef long long ll; vector...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define MAX_V 100 using namespace std; typedef long long ll; vector...
replace
31
34
31
34
TLE
p02369
C++
Memory Limit Exceeded
#include <iostream> #include <queue> #include <vector> using namespace std; vector<int> X[10000]; int N, M, A, B; bool ok = false; queue<char> Q; int main() { cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A >> B; if (A > B) { ok = true; } X[A].push_back(B); } if (ok == false) { c...
#include <iostream> #include <queue> #include <vector> using namespace std; vector<int> X[10000]; int N, M, A, B; bool ok = false; queue<char> Q; int main() { cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A >> B; if (A > B) { ok = true; } X[A].push_back(B); } if (ok == false) { c...
replace
26
27
26
27
MLE
p02369
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int V, E; bool dfs(vector<vector<int>> &G, int u, vector<int> &color) { color[u] = 1; for (auto v : G[u]) { if (color[v] == 1) return true; if (dfs(G, v, color)) return true; } color[u] = 2; return false; } int main() { cin >> V >> E; ve...
#include <bits/stdc++.h> using namespace std; int V, E; bool dfs(vector<vector<int>> &G, int u, vector<int> &color) { color[u] = 1; for (auto v : G[u]) { if (color[v] == 1) return true; if (color[v] == 2) continue; if (dfs(G, v, color)) return true; } color[u] = 2; return false...
insert
10
10
10
12
TLE
p02369
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int N, M; vector<int> G[100]; bool used[100]; bool dfs(int p, int s) { used[p] = true; bool ret = false; for (int i = 0; i < G[p].size(); i++) { int to = G[p][i]; if (to == s) return true; ret |= dfs(to, s); } return ret; } int main() { cin ...
#include <bits/stdc++.h> using namespace std; int N, M; vector<int> G[100]; bool used[100]; bool dfs(int p, int s) { used[p] = true; bool ret = false; for (int i = 0; i < G[p].size(); i++) { int to = G[p][i]; if (to == s) return true; if (used[to]) continue; ret |= dfs(to, s); } ...
insert
13
13
13
15
0
p02369
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include ...
replace
50
51
50
51
TLE
p02370
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; vector<int> edge[110]; int h[110]; int V; int E; int main() { cin >> V; cin >> E; for (int i = 0; i < E; i++) { int s; int t; cin >> s ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; vector<int> edge[10010]; int h[10010]; int V; int E; int main() { cin >> V; cin >> E; for (int i = 0; i < E; i++) { int s; int t; cin >...
replace
10
12
10
12
0
p02370
C++
Runtime Error
#include <algorithm> #include <iostream> #include <list> #include <queue> #include <vector> using namespace std; static const int MAX = 100000; static const int INFTY = (1 << 29); vector<int> G[MAX]; list<int> out; bool V[MAX]; int N; int indeg[MAX]; void bfs(int s) { queue<int> q; q.push(s); V[s] = true; whi...
#include <algorithm> #include <iostream> #include <list> #include <queue> #include <vector> using namespace std; static const int MAX = 100000; static const int INFTY = (1 << 29); vector<int> G[MAX]; list<int> out; bool V[MAX]; int N; int indeg[MAX]; void bfs(int s) { queue<int> q; q.push(s); V[s] = true; whi...
replace
39
40
39
40
-11
p02370
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <queue> #include <string> #include <vector> using namespace std; const int INF = 1 << 30; const int NIL = -1; const int MAXV = 10005; const int MAXE = 100005; struct Edge { int to, next; } edge[MAX...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <queue> #include <string> #include <vector> using namespace std; const int INF = 1 << 30; const int NIL = -1; const int MAXV = 10005; const int MAXE = 100005; struct Edge { int to, next; Edge() {...
insert
17
17
17
18
TLE
p02370
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; vector<int> E[100]; int in[100]; bool used[100]; int main() { int v, e; scanf("%d%d", &v, &e); rep(i, e) { int s, t; scanf("%d%d", &s, &t); E[s].push_back(t); in[t]++; } list<int> ls; queue<int> que;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; vector<int> E[10000]; int in[10000]; bool used[10000]; int main() { int v, e; scanf("%d%d", &v, &e); rep(i, e) { int s, t; scanf("%d%d", &s, &t); E[s].push_back(t); in[t]++; } list<int> ls; queue<int...
replace
4
7
4
7
0
p02370
C++
Runtime Error
#include <iostream> #include <queue> #include <stack> #include <vector> using namespace std; static const long long FAR = (1LL << 29); static const int N = 100; int n, m; bool visited[N]; int p[N]; vector<int> G[N]; vector<int> sorted; void bs(int i) { queue<int> q; q.push(i); visited[i] = true; while (!q...
#include <iostream> #include <queue> #include <stack> #include <vector> using namespace std; static const long long FAR = (1LL << 29); static const int N = 100000; int n, m; bool visited[N]; int p[N]; vector<int> G[N]; vector<int> sorted; void bs(int i) { queue<int> q; q.push(i); visited[i] = true; while ...
replace
8
9
8
9
0
p02370
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; #define N 100 static const long long FAR = (1L << 31); static const int WHITE = 0; static const int GRAY = 1; static const int BLACK = 2; vector<int>...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; #define N 100000 static const long long FAR = (1L << 31); static const int WHITE = 0; static const int GRAY = 1; static const int BLACK = 2; vector<i...
replace
11
12
11
12
0
p02370
C++
Memory Limit Exceeded
#include <bits/stdc++.h> #define N 1000000 using namespace std; queue<int> S; // ??\???????????????????????¨??????????????? vector<int> in[N]; // ??\?????? vector<int> out[N]; // ????????? vector<int> G[N]; // ??\?????????????????????????????\??? void init(int V) { // ?????°??????????????° for (int i = 0; ...
#include <bits/stdc++.h> #define N 10005 using namespace std; queue<int> S; // ??\???????????????????????¨??????????????? vector<int> in[N]; // ??\?????? vector<int> out[N]; // ????????? vector<int> G[N]; // ??\?????????????????????????????\??? void init(int V) { // ?????°??????????????° for (int i = 0; i ...
replace
1
2
1
2
MLE
p02370
C++
Runtime Error
#include <stdio.h> #include <vector> using namespace std; const int V_MAX = 1000; int main() { int v, e; int table[V_MAX] = {0}; vector<int> edge[V_MAX]; vector<int> ans; scanf("%d %d", &v, &e); for (int i = 0; i < e; i++) { int s, t; scanf("%d %d", &s, &t); edge[s].push_back(t); table[t...
#include <stdio.h> #include <vector> using namespace std; const int V_MAX = 10000; int main() { int v, e; int table[V_MAX] = {0}; vector<int> edge[V_MAX]; vector<int> ans; scanf("%d %d", &v, &e); for (int i = 0; i < e; i++) { int s, t; scanf("%d %d", &s, &t); edge[s].push_back(t); table[...
replace
4
5
4
5
0
p02370
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAXN = 1010; typedef vector<int> vec; typedef vector<vec> Graph; Graph G(MAXN); vec d(MAXN); int main() { int n, e; scanf("%d%d", &n, &e); for (int i = 0; i < e; i++) { int s, t; scanf("%d%d", &s, &t); G[s].push_back(t); d[t]++; } qu...
#include <bits/stdc++.h> using namespace std; const int MAXN = 10010; typedef vector<int> vec; typedef vector<vec> Graph; Graph G(MAXN); vec d(MAXN); int main() { int n, e; scanf("%d%d", &n, &e); for (int i = 0; i < e; i++) { int s, t; scanf("%d%d", &s, &t); G[s].push_back(t); d[t]++; } q...
replace
4
5
4
5
0
p02370
C++
Time Limit Exceeded
#include <iostream> #include <list> #include <vector> #define N 10000 using namespace std; list<int> l; bool color[N] = {false}; vector<int> adj[N]; int n; void topo(int k) { for (int i = 0; i < adj[k].size(); i++) topo(adj[k][i]); if (!color[k]) l.push_front(k); color[k] = true; } int main(void) { i...
#include <iostream> #include <list> #include <vector> #define N 10000 using namespace std; list<int> l; bool color[N] = {false}; vector<int> adj[N]; int n; void topo(int k) { for (int i = 0; i < adj[k].size(); i++) { if (!color[adj[k][i]]) topo(adj[k][i]); } if (!color[k]) l.push_front(k); color...
replace
12
14
12
16
TLE
p02370
C++
Runtime Error
// O(|E| + |V|) #include <algorithm> #include <cassert> #include <queue> #include <vector> using namespace std; class TopologicalSort { #define MAX_V 101 private: struct Edge { int to; Edge(int to) : to(to) {} }; int V; vector<Edge> G[MAX_V]; public: TopologicalSort(int V) : V(V) { if (V >= ...
// O(|E| + |V|) #include <algorithm> #include <cassert> #include <queue> #include <vector> using namespace std; class TopologicalSort { #define MAX_V 10001 private: struct Edge { int to; Edge(int to) : to(to) {} }; int V; vector<Edge> G[MAX_V]; public: TopologicalSort(int V) : V(V) { if (V >...
replace
11
12
11
12
0
p02371
C++
Runtime Error
#include <iostream> #include <utility> #include <vector> using namespace std; struct edge { int src; int dst; int weight; }; using graph = vector<vector<edge>>; pair<int, int> visit(int v, int parent, const graph &G) { pair<int, int> r(0, v); for (const auto &e : G[v]) { if (e.dst == parent) { c...
#include <iostream> #include <utility> #include <vector> using namespace std; struct edge { int src; int dst; int weight; }; using graph = vector<vector<edge>>; pair<int, int> visit(int v, int parent, const graph &G) { pair<int, int> r(0, v); for (const auto &e : G[v]) { if (e.dst == parent) { c...
replace
34
35
34
35
0
p02371
C++
Runtime Error
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408 #include <iostream> #include <queue> #include <vector> using namespace std; struct Tree { int N, diameter; vector<vector<pair<int, int>>> E; vector<int> d; // ある点からの距離, -1なら未探索を表す Tree(int n) : N(n), E(n), d(n){}; // 辺を追加する // void addPoint(int ...
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408 #include <iostream> #include <queue> #include <vector> using namespace std; struct Tree { int N, diameter; vector<vector<pair<int, int>>> E; vector<int> d; // ある点からの距離, -1なら未探索を表す Tree(int n) : N(n), E(n), d(n){}; // 辺を追加する // void addPoint(int ...
replace
44
45
44
45
0
p02371
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n; const int MAX = 100000; const int INF = 123456789; vector<pair<int, int>> G[MAX]; bool vis[MAX]; int d[MAX]; int maxv; void bfs(int s) { for (int i = 0; i < n; i++) d[i] = INF; queue<int> q; q.push(s); d[s] = 0; while (!q.empty()) { int u = q.fron...
#include <bits/stdc++.h> using namespace std; int n; const int MAX = 100000; const int INF = 123456789; vector<pair<int, int>> G[MAX]; bool vis[MAX]; int d[MAX]; int maxv; void bfs(int s) { for (int i = 0; i < n; i++) d[i] = INF; queue<int> q; q.push(s); d[s] = 0; while (!q.empty()) { int u = q.fron...
replace
54
55
54
55
0
p02371
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; // --------------------- // repetition #define FOR(i, a, b) for (...
#include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; // --------------------- // repetition #define FOR(i, a, b) for (...
replace
77
83
77
83
0
farv = 3 d[farv] = 5 d[0] = 0 d[1] = 2 d[2] = 3 d[3] = 5
p02371
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<stri...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<stri...
replace
47
48
47
48
0
p02371
C++
Runtime Error
#include <algorithm> #include <climits> #include <iostream> #include <list> #include <queue> #include <set> #include <vector> using namespace std; static const int MAX = 100000; static const int INFTY = 1 << 29; class edge { public: int t, w; edge() {} edge(int t, int w) : t(t), w(w) {} }; vector<edge> g[MAX]; ...
#include <algorithm> #include <climits> #include <iostream> #include <list> #include <queue> #include <set> #include <vector> using namespace std; static const int MAX = 100000; static const int INFTY = 1 << 29; class edge { public: int t, w; edge() {} edge(int t, int w) : t(t), w(w) {} }; vector<edge> g[MAX]; ...
replace
36
37
36
37
TLE
p02371
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; void dfs1(int &u, int nowcost, int &dis, int node, vector<bool> &used, vector<vector<pair<int, int>>> &adj) { used[node] = true; if (dis < nowcost) { dis = nowcost; u = node; } // cout << node << " " << nowcost << endl; for (int i = 0; i < (int)...
#include <bits/stdc++.h> using namespace std; void dfs1(int &u, int nowcost, int &dis, int node, vector<bool> &used, vector<vector<pair<int, int>>> &adj) { used[node] = true; if (dis < nowcost) { dis = nowcost; u = node; } // cout << node << " " << nowcost << endl; for (int i = 0; i < (int)...
replace
40
41
40
41
0
p02371
C++
Runtime Error
#include <iostream> #include <queue> #include <vector> using namespace std; static const int MAX = 10000; static const int INFTY = (1 << 20); int n; int d[MAX]; class Edge { public: int t, w; Edge() {} Edge(int t, int w) : t(t), w(w) {} }; vector<Edge> G[MAX]; void bfs(int s) { for (int i = 0; i < n; i++) {...
#include <iostream> #include <queue> #include <vector> using namespace std; static const int MAX = 100000; static const int INFTY = (1 << 20); int n; int d[MAX]; class Edge { public: int t, w; Edge() {} Edge(int t, int w) : t(t), w(w) {} }; vector<Edge> G[MAX]; void bfs(int s) { for (int i = 0; i < n; i++) ...
replace
5
6
5
6
0
p02371
C++
Runtime Error
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; static const int MAX = 100000; vector<pair<int, int>> graph[MAX]; vector<int> bfs(int start) { vector<int> d(MAX, 0); vector<bool> discovered(MAX, false); queue<int> visiting; visiting.push(start); discovered...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; static const int MAX = 100000; vector<pair<int, int>> graph[MAX]; vector<int> bfs(int start) { vector<int> d(MAX, 0); vector<bool> discovered(MAX, false); queue<int> visiting; visiting.push(start); discovered...
replace
39
40
39
40
0
p02371
C++
Memory Limit Exceeded
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include ...
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include ...
replace
48
49
48
49
MLE
p02371
C++
Runtime Error
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string...
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string...
replace
47
49
47
49
0
p02371
C++
Runtime Error
// 木の直径 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; #define MAX_N 100 const int WHITE = 0; // 未訪問 const int GRAY = 1; // 訪問中 const int BLACK = 2; // 訪問完了 const int INV = -1; typedef struct...
// 木の直径 #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; #define MAX_N 100000 const int WHITE = 0; // 未訪問 const int GRAY = 1; // 訪問中 const int BLACK = 2; // 訪問完了 const int INV = -1; typedef str...
replace
12
13
12
13
0
p02371
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back #define INF 999999999 #define MAX_V 100 struct edge { int to, weight; }; vector<edge> G[MAX_V]; pii dfs(int ...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back #define INF 999999999 #define MAX_V 100000 struct edge { int to, weight; }; vector<edge> G[MAX_V]; pii dfs(i...
replace
9
10
9
10
0
p02371
C++
Runtime Error
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std...
insert
39
39
39
44
0
p02371
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); vector<vector<pair<int, int>>> g(n); for (int i = 0; i < n - 1; i++) {...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); vector<vector<pair<int, int>>> g(n); for (int i = 0; i < n - 1; i++) {...
insert
21
21
21
25
0
p02371
C++
Runtime Error
#include <algorithm> #include <stdio.h> #include <vector> using namespace std; const int V_MAX = 100; struct Edge { int v; int w; }; int solve(vector<Edge> graph[], int v, int prev, int n, int &m) { int first = 0; int second = 0; for (int i = 0; i < graph[v].size(); i++) { if (graph[v][i].v == prev) ...
#include <algorithm> #include <stdio.h> #include <vector> using namespace std; const int V_MAX = 100000; struct Edge { int v; int w; }; int solve(vector<Edge> graph[], int v, int prev, int n, int &m) { int first = 0; int second = 0; for (int i = 0; i < graph[v].size(); i++) { if (graph[v][i].v == prev...
replace
5
6
5
6
0