QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#383281 | #5545. Contingency Plan | kevinyang# | WA | 123ms | 24260kb | C++20 | 9.6kb | 2024-04-09 09:17:01 | 2024-04-09 09:17:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
/* Macros {{{ */
/* A lot of this is from some of Benq's submissions
[https://codeforces.com/profile/Benq]
Ugly af to the eyes, but with vim fold its barable
Hopefully c++20 concepts can make all this stuff must cleaner */
/* Basics {{{ */
using ll = long long;
using ld = long double;
using str = string;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
#define mp make_pair
#define fi first
#define se second
#define arr array
#define ve vector
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vpi = vector<pi>;
using vpll = vector<pll>;
using vpld = vector<pld>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvld = vector<vld>;
using vvpi = vector<vpi>;
using vvpll = vector<vpll>;
using vvpld = vector<vpld>;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz size()
#define rsz(a) resize(a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define For(i, a, b) for (int i = a; i < b; ++i)
#define Rof(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define rep(a) For(_, 0, a)
#define each(a, x) for (auto &a : x)
#define reach(a, x) for (auto a = x.rbegin(); a != x.rend(); ++a)
template <typename T, typename U>
inline void cmin(T &x, U y) {
if (y < x) x = y;
}
template <typename T, typename U>
inline void cmax(T &x, U y) {
if (x < y) x = y;
}
/*}}}*/
/* IO {{{ */
/* Template Macros {{{ */
#define tcT template <class T
#define tcTU tcT, class U
#define tcTUU tcT, class... U
/*}}}*/
inline namespace Helpers { /*{{{*/
tcT, class = void > struct is_iterable : false_type {};
tcT > struct is_iterable<
T, void_t<decltype(begin(declval<T>())), decltype(end(declval<T>()))>>
: true_type {};
tcT > constexpr bool is_iterable_v = is_iterable<T>::value;
tcT, class = void > struct is_readable : false_type {};
tcT > struct is_readable<T, typename std::enable_if_t<is_same_v<
decltype(cin >> declval<T &>()), istream &>>>
: true_type {};
tcT > constexpr bool is_readable_v = is_readable<T>::value;
tcT, class = void > struct is_printable : false_type {};
tcT > struct is_printable<T, typename std::enable_if_t<is_same_v<
decltype(cout << declval<T>()), ostream &>>>
: true_type {};
tcT > constexpr bool is_printable_v = is_printable<T>::value;
} /* namespace Helpers */
/*}}}*/
inline namespace Input { /*{{{*/
tcT > constexpr bool needs_input_v = !is_readable_v<T> && is_iterable_v<T>;
tcTUU > void re(T &t, U &...u);
tcTU > void re(pair<T, U> &p); /* pairs */
/* re: read{{{ */
tcT > typename enable_if<is_readable_v<T>, void>::type re(T &x) {
cin >> x;
} /* default */
tcT > typename enable_if<needs_input_v<T>, void>::type re(
T &i); // vectors, arrays, etc...
tcTU > void re(pair<T, U> &p) { re(p.fi, p.se); } // pairs
tcT > typename enable_if<needs_input_v<T>, void>::type re(T &i) {
each(x, i) re(x);
}
tcTUU > void re(T &t, U &...u) {
re(t);
re(u...);
} /* read multiple}}} */
/* rv: resize and read vectors{{{ */
void rv(size_t) {}
tcTUU > void rv(size_t N, ve<T> &t, U &...u);
template <class... U>
void rv(size_t, size_t N2, U &...u);
tcTUU > void rv(size_t N, ve<T> &t, U &...u) {
t.rsz(N);
re(t);
rv(N, u...);
}
template <class... U>
void rv(size_t, size_t N2, U &...u) {
rv(N2, u...);
} /*}}}*/
/* dumb shortcuts to read in ints{{{ */
void decrement() {} /* subtract one from each */
tcTUU > void decrement(T &t, U &...u) {
--t;
decrement(u...);
}
#define ints(...) \
int __VA_ARGS__; \
re(__VA_ARGS__);
#define int1(...) \
ints(__VA_ARGS__); \
decrement(__VA_ARGS__); /*}}}*/
} /* namespace Input */
/*}}}*/
inline namespace ToString { /*{{{*/
tcT > constexpr bool needs_output_v = !is_printable_v<T> && is_iterable_v<T>;
/* ts: string representation to print */
tcT > typename enable_if<is_printable_v<T>, str>::type ts(T v) {
stringstream ss;
ss << fixed << setprecision(15) << v;
return ss.str();
} /* default */
tcT > str bit_vec(T t) { /* bit vector to string */
str res = "{";
For(i, 0, t.sz) res += ts(t[i]);
res += "}";
return res;
}
str ts(ve<bool> v) { return bit_vec(v); }
template <size_t SZ>
str ts(bitset<SZ> b) {
return bit_vec(b);
} /* bit vector */
tcTU > str ts(pair<T, U> p); /* pairs */
tcT > typename enable_if<needs_output_v<T>, str>::type ts(
T v); /* vectors, arrays */
tcTU > str ts(pair<T, U> p) { return "(" + ts(p.fi) + ", " + ts(p.se) + ")"; }
tcT > typename enable_if<is_iterable_v<T>, str>::type ts_sep(T v, str sep) {
/* convert container to string w/ separator sep */
bool fst = 1;
str res = "";
for (const auto &x : v) {
if (!fst) res += sep;
fst = 0;
res += ts(x);
}
return res;
}
tcT > typename enable_if<needs_output_v<T>, str>::type ts(T v) {
return "{" + ts_sep(v, ", ") + "}";
}
/* for nested DS */
template <int, class T>
typename enable_if<!needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
return {ts(v)};
}
template <int lev, class T>
typename enable_if<needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
if (lev == 0 || !v.sz) return {ts(v)};
ve<str> res;
for (const auto &t : v) {
if (res.sz) res.back() += ",";
ve<str> tmp = ts_lev<lev - 1>(t);
res.insert(end(res), all(tmp));
}
For(i, 0, res.sz) {
str bef = " ";
if (i == 0) bef = "{";
res[i] = bef + res[i];
}
res.back() += "}";
return res;
}
} /* namespace ToString */
/*}}}*/
inline namespace Output { /*{{{*/
template <class T>
void pr_sep(ostream &os, str, const T &t) {
os << ts(t);
}
template <class T, class... U>
void pr_sep(ostream &os, str sep, const T &t, const U &...u) {
pr_sep(os, sep, t);
os << sep;
pr_sep(os, sep, u...);
}
/* print w/ no spaces */
template <class... T>
void pr(const T &...t) {
pr_sep(cout, "", t...);
}
/* print w/ spaces, end with newline */
void ps() { cout << "\n"; }
template <class... T>
void ps(const T &...t) {
pr_sep(cout, " ", t...);
ps();
}
/* debug to cerr */
template <class... T>
void dbg_out(const T &...t) {
pr_sep(cerr, " | ", t...);
cerr << endl;
}
void loc_info(int line, str names) {
cerr << "Line(" << line << ") -> [" << names << "]: ";
}
template <int lev, class T>
void dbgl_out(const T &t) {
cerr << "\n\n" << ts_sep(ts_lev<lev>(t), "\n") << "\n" << endl;
}
} /* namespace Output */
/*}}}}}}}}}*/
// the contegency cables must form a tree
// the contegency cables 1-(n-2) and cable n-1 must form a tree
// that is no contegency cables can make a cycle with n-1
// res will be a graph with
// 2(n-1) edges
// no leafs
// when processed in dfs order, all edges of type v will have a backedge in the subgraph of type v
// is there some duality here: that is will the initial edges be sufficient back up edges
// that is, if we delete edge n-1, and all (n-1)', must the graph still be connected
int n;
vpi edges;
map<pi, int> inv_edges;
vi deg;
vvi adj;
vi depth, par;
void dfs(int r, int p=-1, int d=0) {
par[r] = p, depth[r] = d;
for(auto c : adj[r]) {
if(c == p) continue;
dfs(c, r, d+1);
}
}
vi par2;
void dfs2(int r, int p=-1) {
par2[r] = (p == -1) ? p : ((par2[p] == -1) ? p : par2[p]);
for(auto c : adj[r]) {
if(c == p) continue;
dfs(c, r);
}
}
void solve() {
re(n), rv(n-1, edges);
adj.assign(n+1, vi());
deg.assign(n+1, 0);
for(int i=0; i<n-1; ++i) {
auto [u, v] = edges[i];
++deg[u], ++deg[v];
adj[u].pb(v), adj[v].pb(u);
inv_edges[{u, v}] = i, inv_edges[{v, u}] = i;
}
int star_graph = 0;
for(int i=1; i<=n; ++i) star_graph |= (deg[i] == n-1);
if(star_graph) { ps(-1); return; }
auto [a, b] = edges[n-2];
if(deg[a] == 1 || deg[b] == 1) {
int leaf = (deg[a] == 1) ? a : b;
par.resize(n+1), depth.resize(n+1);
dfs(leaf);
vpi res(n-1);
int flag = 1;
for(int i=1; i<=n; ++i) {
if(i == leaf || par[i] == leaf) continue;
if(flag && depth[i] == 3) {
res[inv_edges[{ leaf, adj[leaf][0] }]] = { i, leaf };
flag = 0;
}
res[inv_edges[{ i, par[i] }]] = { i, par[par[i]] };
}
for(auto [u, v] : res) ps(u, v);
} else {
adj[a].erase(find(all(adj[a]), b));
adj[b].erase(find(all(adj[b]), a));
par.resize(n+1), depth.resize(n+1);
dfs(a), dfs(b);
par2.resize(n+1);
dfs2(a), dfs2(b);
vpi res(n-1);
for(int i=1; i<=n; ++i) {
if(i == a || i == b) continue;
res[inv_edges[{ i, par[i] }]] = { i, (par2[i] != a) ? a : b };
}
res[n-2] = { adj[a][0], adj[b][0] };
for(auto [u, v] : res) ps(u, v);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
/* cout << fixed << setprecision(6); */
int t = 1;
// cin >> t;
for (int i = 0; i < t; i++) solve();
return 0;
// you should actually read the stuff at the bottom
}
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
7 1 2 3 7 2 4 2 5 1 3 3 6
output:
2 3 7 6 4 1 5 1 1 6 2 6
result:
ok AC
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
3 1 2 2 3
output:
-1
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 2 1
output:
-1
result:
ok AC
Test #4:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
5 2 1 2 3 2 4 4 5
output:
1 4 3 4 2 5 1 5
result:
ok AC
Test #5:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
5 1 4 3 4 4 5 2 5
output:
1 5 3 5 4 2 1 2
result:
ok AC
Test #6:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 5 2 1 2 4 2 3 4
output:
5 4 1 4 2 3 1 3
result:
ok AC
Test #7:
score: 0
Accepted
time: 15ms
memory: 7384kb
input:
20000 1 2 1 3 4 1 5 1 6 1 7 1 1 8 1 9 1 10 1 11 12 1 1 13 14 1 1 15 1 16 17 1 1 18 1 19 20 1 21 1 22 1 1 23 24 1 1 25 26 1 1 27 28 1 29 1 30 1 1 31 1 32 1 33 1 34 1 35 36 1 1 37 1 38 1 39 40 1 41 1 1 42 1 43 44 1 1 45 46 1 1 47 48 1 49 1 1 50 1 51 52 1 53 1 54 1 1 55 56 1 57 1 58 1 1 59 60 1 61 1 1 ...
output:
2 19999 3 19999 4 19999 5 19999 6 19999 7 19999 8 19999 9 19999 10 19999 11 19999 12 19999 13 19999 14 19999 15 19999 16 19999 17 19999 18 19999 19 19999 20 19999 21 19999 22 19999 23 19999 24 19999 25 19999 26 19999 27 19999 28 19999 29 19999 30 19999 31 19999 32 19999 33 19999 34 19999 35 19999 36...
result:
ok AC
Test #8:
score: 0
Accepted
time: 17ms
memory: 7520kb
input:
20000 7662 1 9205 1 5971 1 1 9886 1 18853 14108 1 998 1 1 14958 7100 1 1 2670 1 18493 13838 1 4644 1 2139 1 1 18540 1 14081 1 16836 1 9357 245 1 242 1 1 13472 1 1471 3792 1 1 17875 13976 1 1 15085 1 17283 15014 1 17477 1 11578 1 18441 1 1 14367 3018 1 1 7186 1 4939 2470 1 2993 1 6175 1 1 19886 1 125...
output:
7662 11055 9205 11055 5971 11055 9886 11055 18853 11055 14108 11055 998 11055 14958 11055 7100 11055 2670 11055 18493 11055 13838 11055 4644 11055 2139 11055 18540 11055 14081 11055 16836 11055 9357 11055 245 11055 242 11055 13472 11055 1471 11055 3792 11055 17875 11055 13976 11055 15085 11055 17283...
result:
ok AC
Test #9:
score: 0
Accepted
time: 21ms
memory: 7524kb
input:
20000 8854 1 15635 1 8088 1 1 12138 12367 1 1 15051 6392 1 15564 1 17334 1 1 10164 8704 1 1 13795 1 10292 12108 1 1 50 4 1 1 18364 13341 1 19203 1 1 3017 1 5133 3499 1 19202 1 1 10304 12975 1 1 17220 1 1716 1 4158 1 16763 1 301 1 16645 8690 1 1 10064 16977 1 1 19618 1 5471 1 8763 3997 1 1 3283 11332...
output:
8854 17288 15635 17288 8088 17288 12138 17288 12367 17288 15051 17288 6392 17288 15564 17288 17334 17288 10164 17288 8704 17288 13795 17288 10292 17288 12108 17288 50 17288 4 17288 18364 17288 13341 17288 19203 17288 3017 17288 5133 17288 3499 17288 19202 17288 10304 17288 12975 17288 17220 17288 17...
result:
ok AC
Test #10:
score: 0
Accepted
time: 15ms
memory: 7444kb
input:
20000 1 2 2 3 4 2 2 5 2 6 2 7 2 8 9 2 10 2 2 11 12 2 2 13 14 2 2 15 2 16 17 2 2 18 19 2 20 2 2 21 22 2 2 23 24 2 2 25 26 2 2 27 2 28 29 2 30 2 2 31 2 32 2 33 2 34 35 2 36 2 37 2 38 2 2 39 40 2 2 41 42 2 43 2 2 44 45 2 46 2 2 47 2 48 2 49 50 2 51 2 2 52 2 53 54 2 55 2 56 2 57 2 2 58 2 59 60 2 61 2 2 ...
output:
1 19999 3 19999 4 19999 5 19999 6 19999 7 19999 8 19999 9 19999 10 19999 11 19999 12 19999 13 19999 14 19999 15 19999 16 19999 17 19999 18 19999 19 19999 20 19999 21 19999 22 19999 23 19999 24 19999 25 19999 26 19999 27 19999 28 19999 29 19999 30 19999 31 19999 32 19999 33 19999 34 19999 35 19999 36...
result:
ok AC
Test #11:
score: 0
Accepted
time: 12ms
memory: 7364kb
input:
20000 1 13291 13291 19998 3314 13291 13291 3339 13291 10237 13244 13291 13291 3392 13291 4459 13291 17335 13291 10356 6124 13291 13291 4470 12896 13291 13291 12094 3309 13291 13319 13291 13291 15658 13291 2305 13291 13710 13291 16520 13291 16234 6697 13291 13291 6686 9187 13291 13291 43 13291 2764 1...
output:
1 1064 19998 1064 3314 1064 3339 1064 10237 1064 13244 1064 3392 1064 4459 1064 17335 1064 10356 1064 6124 1064 4470 1064 12896 1064 12094 1064 3309 1064 13319 1064 15658 1064 2305 1064 13710 1064 16520 1064 16234 1064 6697 1064 6686 1064 9187 1064 43 1064 2764 1064 9061 1064 8113 1064 8449 1064 330...
result:
ok AC
Test #12:
score: 0
Accepted
time: 17ms
memory: 7568kb
input:
20000 4030 5565 1206 5565 5565 8947 4887 5565 14605 5565 5565 2947 5565 9038 5565 5326 5565 9021 11087 5565 5565 19562 895 5565 14653 5565 5565 10803 5565 9750 5565 16331 4689 5565 14307 5565 11631 5565 5565 13244 10554 5565 8112 5565 5565 9394 5565 5945 15279 5565 5565 15512 1334 5565 5565 6025 556...
output:
4030 14227 1206 14227 8947 14227 4887 14227 14605 14227 2947 14227 9038 14227 5326 14227 9021 14227 11087 14227 19562 14227 895 14227 14653 14227 10803 14227 9750 14227 16331 14227 4689 14227 14307 14227 11631 14227 13244 14227 10554 14227 8112 14227 9394 14227 5945 14227 15279 14227 15512 14227 133...
result:
ok AC
Test #13:
score: 0
Accepted
time: 79ms
memory: 24180kb
input:
100000 1 2 3 1 1 4 5 1 1 6 1 7 1 8 1 9 10 1 1 11 1 12 13 1 1 14 1 15 16 1 17 1 18 1 1 19 1 20 1 21 1 22 1 23 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 1 32 33 1 34 1 35 1 36 1 37 1 1 38 1 39 1 40 1 41 1 42 43 1 1 44 45 1 1 46 1 47 48 1 49 1 1 50 51 1 52 1 53 1 54 1 1 55 56 1 57 1 58 1 59 1 60 1 1 61 1...
output:
2 99999 3 99999 4 99999 5 99999 6 99999 7 99999 8 99999 9 99999 10 99999 11 99999 12 99999 13 99999 14 99999 15 99999 16 99999 17 99999 18 99999 19 99999 20 99999 21 99999 22 99999 23 99999 24 99999 25 99999 26 99999 27 99999 28 99999 29 99999 30 99999 31 99999 32 99999 33 99999 34 99999 35 99999 36...
result:
ok AC
Test #14:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5 2 1 3 2 4 3 5 4
output:
1 3 2 4 3 5 2 5
result:
ok AC
Test #15:
score: 0
Accepted
time: 115ms
memory: 24124kb
input:
100000 21871 1 13678 1 27196 1 70437 1 1 35891 1 43010 28018 1 1 64489 61157 1 1 35572 1 41613 1 73049 93865 1 83507 1 1 92127 86278 1 1 15004 1 44154 2005 1 1 94210 41410 1 1 5886 69836 1 1 24120 1 80802 1 9940 66220 1 66549 1 1 20103 1 5 1 33021 35482 1 76185 1 34850 1 1 55173 1 72488 1 76286 1 99...
output:
21871 63055 13678 63055 27196 63055 70437 63055 35891 63055 43010 63055 28018 63055 64489 63055 61157 63055 35572 63055 41613 63055 73049 63055 93865 63055 83507 63055 92127 63055 86278 63055 15004 63055 44154 63055 2005 63055 94210 63055 41410 63055 5886 63055 69836 63055 24120 63055 80802 63055 99...
result:
ok AC
Test #16:
score: 0
Accepted
time: 117ms
memory: 24260kb
input:
100000 1 12976 28108 1 87682 1 79359 1 16128 1 1 90652 1 55874 27276 1 1 66899 1 10296 1 37870 1 78978 26221 1 28589 1 1 46430 32252 1 22407 1 68230 1 64944 1 1 53457 31023 1 1 57101 1 82578 1 33273 69683 1 64357 1 1 32517 1 45623 1 29497 41082 1 1 43731 1 28620 1 64304 1 23462 1 81982 1 91877 1 309...
output:
12976 49349 28108 49349 87682 49349 79359 49349 16128 49349 90652 49349 55874 49349 27276 49349 66899 49349 10296 49349 37870 49349 78978 49349 26221 49349 28589 49349 46430 49349 32252 49349 22407 49349 68230 49349 64944 49349 53457 49349 31023 49349 57101 49349 82578 49349 33273 49349 69683 49349 ...
result:
ok AC
Test #17:
score: 0
Accepted
time: 72ms
memory: 24188kb
input:
100000 1 2 2 3 4 2 5 2 2 6 7 2 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 16 2 2 17 18 2 19 2 20 2 21 2 2 22 23 2 24 2 2 25 2 26 27 2 28 2 29 2 30 2 2 31 32 2 2 33 34 2 35 2 2 36 2 37 38 2 2 39 40 2 2 41 42 2 43 2 44 2 45 2 2 46 47 2 2 48 49 2 50 2 2 51 2 52 2 53 2 54 2 55 56 2 2 57 58 2 59 2 60 2 61 2 6...
output:
1 99999 3 99999 4 99999 5 99999 6 99999 7 99999 8 99999 9 99999 10 99999 11 99999 12 99999 13 99999 14 99999 15 99999 16 99999 17 99999 18 99999 19 99999 20 99999 21 99999 22 99999 23 99999 24 99999 25 99999 26 99999 27 99999 28 99999 29 99999 30 99999 31 99999 32 99999 33 99999 34 99999 35 99999 36...
result:
ok AC
Test #18:
score: 0
Accepted
time: 123ms
memory: 24088kb
input:
100000 15924 1 13919 15924 86413 15924 15924 78418 36904 15924 15924 60478 15924 78563 15924 23855 63531 15924 15574 15924 73713 15924 62532 15924 15924 19461 15924 80750 15924 57012 15924 27046 55780 15924 69619 15924 58970 15924 65824 15924 15924 3195 26782 15924 71411 15924 84915 15924 95347 1592...
output:
1 21982 13919 21982 86413 21982 78418 21982 36904 21982 60478 21982 78563 21982 23855 21982 63531 21982 15574 21982 73713 21982 62532 21982 19461 21982 80750 21982 57012 21982 27046 21982 55780 21982 69619 21982 58970 21982 65824 21982 3195 21982 26782 21982 71411 21982 84915 21982 95347 21982 53739...
result:
ok AC
Test #19:
score: 0
Accepted
time: 120ms
memory: 24184kb
input:
100000 40659 47250 51514 40659 40659 83613 16333 40659 25291 40659 40659 61711 40659 37621 40659 66805 40659 59550 67744 40659 40659 46644 40659 21771 40659 98164 40659 6655 75053 40659 90431 40659 40659 58023 48769 40659 11506 40659 19125 40659 52852 40659 98702 40659 53360 40659 40659 3999 66767 4...
output:
47250 15917 51514 15917 83613 15917 16333 15917 25291 15917 61711 15917 37621 15917 66805 15917 59550 15917 67744 15917 46644 15917 21771 15917 98164 15917 6655 15917 75053 15917 90431 15917 58023 15917 48769 15917 11506 15917 19125 15917 52852 15917 98702 15917 53360 15917 3999 15917 66767 15917 82...
result:
ok AC
Test #20:
score: 0
Accepted
time: 23ms
memory: 7284kb
input:
20000 13211 1 1 10767 13211 16998 13211 495 10767 7635 10767 6994 10669 16998 1369 16998 495 4745 722 495 7635 251 3552 7635 7267 6994 6994 1772 10669 18929 10669 9328 3076 1369 1369 14212 4745 284 4745 9599 722 6137 722 10565 15137 251 5349 251 16431 3552 3552 15719 7267 10917 598 7267 19533 1772 1...
output:
1 16998 10767 13211 13211 1369 495 16998 7635 1 6994 1 10669 1369 16998 14212 4745 13211 722 13211 251 10767 3552 10767 7267 10767 1772 10767 18929 16998 9328 16998 3076 14212 1369 12864 284 495 9599 495 6137 495 10565 495 15137 7635 5349 7635 16431 7635 15719 7635 10917 6994 598 6994 19533 6994 523...
result:
ok AC
Test #21:
score: 0
Accepted
time: 27ms
memory: 7372kb
input:
20000 11262 14400 16805 2790 19084 11979 15259 5949 9916 12236 2445 1637 1905 15141 9540 16655 12812 16186 19052 1523 6643 1443 13738 10091 9218 1337 16617 16436 17295 16466 1171 1217 19150 5280 2830 8076 16135 7234 11460 213 8101 341 5438 6331 5029 14871 10725 2090 5998 12241 8902 3420 4340 7265 18...
output:
14400 7731 16805 852 11979 13877 5949 12963 9916 9210 2445 550 15141 2744 16655 19233 16186 3873 1523 8631 1443 13671 10091 17343 9218 1019 16617 17229 16466 9778 1217 110 19150 10298 2830 1465 7234 6049 11460 19057 8101 11789 6331 11950 14871 3981 10725 11055 12241 12709 8902 19752 7265 9765 5618 1...
result:
ok AC
Test #22:
score: 0
Accepted
time: 22ms
memory: 7444kb
input:
20000 19272 1 19272 7240 6952 7240 6952 10594 12564 10594 12564 13132 14483 13132 14483 1891 9772 1891 16614 9772 14519 16614 12050 14519 4039 12050 4039 9679 8408 4039 12050 6797 17990 6797 6797 17659 14519 14985 16415 14985 1735 16415 16415 18821 14985 9402 9402 18947 9402 5386 17560 16614 17560 1...
output:
19272 327 7240 1 6952 19272 10594 7240 12564 6952 13132 10594 14483 12564 1891 13132 9772 14483 16614 1891 14519 9772 12050 16614 4039 14519 9679 12050 8408 12050 6797 14519 17990 12050 17659 12050 14985 16614 16415 14519 1735 14985 18821 14985 9402 14519 18947 14985 5386 14985 17560 9772 1094 16614...
result:
ok AC
Test #23:
score: 0
Accepted
time: 17ms
memory: 7364kb
input:
20000 4410 1 7210 1 1 2389 4410 18377 4410 4507 7905 4410 7210 14849 12441 7210 7210 9005 17807 2389 2389 6619 2389 6604 6913 18377 5811 18377 7249 18377 4507 1582 4507 8857 4507 17635 10077 7905 7905 4687 8607 7905 14849 16870 14849 3298 14849 2376 12441 9009 12441 10729 19879 12441 9005 19790 7715...
output:
4410 7210 1 12441 2389 7210 18377 1 4507 1 7905 1 14849 12441 7210 10729 9005 12441 17807 1 6619 1 6604 1 6913 4410 5811 4410 7249 4410 1582 4410 8857 4410 17635 4410 10077 4410 4687 4410 8607 4410 16870 7210 3298 7210 2376 7210 9009 10729 12441 5020 19879 10729 19790 7210 7715 7210 4016 7210 18955 ...
result:
ok AC
Test #24:
score: -100
Wrong Answer
time: 24ms
memory: 7368kb
input:
20000 7223 19213 12395 18674 16451 12980 18029 7848 16056 11920 6906 11077 3923 10662 9192 4837 17604 11135 16462 2457 18842 9770 15130 10251 19601 6770 7954 12079 7559 642 15051 17509 1146 18583 18196 17621 4980 8041 19973 15310 16834 11112 3176 8010 957 12737 4072 830 3194 1873 11400 3394 6914 806...
output:
19213 16305 12395 16305 12980 16305 7848 16305 11920 16305 6906 16305 3923 16305 4837 16305 11135 16305 2457 16305 9770 16305 10251 16305 6770 16305 12079 16305 7559 16305 15051 16305 1146 16305 17621 16305 8041 16305 19973 16305 11112 16305 3176 16305 957 16305 830 16305 3194 16305 11400 16305 6914...
result:
wrong answer u and v already exists