QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#508116 | #3501. Jail | Dimash | 10 | 1288ms | 391532kb | C++20 | 3.8kb | 2024-08-07 03:41:28 | 2024-08-07 03:41:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 24e4 + 2, MOD = (int)1e9+7;
int n,x[N],y[N],m,it = 1,it1 = 1,s[N],f[N];
vector<int> g[N],G[N * 20];
int up[N][20],t[N][20],t1[N][20],tin[N],tout[N],timer = 0;
const int b = 18;
void dfs(int v,int pr) {
tin[v] = ++timer;
up[v][0] = pr;
if(!x[v]) {
t[v][0] = ++it;
} else {
t[v][0] = x[v];
}
if(!y[v]) {
t1[v][0] = ++it;
} else {
t1[v][0] = y[v];
}
for(int i = 1;i <= b;i++) {
up[v][i] = up[up[v][i-1]][i-1];
t[v][i] = ++it;
t1[v][i] = ++it;
// cout << t[v][i] << ' ' << t[v][i - 1] << "\n" ;
// cout << t[v][i] << ' ' << t[up[v][i-1]][i - 1] << '\n';
G[t[v][i]].push_back(t[v][i-1]);G[t[v][i]].push_back(t[up[v][i-1]][i-1]);
G[t1[v][i-1]].push_back(t1[v][i]);G[t1[up[v][i-1]][i-1]].push_back(t1[v][i]);
}
for(int to:g[v]) {
if(to == pr) continue;
dfs(to,v);
}
tout[v] = ++timer;
}
int vis[N * 20];
bool ans = 1;
void go(int v) {
vis[v] = 1;
for(int to:G[v]) {
if(!vis[to]) {
// cout << v << ' ' << to << '\n';
go(to);
} else {
if(vis[to] == 1) {
ans = 0;
}
}
}
vis[v] = 2;
}
bool is(int v,int u) {
return (tin[v] <= tin[u] && tout[v] >= tout[u]);
}
int lca(int v,int u) {
if(is(v,u)) return v;
if(is(u,v)) return u;
for(int i = b;i >= 0;i--) {
if(!is(up[v][i],u)) {
v = up[v][i];
}
}
return up[v][0];
}
void add(int v,int l,int id,bool ok = 1) {
for(int i = b;i >= 0;i--) {
if(!is(up[v][i],l)) {
G[id].push_back(t[v][i]);
v = up[v][i];
}
}
// cout << id << ' ' << t[v][1] << '\n';
// cout << v << ' ' << l << '\n';
if(ok)G[id].push_back(t[v][1]);
else{
G[id].push_back(t[v][0]);
// cout << id << ' ' << t[v][0] << '\n';
}
}
void add_(int v,int l,int id,bool ok = 1) {
if(!is(l,v) || (l == v && ok)) return;
// cout << v << ' ' << l << ' ' << id << ' ' << ok << '\n';
// cout << v << ' ' << l << "x\n";
for(int i = b;i >= 0;i--) {
if(!is(up[v][i],l)) {
// cout << t1[v][i] << ' ' << id << '\n';
G[t1[v][i]].push_back(id);
v = up[v][i];
}
}
// cout << t1[v][1] << ' ' << id << '\n';
// cout << "x\n";
if(ok)G[t1[v][1]].push_back(id);
else{
G[t1[v][0]].push_back(id);
// cout << t1[v][0] << ' ' << id << '\n';
}
}
void test() {
ans = 1;
timer = 0;
cin >> n;
for(int i = 1;i <= n;i++) {
g[i].clear();
x[i] = y[i] =0 ;
}
for(int i = 1;i <= n - 1;i++) {
int a,b;
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
cin >> m;
it = it1 = m;
for(int i = 1;i <= m;i++) {
cin >> s[i] >> f[i];
y[f[i]] = x[s[i]] = i;
}
dfs(1,1);
for(int i = 1;i <= m;i++) {
int l = lca(s[i],f[i]);
if(s[i] == l) {
add(f[i],l,i,0);
} else {
add(up[s[i]][0],l,i,1);
if(f[i] != l) add(f[i],l,i,1);
}
if(f[i] == l) {
add_(s[i],l,i,0);
} else {
add_(up[f[i]][0],l,i,1);
if(s[i] != l) add_(s[i],l,i,1);
}
}
for(int i = 1;i <= it;i++) {
if(!vis[i]) {
go(i);
}
}
cout << (ans ? "Yes\n":"No\n");
for(int i = 1;i <= it;i++) {
G[i].clear();
vis[i] =0;
}
}
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);
int t = 1;
cin >> t;
while(t--) {
test();
}
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 3ms
memory: 15940kb
input:
1 2 1 2 2 1 2 2 1
output:
No
result:
ok single line: 'No'
Test #2:
score: 5
Accepted
time: 27ms
memory: 16244kb
input:
462 120 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 ...
output:
No Yes Yes No Yes No Yes No Yes No No Yes No No No No No No No No No Yes Yes Yes Yes No No Yes No No No No No No No Yes Yes No Yes No No No No No No No No No No No No No No No No Yes Yes Yes No Yes Yes No Yes Yes No Yes Yes No Yes Yes No No Yes Yes No No Yes No No Yes No No Yes No No Yes No No No Ye...
result:
ok 462 lines
Test #3:
score: 5
Accepted
time: 55ms
memory: 16220kb
input:
1000 120 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...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 1000 lines
Test #4:
score: 5
Accepted
time: 9ms
memory: 16512kb
input:
20 250 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:
Yes Yes Yes Yes Yes Yes No No Yes No No No Yes No No No Yes No No Yes
result:
ok 20 lines
Test #5:
score: 5
Accepted
time: 6ms
memory: 16560kb
input:
20 250 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:
Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No Yes
result:
ok 20 lines
Test #6:
score: 5
Accepted
time: 10ms
memory: 16588kb
input:
20 250 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:
Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No Yes
result:
ok 20 lines
Test #7:
score: 5
Accepted
time: 148ms
memory: 28768kb
input:
20 6000 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 ...
output:
Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No Yes
result:
ok 20 lines
Test #8:
score: 5
Accepted
time: 977ms
memory: 326372kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #9:
score: 5
Accepted
time: 13ms
memory: 15980kb
input:
1000 21 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 4 1 2 7 4 15 8 17 12 21 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 7 1 2 3 4 5 8 7 10 9 14 15 18 17 20 21 1 2 2 3 3 4 4 5 5 6 6 7...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ...
result:
ok 1000 lines
Test #10:
score: 5
Accepted
time: 76ms
memory: 16364kb
input:
1000 120 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...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ...
result:
ok 1000 lines
Test #11:
score: 5
Accepted
time: 792ms
memory: 323360kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #12:
score: 5
Accepted
time: 815ms
memory: 322428kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #13:
score: 5
Accepted
time: 1038ms
memory: 346804kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #14:
score: 5
Accepted
time: 1288ms
memory: 391532kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #15:
score: 5
Accepted
time: 1021ms
memory: 359820kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #16:
score: 5
Accepted
time: 842ms
memory: 325612kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #17:
score: 5
Accepted
time: 941ms
memory: 329436kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #18:
score: 5
Accepted
time: 967ms
memory: 338504kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #19:
score: 5
Accepted
time: 971ms
memory: 353428kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #20:
score: 5
Accepted
time: 766ms
memory: 324892kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Subtask #2:
score: 5
Accepted
Test #21:
score: 5
Accepted
time: 9ms
memory: 16580kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 3 23 1 24 24 25 25 26 5 26 1 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 7 42 2 43 43 44 44 45 45 46 4 46 2 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 12 55 2 56 56 57 57 58 58 59 59 ...
output:
No No No No No No Yes Yes Yes Yes Yes Yes Yes No No No No No Yes Yes
result:
ok 20 lines
Test #22:
score: 5
Accepted
time: 9ms
memory: 16612kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 3 23 1 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 5 32 1 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 7 41 2 42 42 43 43 44 44 45 45 46 46 47 4 47 2 48 48 49 49 50 50 51 51 52 52 53 53 54 12 54 2 55 55 56 56 57 57 58 58 59 14 ...
output:
Yes Yes Yes Yes Yes No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #23:
score: 5
Accepted
time: 8ms
memory: 12540kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 3 24 1 25 25 26 26 27 27 28 28 29 29 30 30 31 5 31 1 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 7 39 2 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 4 48 2 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 12 58 2 59 59 ...
output:
Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No
result:
ok 20 lines
Test #24:
score: 5
Accepted
time: 6ms
memory: 16568kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 3 20 1 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 5 31 1 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 7 49 2 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 4 58 2 59 59 60 60...
output:
No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #25:
score: 5
Accepted
time: 5ms
memory: 16476kb
input:
20 250 1 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 3 31 1 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 5 39 1 40 40 41 41 42 42 43 43 44 44 45 7 45 2 46 46 47 47 48 48 49 49 50 50 51 4 51 2 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 12...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #26:
score: 5
Accepted
time: 8ms
memory: 16568kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 3 20 1 21 21 22 22 23 23 24 24 25 25 26 26 27 5 27 1 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 7 37 2 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 4 46 2 47 47 48 12 48 2 49 49 50 50 51 14 51 3 52 52 53 53 54 54 55 55 56 56 57 57 58 58 5...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #27:
score: 5
Accepted
time: 4ms
memory: 16644kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 3 21 1 22 22 23 23 24 24 25 5 25 1 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 7 39 2 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 4 47 2 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 12 56 2 57 57 58 58 59 59 ...
output:
Yes No No No No No No Yes Yes Yes Yes Yes Yes No No No No No No Yes
result:
ok 20 lines
Test #28:
score: 5
Accepted
time: 4ms
memory: 16488kb
input:
17 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 3 21 1 22 22 23 23 24 24 25 25 26 26 27 27 28 5 28 1 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 7 39 2 40 40 41 41 42 4 42 2 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 12 54 2 55 55 56 56 57 57 58 58 59 59 ...
output:
Yes Yes Yes Yes Yes No No No No No No Yes Yes Yes Yes Yes Yes
result:
ok 17 lines
Test #29:
score: 5
Accepted
time: 7ms
memory: 16568kb
input:
20 4 1 2 1 3 1 4 2 1 4 4 1 250 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 ...
output:
No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes
result:
ok 20 lines
Test #30:
score: 5
Accepted
time: 7ms
memory: 14512kb
input:
20 7 1 2 1 3 2 4 2 5 3 6 3 7 2 1 2 2 1 250 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 31 16 32 16 33 17 34 17 35 18 36 18 37 19 38 19 39 20 40 20 41 21 42 21 43 22 44 22 45 23 46 23 47 24 48 2...
output:
No No Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes
result:
ok 20 lines
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #31:
score: 16
Accepted
time: 0ms
memory: 16636kb
input:
20 250 1 2 1 3 3 4 2 5 4 6 6 7 1 8 6 9 8 10 7 11 4 12 11 13 8 14 14 15 1 16 15 17 17 18 11 19 2 20 13 21 2 22 2 23 12 24 14 25 22 26 23 27 12 28 17 29 22 30 30 31 14 32 10 33 5 34 15 35 26 36 10 37 21 38 22 39 2 40 31 41 20 42 22 43 43 44 26 45 36 46 5 47 10 48 45 49 15 50 34 51 49 52 15 53 3 54 28 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #32:
score: 16
Accepted
time: 9ms
memory: 16652kb
input:
20 250 1 2 2 3 3 4 2 5 3 6 5 7 6 8 8 9 9 10 9 11 9 12 9 13 13 14 12 15 13 16 13 17 15 18 15 19 19 20 17 21 21 22 19 23 21 24 21 25 23 26 25 27 26 28 26 29 28 30 30 31 28 32 29 33 32 34 32 35 32 36 35 37 35 38 37 39 37 40 38 41 39 42 40 43 41 44 43 45 45 46 45 47 44 48 48 49 47 50 47 51 50 52 49 53 5...
output:
Yes No No No Yes No No Yes No No Yes No No No Yes Yes No Yes No No
result:
ok 20 lines
Test #33:
score: 16
Accepted
time: 6ms
memory: 15904kb
input:
20 15 1 2 1 3 3 4 4 5 2 6 6 7 5 8 6 9 9 10 8 11 8 12 11 13 12 14 13 15 3 15 14 14 10 10 7 15 1 2 1 3 1 4 2 5 2 6 6 7 6 8 8 9 8 10 9 11 10 12 11 13 11 14 14 15 3 3 7 4 15 12 3 15 1 2 1 3 3 4 1 5 4 6 6 7 5 8 8 9 7 10 10 11 8 12 9 13 12 14 14 15 3 13 11 2 15 15 13 15 1 2 1 3 1 4 4 5 4 6 3 7 7 8 8 9 6 1...
output:
Yes Yes Yes Yes Yes Yes No Yes Yes No No No No Yes Yes Yes Yes Yes Yes No
result:
ok 20 lines
Test #34:
score: 16
Accepted
time: 4ms
memory: 16560kb
input:
20 250 1 2 2 3 1 4 1 5 3 6 5 7 5 8 5 9 8 10 7 11 8 12 12 13 10 14 12 15 12 16 13 17 14 18 15 19 19 20 20 21 21 22 19 23 20 24 23 25 25 26 23 27 26 28 27 29 28 30 27 31 29 32 32 33 30 34 32 35 34 36 36 37 36 38 37 39 38 40 39 41 41 42 40 43 43 44 41 45 44 46 44 47 47 48 46 49 47 50 47 51 49 52 49 53 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No No Yes Yes No No Yes
result:
ok 20 lines
Test #35:
score: 16
Accepted
time: 8ms
memory: 16556kb
input:
20 250 1 2 2 3 2 4 4 5 3 6 6 7 6 8 6 9 9 10 9 11 9 12 12 13 11 14 12 15 15 16 14 17 17 18 18 19 17 20 18 21 19 22 21 23 21 24 22 25 25 26 26 27 26 28 28 29 29 30 28 31 30 32 32 33 31 34 32 35 34 36 34 37 35 38 36 39 38 40 40 41 41 42 41 43 42 44 44 45 43 46 44 47 47 48 48 49 49 50 48 51 50 52 52 53 ...
output:
Yes Yes Yes Yes Yes No No Yes Yes No No Yes No Yes No No No Yes No Yes
result:
ok 20 lines
Test #36:
score: 16
Accepted
time: 8ms
memory: 12432kb
input:
20 250 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1...
output:
No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #37:
score: 16
Accepted
time: 6ms
memory: 15948kb
input:
20 12 1 2 2 3 2 4 4 5 1 6 7 8 8 9 8 10 10 11 7 12 1 7 6 1 12 2 11 3 10 4 9 5 8 6 7 12 1 2 1 3 1 4 1 5 1 6 7 8 7 9 7 10 7 11 7 12 1 7 6 1 8 2 7 3 9 4 12 5 11 6 10 12 1 2 2 3 1 4 1 5 4 6 7 8 8 9 7 10 7 11 10 12 1 7 6 1 9 2 8 3 11 4 10 5 12 6 7 12 1 2 2 3 2 4 2 5 1 6 7 8 8 9 8 10 8 11 7 12 1 7 6 1 9 2 ...
output:
Yes Yes Yes Yes No No No No No No Yes Yes Yes Yes Yes No Yes No Yes No
result:
ok 20 lines
Test #38:
score: 0
Wrong Answer
time: 3ms
memory: 12068kb
input:
20 7 1 5 1 4 1 7 1 3 1 6 1 2 5 3 5 6 3 2 4 4 6 7 2 7 2 6 2 5 2 7 2 4 1 2 2 3 6 5 7 3 1 7 3 6 4 1 6 4 5 7 1 6 1 7 1 5 1 2 1 4 1 3 6 6 4 2 3 7 6 5 2 4 5 3 7 7 2 7 4 7 6 7 1 7 3 7 5 7 5 1 3 7 6 3 5 4 2 5 4 7 2 7 6 7 5 7 1 7 3 7 4 7 6 6 1 7 2 2 3 3 4 5 6 4 5 13 1 5 1 11 6 8 5 13 2 7 4 9 5 7 3 5 5 8 3 10...
output:
Yes No No No No Yes No No Yes No No Yes Yes Yes Yes Yes Yes Yes No Yes
result:
wrong answer 4th lines differ - expected: 'Yes', found: 'No'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Wrong Answer
Test #66:
score: 0
Wrong Answer
time: 37ms
memory: 12312kb
input:
1000 10 1 2 2 3 1 4 4 5 4 6 4 7 2 8 8 9 3 10 2 5 4 1 9 10 1 2 1 3 1 4 4 5 4 6 3 7 3 8 2 9 6 10 2 2 9 1 5 10 1 2 2 3 1 4 4 5 4 6 2 7 3 8 2 9 1 10 2 10 2 7 5 10 1 2 1 3 1 4 2 5 1 6 3 7 2 8 7 9 2 10 2 10 5 2 7 10 1 2 1 3 1 4 3 5 5 6 3 7 7 8 1 9 8 10 2 6 7 1 2 10 1 2 1 3 3 4 2 5 4 6 3 7 1 8 4 9 1 10 2 1...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes No Yes Yes No No No No No No Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes No No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Y...
result:
wrong answer 51st lines differ - expected: 'Yes', found: 'No'
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
0%