Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> G[maxn];
int pre[maxn], lowlink[maxn], sccno[maxn], dfs_clock, scc_cnt;
stack<int> S;
void dfs(int u) {
pre[u] = lowlink[u] = ++dfs_clock;
S.push(u);
for (int i = 0; i < G[u].size(); i++) {
int v = G[u][i];
if (!pre[v]) {... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 105000;
struct Edge {
int nex, y;
} e[maxn * 2];
int lis[maxn], cnt;
vector<int> V[maxn];
int n, m, top, tim, tot, ans;
int belong[maxn], st[maxn], dfn[maxn], low[maxn], f[maxn];
bool flag, instack[maxn], v[maxn];
inline void addedge(int x, int y) {
e[+... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
inline void in(int &MAGNUS) { scanf("%d", &MAGNUS); }
inline void out(int MAGNUS) { printf("%d\n", MAGNUS); }
inline void in(int &MAGNUS, int &CLAR) { scanf("%d%d", &MAGNUS, &CLAR); }
inline void out(int MAGNUS, int CLAR) { printf("%d %d\n", MAGNUS, CLAR); }
inline void inl(long long &LIV) { sc... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
vector<int> g[MAXN], gg[MAXN];
int used[MAXN], col[MAXN], cnt[MAXN], bad[MAXN];
void dfs1(int s, int cl) {
int i, to;
used[s] = 1;
col[s] = cl;
cnt[cl]++;
for (i = 0; i < (int)gg[s].size(); i++) {
to = gg[s][i];
if (!used[to]) {
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int fa[maxn], siz[maxn];
bool hav[maxn];
int find(int x) { return fa[x] ? fa[x] = find(fa[x]) : x; }
bool merge(int a, int b) {
a = find(a);
b = find(b);
if (a == b) {
return false;
}
fa[b] = a;
siz[a] += siz[b];
siz[b] = 0;
retu... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
InputS... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1e+14;
const int MAXN = 120000;
vector<vector<int> > orient;
vector<vector<int> > nonori;
vector<vector<int> > comps;
vector<char> cl;
int compcnt;
int cycle_st;
bool used[MAXN];
void dfscomp(int v) {
used[v] = true;
comps[compcnt].push_back(v);
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.util.Arrays;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collections;
import java.io.IOException;
import java.util.StringTokenizer;
/... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, nxt;
} e[100005];
int head[100005], cnte, n, m;
void adde(int u, int v) {
e[++cnte] = (edge){v, head[u]};
head[u] = cnte;
}
int fa[100005];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) {
if ((x = fin... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = int(1e5) + 10;
const int INF = int(2e9);
vector<int> graph[N], g[N];
int arr[N], dep[N], T;
int visited[N], vis[N];
bool cycle;
vector<int> cmp;
void dfs(int u) {
arr[u] = T++;
visited[u] = 1;
for (int i = 0; i < (int)(graph[u].size()); i++) {
int w ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200002;
vector<int> e[MAXN];
vector<int> eo[MAXN];
bool w[MAXN];
int cnt = 0;
vector<int> tout;
int g[MAXN], gc;
void dfs(int v) {
if (w[v]) return;
w[v] = true;
for (int i = 0; i < e[v].size(); i++) {
dfs(e[v][i]);
}
tout.push_back(v);
}
void... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> nei[maxn], nei2[maxn];
int n, m, cnt;
bool cycle = false;
int col[maxn];
int mark[maxn], ans;
bool cmp[maxn];
void dfs(int v) {
col[v] = ans;
mark[v] = 1;
for (auto u : nei[v])
if (!mark[u]) dfs(u);
}
void dfs2(int v) {
mar... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, ok, k, v[100005], x, y, ans;
vector<int> a[100005], b[100005], c;
bitset<100005> w;
void udfs(int x) {
w[x] = 1;
vector<int>::iterator it;
c.push_back(x);
for (it = b[x].begin(); it != b[x].end(); ++it)
if (!w[*it]) udfs(*it);
}
void dfs(int x) {
v[x... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
vector<int> adj[MAXN];
vector<int> bi_adj[MAXN];
int N, M;
int lbl = 0;
int comp[MAXN];
int sz[MAXN];
bool vis[MAXN];
bool iscyc[MAXN];
int in[MAXN];
void dfs(int cur, int x) {
vis[cur] = true;
comp[cur] = x;
++sz[x];
for (int nxt : bi_adj[c... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
bool jo, hibas[100001];
int n, m, ki, a, b, volt[100001], t[100001], tdb;
vector<int> v[100001], v2[100001];
void mely2(int p) {
volt[p] = 1;
for (int i = 0; i < v[p].size(); i++) {
if (volt[v[p][i]] == 0) mely2(v[p][i]);
}
t[p] = tdb--;
}
void mely(int p) {
i... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> g(1000000 + 2);
long long id[1000005], idx, deg[1000005], fa[1000005], tag[1000005];
long long find(long long x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void merge(long long x, long long y) {
x = find(x);
y = find(y);
fa[x] = y;
}
vo... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 200000;
int n, m, x, y, ans = 0, r[N], deg[N];
bool vis[N];
vector<int> g[N];
vector<int> v[N];
int find(int x) {
if (x == r[x]) {
return r[x];
}
return r[x] = find(r[x]);
}
void join(int x, int y) {
x = find(x);
y = find(y);
r[y] = x;
}
int ma... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); }
long long power(long long a, long long n) {
long long p = 1;
while (n > 0) {
if (n % 2) {
p = p * a;
}
n >>= 1;
a *= a;
}
return p;
}
const i... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int N, M;
vector<int> adj[MAXN];
int par[MAXN], indeg[MAXN];
bool hascyc[MAXN];
int find(int x) { return x == par[x] ? x : par[x] = find(par[x]); }
int main() {
if (fopen("input.txt", "r")) {
freopen("input.txt", "r", stdin);
}
ios::sync_w... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100 * 1000 + 10;
vector<int> from[MAX_N], to[MAX_N];
vector<int> topol, cmp[MAX_N];
vector<int> vec[MAX_N];
int color[MAX_N];
bool mark[MAX_N];
void dfs_topol(int u) {
mark[u] = true;
for (auto v : from[u])
if (!mark[v]) dfs_topol(v);
topol.push_... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct sx {
int from, to, last;
};
struct sl {
sx line[N], fl[2 * N];
int last[N], color[N], sta[N], top, num, fnum, dfn[N], low[N], tot, colornum,
fla[N], pointnum[N];
bool c[N], cc[N];
void add(int x, int y) {
line[++num].to = y;
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct edge {
int b, nt;
};
struct graph {
edge e[100010 * 2];
int p[100010], nn;
void anode(int x, int y) {
nn++;
e[nn].b = y;
e[nn].nt = p[x];
p[x] = nn;
}
} G1, G2;
int n, m;
int dfn[100010], low[100010], tt, num[100010];
int bl, num_scc, scc[10... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
int nodes[MAX_N + 10], to[MAX_N + 10], nxt[MAX_N + 10], en;
int n;
inline void addEdge(int f, int t) {
++en;
to[en] = t;
nxt[en] = nodes[f];
nodes[f] = en;
}
int low[MAX_N + 10], dfn[MAX_N + 10], clo;
int cn;
bool inS[MAX_N + 10];
stack<int... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, m, sz, c[N], ans;
bool used[N];
vector<int> g[N], gg[N], gr[N], t, all, cc;
void dfs(int v) {
all.push_back(v);
used[v] = 1;
for (auto to : gg[v])
if (!used[to]) dfs(to);
}
void dfs_t(int v) {
used[v] = 1;
for (auto to : g[v])
if ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
using vv = vector<vector<T>>;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
os << "{";
for (int(i) = 0; (i) < (t.size()); ++(i)) {
os << t[i] << ",";
}
os << "}" << endl;
return os;
}
template <class S, class T>
o... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int N, M, pt, last, num, tot, ans;
int px[100010], py[100010];
int st[100010], ne[200010], go[200010];
int dfn[100010], low[100010], sta[100010], vis[100010], ss[100010],
mark[100010];
void Add(int x, int y) {
ne[++pt] = st[x];
st[x] = pt;
go[pt] = y;
}
void tarja... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 9;
const long long mod = 1e9 + 7;
vector<int> g[maxn], comp[maxn];
int par[maxn], vis[maxn];
bool f;
int root(int v) { return ((par[v] + 1) ? par[v] = root(par[v]) : v); }
void merge(int v, int u) {
v = root(v);
u = root(u);
if (v == u) return;
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> adj[N];
int p[N], cycle[N], sz[N];
bool vis[N], instack[N];
int fin(int i) {
if (p[i] != i) p[i] = fin(p[i]);
return p[i];
}
void merge(int x, int y) {
int px = fin(x), py = fin(y);
if (px == py) return;
p[px] = py;
sz[py] += sz... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<int> c[100050];
int com[100050];
vector<int> g[100050];
vector<int> gra[100050];
int deg[100050];
int find(int s) { return com[s] == s ? s : com[s] = find(com[s]); }
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) com[i] = i;
for (i... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1 << 17;
int cc = 0;
vector<int> T;
struct node {
bool seen[2];
vector<int> N[2];
int c = -2;
} G[maxN];
struct component {
bool seen;
vector<int> N;
int sz = 0;
} D[maxN];
void DFS(int v, int d) {
G[v].seen[d] = true;
for (int u : G[v].N[d]... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
std::vector<bool> seen;
std::vector<int> in_degree;
std::vector<std::vector<int>> G, H, ccs;
void dfs(const int& u, std::vector<int>& cc) {
seen[u] = true;
cc.push_back(u);
for (auto& v : H[u]) {
if (!seen[v]) {
dfs(v, cc);
}
}
}
int solve(const std::vector<int>& cc) {
i... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long LN = (long long)(5e6), LK = (long long)(1e6),
INF = (long long)(1e18), MOD = (long long)(1e9) + 7;
long long N, M, ind, ans, tcount, tcomp;
vector<vector<int> > adj;
vector<set<int> > adj1;
struct SNode {
int disc, low, component;
bool vi... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<int> gph[100005], rev[100005];
bool ok[100005];
int n, m;
vector<int> dfn;
int vis[100005], comp[100005], csz[100005], piv;
void dfs(int x) {
if (vis[x]) return;
vis[x] = 1;
for (auto &i : gph[x]) {
dfs(i);
}
dfn.push_back(x);
}
void rdfs(int x, int p) ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int par[MAXN], sub[MAXN];
void Init() {
for (int i = 0; i < MAXN; ++i) par[i] = i;
}
int Get(int vr) { return par[vr] == vr ? vr : par[vr] = Get(par[vr]); }
void Merge(int a, int b) { par[Get(a)] = Get(b); }
void SetSub() {
for (int i = 0; i < M... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxm = 1e7 + 9;
const int maxn = 2e5 + 9;
const int N = 1000 + 9;
const int mod = 20100403;
const int inf = 0x3f3f3f3f;
const int base = 131;
const double eps = 1e-4;
int n, m;
struct Edge {
int to, from;
} edge[maxn];
int last[maxn], cnt = 0;
bool vis[maxn];
in... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
Task solver = ... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long MXN = 2e3 + 10;
const long long MX5 = 2e5 + 10;
const long long MX6 = 1e6 + 10;
const long long LOG = 20;
const long long INF = 8e18;
const double eps = 1e-9;
const long long MOD = 1e9 + 7;
long long power(long long a, long long b, long long md) {
return (... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.util.List;
import java.util.Arrays;
import java.util.Scanner;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author mongsiry013
*/
public cl... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
return (out << "(" << a.first << "; " << a.second << ")");
}
const int nmax = 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
const long long i... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> nei[maxn], nei2[maxn];
int n, m, cnt;
bool cycle = false;
int col[maxn];
int mark[maxn], ans;
bool cmp[maxn];
void dfs(int v) {
col[v] = ans;
mark[v] = 1;
for (auto u : nei[v]) {
if (!mark[u]) {
dfs(u);
}
}
}
void... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
T r;
while (b != 0) {
r = a % b;
a = b;
b = r;
}
return a;
}
template <class T>
T lcm(T a, T b) {
return a / gcd(a, b) * b;
}
template <class T>
int getbit(T s, int i) {
return (s >> i) & 1;
}
template <class T>
T... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
bool visited[MAXN], recStack[MAXN];
vector<int> adj[MAXN], kel[MAXN];
int par[MAXN];
int find(int x) {
if (par[x] == x) return x;
return par[x] = find(par[x]);
}
void join(int a, int b) { par[find(a)] = find(b); }
bool dfs(int now) {
visited[n... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
vector<int> g[mx];
int cmp[mx], ncc = 0;
stack<int> st;
int color[mx], idx[mx], low[mx], sz[mx], t = 0;
void dfs(int u) {
color[u] = 1;
idx[u] = low[u] = t++;
st.push(u);
for (int i = 0; i < int(g[u].size()); i++) {
int v = g[u][i];
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 7;
int NUMBER_OF_WAYS, n, m, u, vertex, conectivity_marker[MAX + 1], component,
teleport_marker[MAX + 1], components[MAX + 1];
vector<int> conectivity[MAX + 1], teleport[MAX + 1];
void DEE_EF_ES(int source) {
conectivity_marker[source] = componen... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 5;
int root[MAX_N];
int find(int u) {
if (root[u] != u) {
root[u] = find(root[u]);
}
return root[u];
}
void merge(int u, int v) {
u = find(u);
v = find(v);
root[u] = v;
}
vector<int> out_adj[MAX_N];
int vis[MAX_N];
int has_cyc[MAX_N];... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAX_V = 200010;
int V, E;
int C[MAX_V], vis[MAX_V];
bool cir[MAX_V];
vector<int> g[MAX_V], gg[MAX_V];
int cnt;
void color(int u) {
C[u] = cnt;
for (int i = 0; i < gg[u].size(); ++i) {
int vv = gg[u][i];
if (!C[vv]) color(vv);
}
}
void visit(int u) {
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, used[123456];
vector<long long> g[123456], rg[123456], vs;
int cmp[123456], cmpsize[123456];
void add_edge(int from, int to) {
g[from].push_back(to);
rg[to].push_back(from);
}
void dfs(int v) {
used[v] = 1;
for (int i = 0; i < g[v].size(); i++)
if (!us... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | def main():
n, m = map(int, input().split())
cluster, dest, avail, ab = list(range(n)), [0] * n, [True] * n, [[] for _ in range(n)]
def getroot(x):
while x != cluster[x]:
x = cluster[x]
return x
def setroot(x, r):
if r < x != cluster[x]:
setroot(cluster[... | PYTHON3 |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int u[100100], v[100100];
int root[100100], cnt[100100], ord[100100];
int find_root(int u) { return u == root[u] ? u : root[u] = find_root(root[u]); }
void merge(int u, int v) {
u = find_root(u);
v = find_root(v);
if (u != v) root[v] = u;
}
vector<vector<int> > adj[10... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int f[100005];
int n, m;
vector<int> e[100005];
queue<int> que;
int F(int x) {
if (f[x] == x) return x;
return f[x] = F(f[x]);
}
bool H[100005];
int lt[100005];
bool vis[100005];
int deg[100005];
void func() {
while (!que.empty()) {
int cnt = que.front();
que.... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
int n, m;
int edge[100100][2];
int elist[200100];
int es[200100];
int en[100100];
int chk[100100];
int comp[100100];
int pn[100100];
int cn;
int q[100100];
int qs, qe;
int ans;
int flag;
void dfs(int loc) {
int i;
chk[loc] = 1;
comp[cn] = loc;
cn++;
for (i = en[loc]; i < en[loc + 1]; ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool ylmin(T &a, T b) {
return a < b ? 0 : (a = b, 1);
}
template <class T>
inline bool ylmax(T &a, T b) {
return a > b ? 0 : (a = b, 1);
}
template <class T>
inline T abs(T x) {
return x < 0 ? -x : x;
}
inline char read() {
static const in... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, rt[100100], x[100100], y[100100];
int find_rt(int u) { return rt[u] == u ? u : rt[u] = find_rt(rt[u]); }
void link(int u, int v) {
u = find_rt(u), v = find_rt(v);
if (u != v) rt[u] = v;
}
vector<int> adj[100100], edge[100100], node[100100];
int C, col[100100],... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n, m, ans, stt, st[N], high[N], h[N];
vector<int> adj1[N], adj2[N], t;
stack<int> s;
bool on[N], mark1[N], mark2[N], flag;
void DFS1(int v) {
t.push_back(v);
mark1[v] = 1;
for (int i = 0; i < adj1[v].size(); i++) {
int u = adj1[v][i];
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> edge;
int n, m;
int parent[100000];
int size[100000];
int visited[100000];
int finished[100000];
int has_loop[100000];
int find_root(int v) {
if (parent[v] == -1) {
return v;
}
return parent[v] = find_root(parent[v]);
}
void merge(int u, int v)... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
long long r = 1 % P;
for (a %= P; n; a = a * a % P, n >>= 1)
if (n & 1) r = r * a % P;
return r;
}
long long inv(long long x... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
stack<int> st;
int cmpcnt, n, m, res;
vector<int> g[(1 << 17)], gt[(1 << 17)], f[(1 << 17)];
int vis[(1 << 17)], comp[(1 << 17)], cmpsize[(1 << 17)], in[(1 << 17)],
out[(1 << 17)];
void dfs(int x) {
vis[x] = 1;
for (int i = 0; i < g[x].size(); i++)
if (!vis[g[x]... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
int n, m, iTime;
stack<int> st;
vector<bool> inSt;
vector<int> disc, low, szScc, inScc;
vector<vector<int> > gr, adj;
void dfs(int u) {
disc[u] = low[u] = ++iTime;
st.emplace(u);
inSt[u] = true;
for (int v : gr[u]) {
if (!disc[v]) {
d... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int f[131072], in[131072], s[131072];
vector<int> adj[131072], c[131072];
int getf(int cur) {
if (f[cur] != cur) f[cur] = getf(f[cur]);
return f[cur];
}
int main() {
int N, M, i, j, a, b, cur, S, E, RES;
cin >> N >> M;
for (i = 1; i <= N; i++) f[i] = i;
for (i =... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
int inp() {
char c = getchar();
while (c < '0' || c > '9') c = getchar();
int sum = 0;
while (c >= '0' && c <= '9') {
sum = sum * 10 + c - '0';
c = getchar();
}
return sum;
}
int head[100010], nxt[200010], end[200010], fa[100010];
int dfn[100010], low[100010], st[100010], cn... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 50;
int n, m;
int parent[N];
int vis1[N], vis2[N], tag[N], flag[N];
vector<int> v[N];
int root(int x) {
if (parent[x] == -1 || parent[x] == x)
return x;
else
return parent[x] = root(parent[x]);
}
void merge(int x, int y) {
x = root(x);
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
void fre() {
freopen("c://test//input.in", "r", stdin);
freopen("c://test//output.out", "w", stdout);
}
template <class T>
inline void gmax(T &a, T b) {
if (b > a) a = b;
}
template <class T>
inline void gmin(T &a, T b) {
if (b < a) a = b;
}
using namespace std;
const int N = 1e5 + 10, ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int N, M, C, cycle, stat[100011];
vector<int> id[100011];
vector<int> adj[100011];
vector<int> adj2[100011];
void dfs(int x) {
id[C].push_back(x);
stat[x] = C;
for (int i = 0; i < (int)adj2[x].size(); i++)
if (!stat[adj2[x][i]]) dfs(adj2[x][i]);
}
void dfs2(int x)... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
void SieveOfErat() {
bool prime[1000001];
memset(prime, true, sizeof(prime));
for (long long vec = 2; vec * vec <= 1000000; vec++) {
if (prime[vec] == true) {
for (long long dd = vec * 2; dd <= 1000000; dd += vec) prime[dd] = false;
}
}
}
long long gcd... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int MAXN = 1e6 + 10;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long INF = 8e18;
const int LOG = 20;
long long pw(long long a, long long b, long long mod) {
return (!b ? 1
: (b & 1 ? (a * pw(a ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution ... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const long long INF = 1e9 + 47;
const long long LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1 << 17;
int n, m;
vector<int> g[N];
vector<int> G[N];
char used[N];
vector<int> comp;
void dfs... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
vector<int> g[N], g1[N], vs;
int mark[N];
bool flag = false;
void dfs(int v) {
mark[v] = 1;
for (int i = 0; i < g[v].size(); i++) {
int to = g[v][i];
if (mark[to] == 1) flag = true;
if (mark[to] == 3) dfs(to);
}
mark[v] = 2;
}
voi... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const int N = 2e5 + 7;
const int M = N * N * 2;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const double EPS = 1e-8;
struct Edge {
int v, next;
} e[N << 1];
int first[N], ecnt;
void Addedge(int u, int v) {
e[++ecnt].v = v... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class B {
static class SCC {
private boolean[] used;
private List<Integer> finished;
List<Integer>[] g;
List<Integer>[] rg;
int[... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
int n, m, ans;
int h[100005], nxt[200005], to[200005], tot;
void ins(int x, int y) {
nxt[++tot] = h[x];
to[tot] = y;
h[x] = tot;
}
int vis[100005], cnt;
int stk[100005], top;
int que[100005], l, r;
int in[100005];
void DFS(int u) {
vis[u] = cnt;
stk[++top] = u;
for (int i = h[u]; i;... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 |
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static class pair implements Comparable<pair>
{
int a;
int b;
public pair(int pa, int pb)
{
a = pa; b= pb;
}
@Override
public int compareTo(pair o) {
... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int T, n, m, last, d, e, ee;
int l, r, s, t, ll, tot;
int x, y, z, ans, tt, yy;
vector<int> a[100010];
int v[100010], g[100010], k[100010];
int f[100100];
int inf = 1000000001;
void dfs(int ss, int s) {
for (int i = 0; i < a[ss].size(); i++) {
int j = a[ss][i];
if... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> edge[maxn], travel[maxn];
int degree[maxn];
int n, m;
queue<int> que;
bool vis[maxn];
int dfs(int x) {
int res = 1;
vis[x] = true;
for (int i = 0; i < edge[x].size(); i++) {
int to = edge[x][i];
if (!vis[to]) res += dfs(to... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MN = 100111;
int V;
vector<int> G[MN];
struct DirectedDfs {
vector<int> num, low, current, S;
int counter;
vector<vector<int> > scc;
DirectedDfs() : num(V, -1), low(V, 0), current(V, 0), counter(0) {
for (int i = 0, _a = (V); i < _a; i++)
if (num... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int const N = 100 * 1000 + 7;
int n, m, a[N], b[N], mark[N], ans, d;
vector<int> adj[N], vec;
void dfs1(int v) {
mark[v] = 1;
vec.push_back(v);
for (auto ed : adj[v]) {
int u = (ed < 0 ? a[-ed] : b[ed]);
if (!mark[u]) {
dfs1(u);
}
}
}
void dfs2(int... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, cnt[100005], mp[100005], par[100005], ans;
bool vis[100005];
vector<int> v[100005];
int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); }
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) par[i] = i;
for (int i = 0; i < m; ++i) {... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
int n, m;
cin >> n >> m;
vector<int> g[n];
vector<int> g2[n];
for (int i = (0); i < (m); i++) {
int a, b;
cin >> a >> b;
a--, b--;
g[a].push_back(b);
g2[b].push_back(a);
}
bool vis[n];
memset(vis, fal... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
const int maxn = 2e5;
using namespace std;
vector<int> g[maxn], dir[maxn];
int mark[maxn];
int vis[maxn];
bool cycle;
vector<int> an;
void tdfs(int u) {
vis[u] = 1;
an.push_back(u);
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i];
if (!vis[v]) tdfs(v);
}
}
void dfs(int u... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class CF286B {
static int[] p;
static ArrayList<Integer>[] g;
static boolean[] v;
static boolean[] v2;
static int find(int i) {
... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 100;
int n, m;
vector<int> g[N];
vector<int> gg[N];
vector<int> a[N];
int C;
int ans;
bool used[N];
int u[N];
void read() {
scanf("%d%d", &n, &m);
int v, x;
for (int i = 0; i < m; i++) {
scanf("%d%d", &v, &x);
v--;
x--;
g[v].pu... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, const U &b) {
if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, const U &b) {
if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
char c, sg = 0;
while (c = getchar(), ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
vector<int> e[maxn], e2[maxn];
int n, m;
bool mark[maxn], free1[maxn], inDFS[maxn], foundCir;
vector<int> lst;
void dfs(int u) {
lst.push_back(u);
mark[u] = 1;
for (int i = 0; i < int(e2[u].size()); ++i) {
int v = e2[u][i];
if (!mark[v... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long MX = 1e5 + 9;
long long par[MX];
vector<long long> adj[MX], comp[MX];
bool st[MX], ft[MX], res;
long long FS(long long v) {
if (par[v] < 0) return v;
return par[v] = FS(par[v]);
}
void US(long long a, long long b) {
a = FS(a), b = FS(b);
if (a == b) ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | def main():
n, m = map(int, raw_input().split())
n += 1
cluster, dest, avail, ab = list(xrange(n)), [0] * n, [True] * n, [[] for _ in xrange(n)]
def root(x):
y = x
while y != cluster[y]:
y = cluster[y]
while x != y:
x, cluster[x] = cluster[x], y
r... | PYTHON |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.A... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
long long n, m, vcmp[maxn], markc[maxn], cntc[maxn], ans, state[maxn];
vector<int> adj[maxn], cadj[maxn];
bool dfs(int x) {
state[x] = 1;
for (int i = 0; i < adj[x].size(); i++) {
int y = adj[x][i];
if (state[y] == 0) {
if (dfs(... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T>
inline bool In(T &n) {
T x = 0, tmp = 1;
char c = getchar();
while ((c < '0' || c > '9') && c != '-' && c != EOF) c = getchar();
if (c == EOF) return false;
if (c == '-') c = getchar(), tmp =... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<int> nve[100005], ve[100005], gr[100005];
bool used[100005];
int nu[100005];
int n, m, k;
bool hc;
void gdfs(int x) {
used[x] = true;
gr[k].push_back(x);
for (int i = 0; i < nve[x].size(); i++) {
if (!used[nve[x][i]]) gdfs(nve[x][i]);
}
}
void dfs(int x) ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int f[100001];
vector<int> g[100001];
bool visited[100001];
int t[100001], c = 0;
bool cyc[100001];
int find(int x) {
if (f[x] != x) f[x] = find(f[x]);
return f[x];
}
void u(int x, int y) {
x = find(x);
y = find(y);
f[x] = y;
}
void dfs(int x) {
visited[x] = tru... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int fa[100005];
vector<int> g[100005];
bool vis[100005];
bool hh[100005];
int getf(int v) { return fa[v] == v ? v : fa[v] = getf(fa[v]); }
int dfn[100005];
int low[100005];
int belong[100005];
int nn[100005];
int ind;
bool v[100005];
bool sta[100005];
stack<int> ss;
int num... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int max_N = 100000 + 10;
bool mark[max_N], on[max_N], cycle[max_N], flag;
int n, cnt, ans;
vector<int> adj[max_N], g[max_N];
void dfs1(int v) {
mark[v] = on[v] = true;
for (int u : adj[v]) {
if (!mark[u])
dfs1(u);
else if (on[u])
cycle[u] = tru... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
bool truth[MAXN];
int nvar;
int neg(int x) { return MAXN - 1 - x; }
vector<int> g[MAXN];
int n, m, lw[MAXN], idx[MAXN], qidx, cmp[MAXN], qcmp;
stack<int> st;
void tjn(int u) {
lw[u] = idx[u] = ++qidx;
st.push(u);
cmp[u] = -2;
for (int v : g[u])... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
struct neighlist_t {
int neighbour;
char forward;
struct neighlist_t *next;
} * neighlist[100000];
int N, M;
int incoming[100000];
int outcoming[100000];
int processed[100000];
int fifo_start, fifo_end;
int fifo[100000];
int size;
void fifo_init() { fifo_start = fifo_end = 0; }
void fifo_... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int tot, n, m, head[maxn], sta[maxn];
int dfn[maxn], low[maxn], tt, top, las, f;
bool instack[maxn], cir[maxn];
struct edge {
int next, to;
} ji[maxn];
vector<int> v[maxn];
void add(int x, int y) {
v[x].push_back(y);
v[y].push_back(x);
ji[to... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int cmp = 0;
int mark[200005], sizes[200005], belongs[200005];
vector<int> adj[200005], radj[200005], grph[200005];
stack<int> st;
void dfs(int k) {
mark[k] = 1;
belongs[k] = cmp;
sizes[cmp]++;
for (int i = 0; i < grph[k].size(); i++) {
if (!mark[grph[k][i]]) {
... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
return x > 0 ? x : -x;
}
int n;
int m;
int was[100000];
int was2[100000];
int use[100000];
vector<int> v[100000];
vector<int> rv[100000];
vector<int> u[100000];
vector<int> q, w;
int go(int x) {
if (was[x]) return 0;
was[x] = 1;
for (... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
const int INF = 0x3fffffff;
const double EPS = 1e-9;
const double PI = 2 * asin(1);
bool g_f;
int g_n, g_m;
vector<bool> vb_mark;
vector<int> vi_mark, vi_num;
vector<vector<int>> vvi_e, vvi_ue;
void pretreat() {}
bool input() {
cin >> g_n >> g_m;
if ... | CPP |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Map.Entry;
import java.util.Stack;
public class B {
FastScanner in = n... | JAVA |
506_B. Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 2 | 8 | import java.util.*;
import java.lang.*;
import java.io.*;
public class D
{
private static ArrayList<Integer> order;
private static ArrayList<Integer> component;
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.i... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.