QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#703005 | #5088. Two Choreographies | tamthegod# | AC ✓ | 49ms | 41108kb | C++23 | 4.2kb | 2024-11-02 16:57:19 | 2024-11-02 16:57:23 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 1e6 + 5;
const int mod = 1e9 + 7;
const ll oo = 1e18;
int n;
vector<int> adj[maxN];
int jump[maxN][20];
int depth[maxN];
pair<int, int> edge[maxN];
int mark[maxN];
void ReadInput()
{
cin >> n;
for(int i=1; i<=2*n-3; i++)
{
int u, v;
cin >> u >> v;
edge[i] = {u, v};
}
}
void dfs(int u, int par)
{
for(int v : adj[u])
{
if(v == par) continue;
jump[v][0] = u;
depth[v] = depth[u] + 1;
for(int i=1; i<=18; i++)
jump[v][i] = jump[jump[v][i - 1]][i - 1];
dfs(v, u);
}
}
int lca(int u, int v)
{
if(depth[u] < depth[v]) swap(u, v);
int k = depth[u] - depth[v];
for(int i=18; i>=0; i--)
if(k >> i & 1) u = jump[u][i];
if(u == v) return u;
for(int i=18; i>=0; i--)
if(jump[u][i] != jump[v][i])
{
u = jump[u][i];
v = jump[v][i];
}
return jump[u][0];
}
int dist(int u, int v)
{
return depth[u] + depth[v] - 2 * depth[lca(u, v)];
}
int lab[maxN];
int findset(int u)
{
return lab[u] < 0 ? u : lab[u] = findset(lab[u]);
}
int unite(int u, int v)
{
int r = findset(u), s = findset(v);
if(r == s) return false;
if(lab[r] < lab[s]) swap(r, s);
lab[r] += lab[s];
lab[s] = r;
return true;
}
vector<int> go(int x, int y)
{
vector<int> vc1, vc2;
int t = lca(x, y);
while(x != t)
{
vc1.pb(x);
x = jump[x][0];
}
while(y != t)
{
vc2.pb(y);
y = jump[y][0];
}
vc2.pb(t);
reverse(vc2.begin(), vc2.end());
vector<int> res;
for(int v : vc1)
res.pb(v);
for(int v : vc2)
res.pb(v);
return res;
for(int v : vc1)
cout << v << " ";
for(int v : vc2)
cout << v << " ";
cout << '\n';
}
void print(int x, int y, int res)
{
vector<int> path1 = go(edge[x].fi, edge[x].se);
vector<int> path2 = go(edge[y].fi, edge[y].se);
vector<int> vc1 = path1, vc2 = path2;
sort(vc1.begin(), vc1.end());
sort(vc2.begin(), vc2.end());
vc1.erase(unique(vc1.begin(), vc1.end()), vc1.end());
vc2.erase(unique(vc2.begin(), vc2.end()), vc2.end());
if(res < 3) while(true);
// if(vc1 == vc2 || vc1.size() != vc2.size() || vc1.size() != res) while(true);
cout << res << '\n';
for(int v : path1) cout << v << " ";
cout << '\n';
for(int v : path2)
cout << v << " ";
cout << '\n';
// go(edge[x].fi, edge[x].se);
//go(edge[y].fi, edge[y].se);
}
void Solve()
{
while(true)
{
shuffle(edge + 1, edge + 2 * n - 2, rng);
fill(lab, lab + n + 1, -1);
for(int i=1; i<=n; i++)
adj[i].clear();
fill(mark, mark + 2 * n + 4, 0);
for(int i=1; i<=2*n-3; i++)
{
if(unite(edge[i].fi, edge[i].se))
{
adj[edge[i].fi].pb(edge[i].se);
adj[edge[i].se].pb(edge[i].fi);
mark[i] = 1;
}
}
dfs(rng() % n + 1, 0);
map<int, int> mp;
for(int i=1; i<=2*n-3; i++)
{
if(mark[i]) continue;
int len = dist(edge[i].fi, edge[i].se) + 1;
if(len <= 2) continue;
if(mp[len])
{
print(mp[len], i, len);
return;
}
mp[len] = i;
}
if(1.0 * clock() / CLOCKS_PER_SEC > 2.2)
{
cout << -1;
return;
}
}
}
#define taskname "sol"
int32_t main()
{
if (fopen(taskname ".inp", "r"))
{
freopen(taskname ".inp", "r", stdin);
//freopen(taskname ".out", "w", stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
//cin >> T;
for(int itest=1; itest<=T; itest++)
{
ReadInput();
Solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 9836kb
input:
4 1 2 1 3 1 4 2 3 2 4
output:
3 2 1 3 1 2 4
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 10004kb
input:
5 1 2 1 3 1 4 1 5 2 3 2 5 3 4
output:
3 2 1 3 1 2 5
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 9720kb
input:
7 1 2 3 4 5 6 5 2 3 1 6 1 4 2 4 5 2 6 3 6 1 5
output:
4 3 6 5 1 4 3 6 5
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 9764kb
input:
40 1 16 1 40 2 4 2 16 2 36 3 25 3 38 4 1 4 13 5 11 5 27 6 4 7 5 7 11 8 10 8 14 8 24 9 34 10 20 12 35 13 2 14 10 14 20 15 18 15 28 15 31 16 6 16 13 17 5 17 11 17 27 18 9 19 1 19 4 19 16 20 24 21 12 21 33 21 35 22 38 23 12 23 21 25 28 25 31 25 34 25 38 26 14 26 20 27 7 27 11 28 3 28 31 29 16 29 19 30 ...
output:
5 34 25 3 28 31 38 3 28 15 18
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 9988kb
input:
201 1 7 1 114 1 119 2 49 2 93 4 197 5 139 6 1 6 27 7 39 7 121 8 127 9 130 9 145 11 106 11 136 11 193 12 2 12 116 13 55 13 69 13 105 13 187 13 196 14 144 14 177 15 127 15 134 15 145 15 155 15 184 15 199 16 96 16 177 17 20 21 100 22 68 22 71 22 81 22 142 23 148 23 190 24 12 24 81 24 89 25 158 25 159 2...
output:
8 106 36 7 1 114 48 50 82 25 97 164 6 1 7 39 158
result:
ok
Test #6:
score: 0
Accepted
time: 5ms
memory: 10372kb
input:
8000 2 1508 2 3068 3 5268 3 5501 6 266 6 2737 6 3197 6 5863 6 6697 7 3492 9 427 9 794 9 3114 9 5509 10 2257 10 4348 11 1479 11 1957 11 2230 11 2500 11 3182 11 4399 11 5051 11 7727 12 7669 13 1403 13 5753 14 2871 14 6956 14 7959 15 6902 17 1630 17 3155 17 5950 18 7232 19 125 19 3280 19 5648 20 6879 2...
output:
26 1198 829 3082 1246 4056 3459 7975 1592 1736 4874 7464 5031 5943 73 5697 4390 5219 1802 5734 2495 1884 6221 6434 126 6211 6262 1515 5268 553 6601 5757 3821 1468 2085 1714 1328 6019 380 5943 5031 7464 4874 1736 1592 7975 3459 4056 5892 5354 1089 1765 71
result:
ok
Test #7:
score: 0
Accepted
time: 31ms
memory: 37420kb
input:
99999 1 11261 1 21544 2 9017 2 63063 2 97990 3 11995 3 42473 4 19846 5 38099 6 35872 6 80509 7 73231 8 12356 9 35384 10 45091 12 86727 13 4938 13 48917 14 62383 14 89846 15 28458 15 44277 15 51725 15 84522 16 93258 17 13934 17 42238 18 19000 19 11278 19 23672 19 61502 19 78791 20 85057 20 88080 21 2...
output:
60 26346 92813 89526 81281 11565 28429 19837 62258 54310 28943 29760 39721 22060 59905 54437 96963 81949 40806 30933 90506 37473 21393 73904 12384 12738 818 7042 11018 91108 99264 52111 78268 58507 86339 34129 53133 3169 53326 87419 16434 34443 70143 58455 49104 95012 72567 83466 24685 56446 26958 7...
result:
ok
Test #8:
score: 0
Accepted
time: 39ms
memory: 38912kb
input:
100000 1 68531 2 97359 4 68578 4 83098 4 98443 5 8053 5 30270 5 86617 6 7074 6 12266 6 69396 7 52675 7 78316 7 90757 7 92242 8 32677 8 41353 8 41457 8 74508 9 44234 10 4973 10 38390 10 96049 11 28007 11 68620 13 3016 14 36748 15 8147 15 25110 15 28489 15 72947 15 99347 16 70760 17 12774 17 68407 17 ...
output:
10 91464 36548 19721 38484 24923 67433 98402 19295 49078 98442 10475 27079 92453 8718 12882 43268 38067 22390 3358 83403
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 9784kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 7 5 1 4 7 3 1 6 7 1
output:
4 4 1 6 5 3 2 1 4
result:
ok
Test #10:
score: 0
Accepted
time: 43ms
memory: 37036kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
5 1 53490 100000 57155 57154 1 53490 100000 21819 21820
result:
ok
Test #11:
score: 0
Accepted
time: 3ms
memory: 9916kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 6 1 4 8 4 8 3 8 2 1 8
output:
3 2 8 3 8 7 6
result:
ok
Test #12:
score: 0
Accepted
time: 2ms
memory: 9704kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 3 1 4 9 5 9 4 1 7 9 2 1 9
output:
3 4 9 5 1 2 9
result:
ok
Test #13:
score: 0
Accepted
time: 2ms
memory: 9956kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 8 1 4 10 6 1 6 10 4 10 3 1 9 10 1
output:
3 9 8 10 1 10 4
result:
ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 10132kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
4 1 783 1000 199 1000 783 1 301
result:
ok
Test #15:
score: 0
Accepted
time: 6ms
memory: 11484kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
4 9999 7449 1 5327 1 7449 9999 5867
result:
ok
Test #16:
score: 0
Accepted
time: 6ms
memory: 12656kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
4 10000 4736 1 5668 1 4736 10000 8672
result:
ok
Test #17:
score: 0
Accepted
time: 47ms
memory: 41108kb
input:
94753 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
4 94753 42141 1 13743 1 42141 94753 46838
result:
ok
Test #18:
score: 0
Accepted
time: 38ms
memory: 37468kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
4 99999 91125 1 56232 1 91125 99999 61060
result:
ok
Test #19:
score: 0
Accepted
time: 0ms
memory: 10004kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 1 3 1 4 1 5 1 6 1 7
output:
3 1 4 5 3 1 4
result:
ok
Test #20:
score: 0
Accepted
time: 34ms
memory: 39200kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 1 13211 13210 64780 1 64781
result:
ok
Test #21:
score: 0
Accepted
time: 3ms
memory: 9932kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 1 3 1 4 1 5 1 6 1 7 1 8
output:
3 1 4 5 7 1 8
result:
ok
Test #22:
score: 0
Accepted
time: 2ms
memory: 9704kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 3 1 4 1 5 1 6 1 7 1 8 1 9
output:
3 1 5 6 4 1 5
result:
ok
Test #23:
score: 0
Accepted
time: 2ms
memory: 9836kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10
output:
3 1 8 7 4 1 5
result:
ok
Test #24:
score: 0
Accepted
time: 0ms
memory: 11968kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 1 534 533 1 400 401
result:
ok
Test #25:
score: 0
Accepted
time: 6ms
memory: 12576kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 1 5107 5106 3679 1 3680
result:
ok
Test #26:
score: 0
Accepted
time: 0ms
memory: 14856kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 1 9707 9706 1 2834 2833
result:
ok
Test #27:
score: 0
Accepted
time: 32ms
memory: 36944kb
input:
97065 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 1 93951 93950 64888 1 64889
result:
ok
Test #28:
score: 0
Accepted
time: 37ms
memory: 37428kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 22567 1 22568 1 84994 84995
result:
ok
Test #29:
score: 0
Accepted
time: 3ms
memory: 9992kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 7 5 7 4 7 3 7 2 7 1
output:
3 4 7 5 7 4 3
result:
ok
Test #30:
score: 0
Accepted
time: 39ms
memory: 37548kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 100000 89145 89144 100000 16885 16884
result:
ok
Test #31:
score: 0
Accepted
time: 2ms
memory: 9768kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 6 8 5 8 4 8 3 8 2 8 1
output:
3 8 2 1 4 8 5
result:
ok
Test #32:
score: 0
Accepted
time: 2ms
memory: 9956kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 7 9 6 9 5 9 4 9 3 9 2 9 1
output:
3 9 6 7 1 9 2
result:
ok
Test #33:
score: 0
Accepted
time: 2ms
memory: 9724kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 8 10 7 10 6 10 5 10 4 10 3 10 2 10 1
output:
3 7 10 8 10 5 6
result:
ok
Test #34:
score: 0
Accepted
time: 0ms
memory: 9860kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 319 1000 320 1000 821 820
result:
ok
Test #35:
score: 0
Accepted
time: 5ms
memory: 10540kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 9999 196 195 9999 8196 8195
result:
ok
Test #36:
score: 0
Accepted
time: 6ms
memory: 10532kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 10000 2435 2436 10000 5443 5442
result:
ok
Test #37:
score: 0
Accepted
time: 33ms
memory: 33624kb
input:
92892 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 92892 18132 18131 92892 44113 44112
result:
ok
Test #38:
score: 0
Accepted
time: 35ms
memory: 38908kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 99999 14153 14154 90897 99999 90898
result:
ok
Test #39:
score: 0
Accepted
time: 2ms
memory: 9764kb
input:
8 5 6 7 3 2 3 7 8 1 5 2 8 8 5 4 5 8 1 7 6 3 4 2 6 2 1
output:
6 1 2 3 7 6 5 2 3 7 6 5 8
result:
ok
Test #40:
score: 0
Accepted
time: 0ms
memory: 9760kb
input:
10 6 7 1 7 2 5 2 4 5 4 10 4 3 2 6 5 10 5 2 8 4 1 1 2 8 9 7 8 3 10 9 10 4 3
output:
3 4 2 1 2 4 5
result:
ok
Test #41:
score: 0
Accepted
time: 2ms
memory: 9848kb
input:
1000 272 271 393 394 369 404 981 980 169 185 362 361 387 386 482 481 383 382 370 788 266 106 938 223 876 877 107 106 109 110 481 480 633 14 886 885 588 589 673 567 568 693 531 932 562 561 871 872 89 959 951 950 119 556 484 891 981 271 75 74 443 444 865 730 374 15 580 233 716 165 882 829 622 623 606 ...
output:
28 611 112 825 513 743 744 745 746 650 828 118 19 20 97 98 140 29 772 667 668 461 59 60 427 428 429 613 612 958 725 566 740 741 742 289 288 105 158 684 683 682 681 432 431 130 129 19 20 253 420 947 304 303 2 960 959
result:
ok
Test #42:
score: 0
Accepted
time: 0ms
memory: 10524kb
input:
9999 1503 1502 1862 3917 4579 4578 9929 8919 4989 4990 4479 7716 5512 5511 4389 4390 4430 910 5616 3889 5708 5879 8848 8849 5400 5076 7827 3718 1169 1168 1574 213 3196 4013 2414 2415 2857 2858 9177 9178 7189 7190 3550 3549 7446 5351 7766 8059 2132 2646 8813 7870 2521 2522 5158 5157 4623 4624 4957 49...
output:
26 5600 5599 4633 1709 1710 1711 4400 4399 4398 3369 3370 447 1386 1387 1388 1257 1256 1255 2098 2097 4270 4644 7246 6836 6837 5934 8720 8721 8722 3517 3516 8311 9691 9690 107 106 3014 3013 3012 7147 2636 6366 4717 8064 8065 8066 2158 2157 5941 7777 7778 5963
result:
ok
Test #43:
score: 0
Accepted
time: 3ms
memory: 12812kb
input:
10000 5462 4989 4542 4541 7300 8478 4730 3574 7930 7051 750 7627 117 3045 4274 4275 3840 3841 5706 3638 7108 7107 28 29 2564 2563 2784 2393 1193 1192 2040 1286 3688 3687 8048 2319 2404 2405 8641 8640 6992 8729 5085 5086 5130 5131 6813 9806 6592 6769 2806 2805 7482 6021 7371 3994 4939 3217 1905 6540 ...
output:
58 5185 5186 9954 8680 9363 9362 2548 6498 6499 6602 6603 4906 1827 9025 9024 4180 6167 6166 6165 2225 850 8685 473 472 4525 4526 3852 3853 412 8904 8746 2605 2604 174 5775 2675 2674 5495 5494 2817 5579 5580 5581 3755 3754 6202 6201 6523 6522 8448 8606 8605 8604 7485 7486 7487 7416 7417 3402 7158 7...
result:
ok
Test #44:
score: 0
Accepted
time: 49ms
memory: 38372kb
input:
99999 49253 51314 3093 3092 88617 72981 43336 77222 65739 55450 5166 90677 57235 57234 51512 51511 73274 86124 86611 77777 21808 21809 2794 2795 64109 69571 80102 80101 56177 27689 55899 58255 16908 16909 53732 53733 9213 9214 33157 33158 10706 10707 76016 11308 51459 74662 58149 58150 80976 56845 2...
output:
139 52446 52447 7620 29380 29381 29382 38779 38780 38781 2653 2652 2651 6396 6397 6398 6399 98578 98577 40195 75136 91533 12329 12330 54398 69631 85641 9887 73844 73843 18956 18955 18954 18953 18952 88199 88198 16804 42509 42508 14234 32446 58627 35987 23163 10602 73225 42463 42462 42461 24981 18583...
result:
ok
Test #45:
score: 0
Accepted
time: 40ms
memory: 37360kb
input:
96827 15894 15895 33528 48199 50450 50451 63703 63702 49937 31980 93823 45726 96052 96051 54334 16426 9193 11656 49315 10079 10614 33488 84027 84028 3612 5321 64903 64904 56901 32611 33578 68521 47938 47939 32618 53239 89613 89612 82729 82728 34512 34511 54064 38673 56419 56420 23775 75336 85989 172...
output:
38 51485 51486 46842 84571 84570 84569 68751 40616 40617 95712 60949 82389 82388 82387 77517 77518 77519 77520 77521 72725 72726 72727 48310 48311 4067 8589 15898 15899 71554 71555 71556 71557 53647 82402 49675 51482 51483 51484 48866 55628 48081 34858 34859 43751 8555 90715 90716 26645 2256 96064 ...
result:
ok
Test #46:
score: 0
Accepted
time: 39ms
memory: 35036kb
input:
100000 72105 72104 4352 4351 59159 59160 78993 64103 39235 39234 4458 36615 23543 53027 54635 54634 80821 80822 8720 72158 49535 78364 64357 3035 93490 6597 52195 13285 70186 70187 14748 98067 15516 71738 77617 77616 68836 68835 61569 61570 28477 28289 50823 50822 71759 49859 59464 59463 83701 83702...
output:
52 4594 46947 58546 54453 54452 18525 14122 85232 85721 85720 31696 75585 66085 79718 28363 28362 62464 88496 78914 36584 38185 41965 82316 69040 79239 58918 36435 36436 11715 11714 47864 47865 57865 57864 43138 29857 39561 72150 72151 54765 89713 89712 54244 54245 54246 54247 73216 76441 23642 2364...
result:
ok
Test #47:
score: 0
Accepted
time: 42ms
memory: 36652kb
input:
100000 53877 17887 7877 7878 35510 37710 15520 83926 7572 7573 11839 11840 75139 75140 63678 63679 66199 66198 3262 3263 78203 78204 87574 87575 53474 67658 86593 86594 28943 17005 71369 264 3802 41402 30583 30584 38511 38510 36776 90902 57208 57209 15408 48313 73488 46167 88419 93118 57411 57412 42...
output:
35 35430 47260 22486 22485 90482 75599 43729 43728 32424 32423 32422 91818 91817 18789 41695 41696 34493 96958 33025 5374 5375 84666 84665 1331 5675 5674 71485 93403 93402 86484 21506 21507 21508 72795 72794 31697 59915 59914 59913 16737 22672 22671 22670 1133 74178 74177 74176 91129 91128 50703 50...
result:
ok
Test #48:
score: 0
Accepted
time: 43ms
memory: 39008kb
input:
100000 78895 34726 20392 44705 57147 22069 31133 31132 78946 78947 53758 53757 68970 68971 75904 87094 12439 12438 92849 92848 80817 80818 76732 53635 79930 79931 78362 78363 87661 87662 47807 47808 73696 27386 30646 30645 17648 81813 47120 47119 84905 84906 87235 8058 8238 88843 86537 12191 68784 6...
output:
50 8474 70552 43181 9704 9705 9706 15831 18390 18389 18388 40174 41895 42736 42735 16508 36526 14808 14807 6411 53336 28850 28851 66903 60109 42757 42758 42759 42760 12370 91949 63934 7774 72519 84562 84561 15432 17030 5767 5766 23235 23236 23237 41328 3667 69427 69428 53172 97675 17033 8473 21649 ...
result:
ok
Test #49:
score: 0
Accepted
time: 32ms
memory: 37472kb
input:
94055 34740 73546 30256 30255 20298 20299 62592 62591 49467 49468 65041 2277 38788 38787 58735 65469 2375 2376 77665 77666 36242 80298 75550 16701 13820 64701 83448 83449 79313 83990 2213 2212 22172 22171 72441 92184 10391 30730 39194 38883 25064 90160 69140 85068 50433 31078 58353 4381 38997 38998 ...
output:
130 65607 65606 65605 65604 79062 11298 87819 47289 47290 47291 78410 78411 56748 36654 36653 15513 15512 55325 17503 79798 68346 55352 55351 61843 61844 14682 51046 51045 51044 57654 83649 83648 6223 56718 82191 82190 59006 35126 2883 2884 40190 5614 5613 67547 67379 68933 44076 93953 16622 14638 1...
result:
ok
Test #50:
score: 0
Accepted
time: 3ms
memory: 9796kb
input:
7 6 2 4 3 3 7 7 6 1 2 7 2 1 5 6 5 4 5 5 7 2 3
output:
5 5 1 2 6 7 2 1 5 4 3
result:
ok
Test #51:
score: 0
Accepted
time: 39ms
memory: 38272kb
input:
99084 7128 52592 26282 84361 19470 70586 2431 2430 33596 72767 70001 70000 65483 65484 76493 76492 62792 39465 4476 31233 72512 72511 94244 69778 84662 84663 32214 32213 4717 4718 73918 26226 71389 71390 45765 45764 87589 87590 6207 6206 47094 70119 30908 29826 34602 40286 44413 44412 21890 21889 24...
output:
133 30358 88080 88081 88082 45898 45897 45896 45895 7432 18938 90340 10464 10465 10466 10467 10468 247 248 12998 12999 38919 72702 72703 81009 81008 7408 49309 49310 49311 61069 94502 15950 15951 605 34974 34973 91337 63770 63769 28123 6449 82032 82031 62540 62539 99057 68858 8897 53460 93926 77559 ...
result:
ok
Test #52:
score: 0
Accepted
time: 3ms
memory: 9832kb
input:
8 6 5 3 4 2 3 3 7 2 4 6 7 4 8 5 2 2 1 1 6 7 8 5 4 8 1
output:
5 2 5 4 8 1 6 7 3 2 5
result:
ok
Test #53:
score: 0
Accepted
time: 2ms
memory: 9804kb
input:
9 6 7 7 3 9 8 4 3 2 1 6 2 6 8 5 6 7 8 1 4 9 4 4 5 9 6 1 9 2 3
output:
5 9 1 2 6 8 2 1 9 4 3
result:
ok
Test #54:
score: 0
Accepted
time: 0ms
memory: 9956kb
input:
9 5 4 1 5 3 2 1 2 2 9 6 7 1 8 3 4 7 5 5 6 5 9 6 3 9 1 7 8 8 9
output:
3 5 7 6 9 5 1
result:
ok
Test #55:
score: 0
Accepted
time: 2ms
memory: 9836kb
input:
10 1 8 10 9 4 9 6 4 2 1 2 3 7 2 4 5 10 3 5 8 2 9 6 5 8 9 4 8 6 7 7 8 3 4
output:
4 2 9 10 3 3 10 9 4
result:
ok
Test #56:
score: 0
Accepted
time: 0ms
memory: 9840kb
input:
9 5 6 8 7 1 2 5 2 8 6 6 9 9 8 2 9 4 7 4 1 4 5 6 1 2 3 3 4 7 6
output:
4 4 5 2 1 5 2 1 6
result:
ok
Test #57:
score: 0
Accepted
time: 2ms
memory: 9720kb
input:
10 1 2 3 2 6 8 5 4 5 6 8 7 4 1 6 7 4 3 2 5 3 10 8 9 6 2 10 1 9 3 8 4 9 10
output:
7 3 4 8 9 10 1 2 2 1 10 9 8 6 5
result:
ok
Test #58:
score: 0
Accepted
time: 2ms
memory: 9704kb
input:
9 3 6 2 1 5 6 9 7 4 2 4 3 1 3 8 9 1 5 6 7 4 6 1 9 7 8 4 5 2 3
output:
4 1 2 4 5 4 2 1 3
result:
ok
Test #59:
score: 0
Accepted
time: 2ms
memory: 9720kb
input:
4 1 2 4 1 4 3 3 1 4 2
output:
3 4 1 3 1 4 2
result:
ok
Test #60:
score: 0
Accepted
time: 2ms
memory: 9792kb
input:
10 8 10 10 9 7 8 8 3 6 3 1 3 9 6 1 8 5 10 3 4 10 4 3 9 2 1 1 9 6 5 6 10 9 5
output:
3 3 1 9 1 3 8
result:
ok
Test #61:
score: 0
Accepted
time: 2ms
memory: 9912kb
input:
1000 937 387 833 217 405 422 502 356 529 374 497 662 803 845 726 979 999 43 463 620 749 828 661 573 191 708 513 963 737 819 439 571 787 166 873 842 993 566 590 908 34 184 699 314 756 255 996 242 653 402 451 656 90 762 562 382 945 397 600 816 789 890 378 965 613 827 319 645 156 684 477 570 131 419 43...
output:
8 424 107 96 379 605 367 388 675 134 238 560 315 96 379 605 80
result:
ok
Test #62:
score: 0
Accepted
time: 6ms
memory: 12532kb
input:
9999 2524 8191 1533 7530 356 1008 8210 3560 2071 540 2876 4324 9158 3771 2872 5625 4701 4769 4728 2104 2264 9841 4009 2392 9900 4852 9836 1027 3996 1557 97 1319 5587 7722 7488 4073 2940 9762 246 6394 380 6935 7929 3557 8049 8841 2105 7255 2710 6626 7926 6255 8392 6949 6174 2040 9959 8955 8701 3730 5...
output:
58 187 1342 5567 8748 1624 3368 622 1135 6855 8836 106 7180 9344 7549 5645 1528 2583 7220 6507 6279 5664 3591 6367 8269 4238 4211 969 2860 767 5063 438 7115 8758 2169 9664 9807 1392 7722 8195 1386 44 9969 7958 9641 8596 1839 1654 434 9575 4595 6334 9767 181 315 449 5857 5272 8610 7884 9804 9296 809...
result:
ok
Test #63:
score: 0
Accepted
time: 6ms
memory: 12020kb
input:
10000 8697 615 9680 5350 5924 4698 4478 7356 3510 7535 6046 3305 885 4890 8224 2297 2267 8411 7331 7035 1747 7766 3540 1409 4143 212 9541 5746 1062 539 2060 9566 5293 350 6143 2220 1446 2866 4603 4151 9625 5078 3432 4169 1528 1525 9522 2738 3154 3100 8560 9024 1200 4420 3138 9200 2346 182 1694 6303 ...
output:
25 8254 651 9681 8328 9476 303 2433 4247 806 4154 5260 8908 3984 3220 8265 6812 4443 9436 9863 3321 7140 2003 4126 9995 8604 892 6177 9393 9681 8328 9476 303 2433 4247 806 4154 5260 8908 1921 4323 4658 2450 1869 8843 5489 1409 9754 4555 3167 1742
result:
ok
Test #64:
score: 0
Accepted
time: 40ms
memory: 39996kb
input:
99999 84520 53880 95569 33800 30674 78149 34453 98159 29766 87018 38710 45543 78103 64279 95388 6083 90709 6245 28076 59536 89121 25989 17455 86681 24869 49677 88947 54071 59069 14675 2211 80543 84618 24731 71749 96646 3072 81888 41124 19659 78748 83891 86353 92485 51719 3101 86489 39980 2846 67916 ...
output:
9 33633 39705 37753 8196 1369 98095 53560 5606 80812 23086 77968 39463 95163 51107 90238 64521 92737 80083
result:
ok
Test #65:
score: 0
Accepted
time: 44ms
memory: 35752kb
input:
91648 4472 25803 85060 29770 38233 78885 69505 11992 74584 56733 44447 19721 38611 47816 64374 1051 85078 88959 3376 77926 30914 66149 47776 2665 24048 19740 63674 58321 31035 27289 28597 78620 26732 63968 3921 28544 88344 48945 17800 78918 39469 31300 58279 76356 88378 67190 87900 74995 96 31664 86...
output:
94 13802 17208 16164 85308 3707 51666 58574 81664 932 33048 4327 52651 80555 40015 91511 62274 6472 61339 5227 85107 20243 64914 83487 25508 2949 65767 90413 17101 11364 60231 21248 15353 18410 71920 90983 85254 86996 38709 67575 16845 49152 28796 90405 70571 89048 23135 15930 22113 30354 45802 6948...
result:
ok
Test #66:
score: 0
Accepted
time: 41ms
memory: 36908kb
input:
100000 13352 1027 26975 28733 58784 97055 76806 68544 9735 23022 13365 25281 80851 10373 95287 91860 59771 31042 51912 68412 26741 29961 34375 25709 13755 46111 50736 39736 95695 18184 57397 62912 97590 59408 6754 50322 16563 80551 76371 58366 31788 49867 41825 95414 16211 24996 32999 62870 4946 820...
output:
18 26018 84792 91944 39608 46443 72219 7761 33597 6192 23444 9512 62602 15541 80106 31049 71664 14985 81453 33419 84027 91607 22736 53513 46373 61103 73533 80420 79981 72285 79740 67157 55926 34954 36971 95200 59288
result:
ok
Test #67:
score: 0
Accepted
time: 44ms
memory: 37512kb
input:
100000 20959 25336 91898 62660 72720 51175 61002 85224 24094 15898 17841 75902 96298 91723 60352 50707 73566 69660 14089 5220 50982 29437 79898 86395 1734 56103 52555 46603 63369 73948 72151 60200 25210 3152 38452 28051 85173 32730 57691 99457 69691 30053 2072 97708 97968 56344 65532 44367 12342 346...
output:
17 51980 20741 27332 36899 44714 60207 50931 11772 88337 91918 88302 93253 34505 23507 15811 75844 70787 46854 62512 12263 36538 88947 68605 2028 55045 82762 61634 50762 33317 74374 68935 13015 65124 75250
result:
ok
Test #68:
score: 0
Accepted
time: 45ms
memory: 38364kb
input:
100000 16435 98228 89180 57831 43189 90862 16293 29922 91964 47722 34278 901 54950 37026 95302 76757 42452 74646 38280 38053 65541 27258 36041 61691 27600 40344 23817 62272 71323 52794 81547 61348 39381 11415 52865 23221 79787 93823 91146 34985 66479 79975 16439 79659 36874 49350 50891 86175 33479 5...
output:
49 70639 37812 40604 12467 32973 34757 78198 92034 70884 67218 63088 69618 83987 84871 90775 51060 32636 87463 12736 67670 94182 48763 25347 93536 8313 64400 30650 81024 38709 3837 68419 97541 97983 90667 89286 35585 21054 2063 57140 59892 97514 21556 1053 68997 54045 96577 75694 66252 21508 42855 ...
result:
ok
Test #69:
score: 0
Accepted
time: 47ms
memory: 38648kb
input:
95728 48566 69797 54999 85490 75942 40279 51954 81016 58241 2418 39067 29211 81791 12312 77375 65571 56275 38417 19545 83406 22125 73565 35590 62148 23344 55309 39501 86411 68603 19541 75927 74829 9467 14763 65439 91977 45467 52791 94490 35940 32928 3568 76229 95312 78704 76042 23090 10023 59356 602...
output:
115 59301 48128 60033 16581 72838 53571 22218 94781 3260 26097 14980 23544 61358 85950 31011 79682 11819 63450 30981 49456 27189 9101 60777 33421 94792 83835 33651 89928 4775 42906 47118 75614 62161 612 75442 12166 85124 24590 42094 77121 74728 65749 87246 8486 73169 36317 38511 78442 8705 44494 681...
result:
ok
Test #70:
score: 0
Accepted
time: 3ms
memory: 9660kb
input:
5 2 4 2 3 5 3 5 1 1 3 4 5 1 2
output:
4 1 5 4 2 5 4 2 3
result:
ok
Test #71:
score: 0
Accepted
time: 32ms
memory: 35416kb
input:
93309 71437 20546 7225 87604 42872 46689 48394 70601 79628 80229 46286 21730 85596 24788 78402 13849 4309 88242 46678 82455 59146 64364 43993 73409 35381 77031 24159 45740 49493 15690 53789 31467 78790 88954 13595 76316 85033 35716 5254 44215 33086 43366 81849 23644 22197 53918 78118 73130 44242 230...
output:
54 38773 64073 18536 55903 87239 78603 91952 8440 35107 68194 61124 34968 46546 85478 43801 63349 79641 50817 38649 37729 45357 31691 29454 88158 2683 3323 82143 92877 35766 39338 14150 27624 31756 42441 42867 35468 60073 48010 13353 17773 7212 48115 69689 49482 54678 23642 7813 43898 83203 15568 28...
result:
ok
Test #72:
score: 0
Accepted
time: 0ms
memory: 9784kb
input:
6 5 3 1 3 5 2 5 1 3 6 6 4 1 2 5 6 3 2
output:
3 1 5 3 3 5 2
result:
ok
Test #73:
score: 0
Accepted
time: 2ms
memory: 9760kb
input:
7 6 3 5 4 7 1 1 6 3 1 7 3 2 7 7 4 3 5 2 5 7 5
output:
4 7 3 5 4 1 7 3 6
result:
ok
Test #74:
score: 0
Accepted
time: 0ms
memory: 9724kb
input:
8 5 1 7 6 7 3 7 5 1 8 3 2 6 5 1 4 6 1 7 8 6 3 7 4 8 6
output:
5 7 4 1 6 3 8 7 4 1 6
result:
ok
Test #75:
score: 0
Accepted
time: 2ms
memory: 9728kb
input:
9 1 3 4 8 2 4 8 6 5 4 8 5 9 2 9 4 8 9 1 6 2 3 5 2 4 7 7 1 9 5
output:
3 8 4 5 5 9 2
result:
ok
Test #76:
score: 0
Accepted
time: 2ms
memory: 7796kb
input:
10 6 5 8 3 8 9 9 10 3 4 10 6 7 8 6 9 2 3 4 7 6 8 4 10 6 3 6 4 5 10 5 4 9 5
output:
5 8 3 4 10 9 6 10 4 3 8
result:
ok
Test #77:
score: 0
Accepted
time: 2ms
memory: 9788kb
input:
9 6 5 5 8 7 8 2 3 7 2 3 6 5 2 9 1 6 4 5 3 5 7 4 2 4 7 3 1 9 7
output:
3 6 3 5 2 5 3
result:
ok
Test #78:
score: 0
Accepted
time: 2ms
memory: 9984kb
input:
10 3 6 10 4 3 7 2 3 3 8 8 9 10 9 2 10 6 5 4 3 4 2 1 3 8 6 5 1 10 1 10 7 10 6
output:
4 10 7 3 6 10 7 3 1
result:
ok