# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
256018 |
2020-08-02T08:20:46 Z |
최은수(#5029) |
Joker (BOI20_joker) |
C++17 |
|
2000 ms |
6780 KB |
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18+7;
int pa[200010],pr[200010];
inline pi par(int x)
{
int y=0;
int z=x;
while(pa[z]!=0)
y^=pr[z],z=pa[z];
int w=y;
while(pa[x]!=0)
{
int nx=pa[x];
int nw=w^pr[x];
pa[x]=z;
pr[x]=w;
x=nx;
w=nw;
}
return pi(z,y);
}
inline void uni(int x,int y)
{
int odd=par(x).se^par(y).se;
x=par(x).fi;
y=par(y).fi;
if(x==y)
return;
pa[x]=y;
pr[x]=odd^1;
return;
}
inline void clear(int n)
{
fill(pa,pa+n+1,0);
return;
}
int ans[200010];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,m,q;
cin>>n>>m>>q;
vector<pi>edge(m);
for(pi&t:edge)
cin>>t.fi>>t.se;
vector<pi>qv(q);
vector<int>cv;
for(pi&t:qv)
cin>>t.fi>>t.se,cv.eb(--t.fi);
sort(all(cv));
cv.erase(unique(all(cv)),cv.end());
for(int&cl:cv)
{
clear(n);
ans[cl]=-1;
for(int i=0;i<cl;i++)
{
int u=edge[i].fi,v=edge[i].se;
if(par(u)==par(v))
{
ans[cl]=m;
break;
}
uni(u,v);
}
if(ans[cl]!=-1)
continue;
for(int i=m;--i>cl;)
{
int u=edge[i].fi,v=edge[i].se;
if(par(u)==par(v))
{
ans[cl]=i;
break;
}
uni(u,v);
}
}
for(pi&t:qv)
cout<<(ans[t.fi]<t.se?"NO\n":"YES\n");
cout.flush();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
384 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
384 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
12 ms |
384 KB |
Output is correct |
30 |
Correct |
16 ms |
384 KB |
Output is correct |
31 |
Correct |
16 ms |
384 KB |
Output is correct |
32 |
Correct |
10 ms |
384 KB |
Output is correct |
33 |
Correct |
6 ms |
384 KB |
Output is correct |
34 |
Correct |
11 ms |
384 KB |
Output is correct |
35 |
Correct |
24 ms |
384 KB |
Output is correct |
36 |
Correct |
20 ms |
504 KB |
Output is correct |
37 |
Correct |
51 ms |
384 KB |
Output is correct |
38 |
Correct |
47 ms |
384 KB |
Output is correct |
39 |
Correct |
33 ms |
384 KB |
Output is correct |
40 |
Correct |
18 ms |
384 KB |
Output is correct |
41 |
Correct |
21 ms |
384 KB |
Output is correct |
42 |
Correct |
19 ms |
384 KB |
Output is correct |
43 |
Correct |
25 ms |
384 KB |
Output is correct |
44 |
Correct |
22 ms |
384 KB |
Output is correct |
45 |
Correct |
17 ms |
384 KB |
Output is correct |
46 |
Correct |
20 ms |
384 KB |
Output is correct |
47 |
Correct |
21 ms |
384 KB |
Output is correct |
48 |
Correct |
21 ms |
384 KB |
Output is correct |
49 |
Correct |
19 ms |
384 KB |
Output is correct |
50 |
Correct |
20 ms |
384 KB |
Output is correct |
51 |
Correct |
25 ms |
384 KB |
Output is correct |
52 |
Correct |
31 ms |
384 KB |
Output is correct |
53 |
Correct |
20 ms |
384 KB |
Output is correct |
54 |
Correct |
22 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
91 ms |
5872 KB |
Output is correct |
4 |
Correct |
81 ms |
6512 KB |
Output is correct |
5 |
Correct |
95 ms |
6512 KB |
Output is correct |
6 |
Correct |
94 ms |
5872 KB |
Output is correct |
7 |
Correct |
89 ms |
5872 KB |
Output is correct |
8 |
Correct |
87 ms |
5616 KB |
Output is correct |
9 |
Correct |
85 ms |
6000 KB |
Output is correct |
10 |
Correct |
82 ms |
6768 KB |
Output is correct |
11 |
Correct |
90 ms |
5872 KB |
Output is correct |
12 |
Correct |
94 ms |
6512 KB |
Output is correct |
13 |
Correct |
85 ms |
5232 KB |
Output is correct |
14 |
Correct |
98 ms |
5544 KB |
Output is correct |
15 |
Correct |
99 ms |
6128 KB |
Output is correct |
16 |
Correct |
94 ms |
6640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
384 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
91 ms |
5872 KB |
Output is correct |
30 |
Correct |
81 ms |
6512 KB |
Output is correct |
31 |
Correct |
95 ms |
6512 KB |
Output is correct |
32 |
Correct |
94 ms |
5872 KB |
Output is correct |
33 |
Correct |
89 ms |
5872 KB |
Output is correct |
34 |
Correct |
87 ms |
5616 KB |
Output is correct |
35 |
Correct |
85 ms |
6000 KB |
Output is correct |
36 |
Correct |
82 ms |
6768 KB |
Output is correct |
37 |
Correct |
90 ms |
5872 KB |
Output is correct |
38 |
Correct |
94 ms |
6512 KB |
Output is correct |
39 |
Correct |
85 ms |
5232 KB |
Output is correct |
40 |
Correct |
98 ms |
5544 KB |
Output is correct |
41 |
Correct |
99 ms |
6128 KB |
Output is correct |
42 |
Correct |
94 ms |
6640 KB |
Output is correct |
43 |
Correct |
400 ms |
6000 KB |
Output is correct |
44 |
Correct |
956 ms |
6540 KB |
Output is correct |
45 |
Correct |
801 ms |
6640 KB |
Output is correct |
46 |
Correct |
130 ms |
5884 KB |
Output is correct |
47 |
Correct |
149 ms |
5872 KB |
Output is correct |
48 |
Correct |
459 ms |
5960 KB |
Output is correct |
49 |
Correct |
703 ms |
6780 KB |
Output is correct |
50 |
Correct |
921 ms |
5748 KB |
Output is correct |
51 |
Correct |
787 ms |
6256 KB |
Output is correct |
52 |
Correct |
704 ms |
6652 KB |
Output is correct |
53 |
Correct |
661 ms |
5232 KB |
Output is correct |
54 |
Correct |
469 ms |
5672 KB |
Output is correct |
55 |
Correct |
613 ms |
6256 KB |
Output is correct |
56 |
Correct |
718 ms |
6768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
384 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
12 ms |
384 KB |
Output is correct |
30 |
Correct |
16 ms |
384 KB |
Output is correct |
31 |
Correct |
16 ms |
384 KB |
Output is correct |
32 |
Correct |
10 ms |
384 KB |
Output is correct |
33 |
Correct |
6 ms |
384 KB |
Output is correct |
34 |
Correct |
11 ms |
384 KB |
Output is correct |
35 |
Correct |
24 ms |
384 KB |
Output is correct |
36 |
Correct |
20 ms |
504 KB |
Output is correct |
37 |
Correct |
51 ms |
384 KB |
Output is correct |
38 |
Correct |
47 ms |
384 KB |
Output is correct |
39 |
Correct |
33 ms |
384 KB |
Output is correct |
40 |
Correct |
18 ms |
384 KB |
Output is correct |
41 |
Correct |
21 ms |
384 KB |
Output is correct |
42 |
Correct |
19 ms |
384 KB |
Output is correct |
43 |
Correct |
25 ms |
384 KB |
Output is correct |
44 |
Correct |
22 ms |
384 KB |
Output is correct |
45 |
Correct |
17 ms |
384 KB |
Output is correct |
46 |
Correct |
20 ms |
384 KB |
Output is correct |
47 |
Correct |
21 ms |
384 KB |
Output is correct |
48 |
Correct |
21 ms |
384 KB |
Output is correct |
49 |
Correct |
19 ms |
384 KB |
Output is correct |
50 |
Correct |
20 ms |
384 KB |
Output is correct |
51 |
Correct |
25 ms |
384 KB |
Output is correct |
52 |
Correct |
31 ms |
384 KB |
Output is correct |
53 |
Correct |
20 ms |
384 KB |
Output is correct |
54 |
Correct |
22 ms |
384 KB |
Output is correct |
55 |
Execution timed out |
2065 ms |
3288 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
384 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
12 ms |
384 KB |
Output is correct |
30 |
Correct |
16 ms |
384 KB |
Output is correct |
31 |
Correct |
16 ms |
384 KB |
Output is correct |
32 |
Correct |
10 ms |
384 KB |
Output is correct |
33 |
Correct |
6 ms |
384 KB |
Output is correct |
34 |
Correct |
11 ms |
384 KB |
Output is correct |
35 |
Correct |
24 ms |
384 KB |
Output is correct |
36 |
Correct |
20 ms |
504 KB |
Output is correct |
37 |
Correct |
51 ms |
384 KB |
Output is correct |
38 |
Correct |
47 ms |
384 KB |
Output is correct |
39 |
Correct |
33 ms |
384 KB |
Output is correct |
40 |
Correct |
18 ms |
384 KB |
Output is correct |
41 |
Correct |
21 ms |
384 KB |
Output is correct |
42 |
Correct |
19 ms |
384 KB |
Output is correct |
43 |
Correct |
25 ms |
384 KB |
Output is correct |
44 |
Correct |
22 ms |
384 KB |
Output is correct |
45 |
Correct |
17 ms |
384 KB |
Output is correct |
46 |
Correct |
20 ms |
384 KB |
Output is correct |
47 |
Correct |
21 ms |
384 KB |
Output is correct |
48 |
Correct |
21 ms |
384 KB |
Output is correct |
49 |
Correct |
19 ms |
384 KB |
Output is correct |
50 |
Correct |
20 ms |
384 KB |
Output is correct |
51 |
Correct |
25 ms |
384 KB |
Output is correct |
52 |
Correct |
31 ms |
384 KB |
Output is correct |
53 |
Correct |
20 ms |
384 KB |
Output is correct |
54 |
Correct |
22 ms |
384 KB |
Output is correct |
55 |
Correct |
91 ms |
5872 KB |
Output is correct |
56 |
Correct |
81 ms |
6512 KB |
Output is correct |
57 |
Correct |
95 ms |
6512 KB |
Output is correct |
58 |
Correct |
94 ms |
5872 KB |
Output is correct |
59 |
Correct |
89 ms |
5872 KB |
Output is correct |
60 |
Correct |
87 ms |
5616 KB |
Output is correct |
61 |
Correct |
85 ms |
6000 KB |
Output is correct |
62 |
Correct |
82 ms |
6768 KB |
Output is correct |
63 |
Correct |
90 ms |
5872 KB |
Output is correct |
64 |
Correct |
94 ms |
6512 KB |
Output is correct |
65 |
Correct |
85 ms |
5232 KB |
Output is correct |
66 |
Correct |
98 ms |
5544 KB |
Output is correct |
67 |
Correct |
99 ms |
6128 KB |
Output is correct |
68 |
Correct |
94 ms |
6640 KB |
Output is correct |
69 |
Correct |
400 ms |
6000 KB |
Output is correct |
70 |
Correct |
956 ms |
6540 KB |
Output is correct |
71 |
Correct |
801 ms |
6640 KB |
Output is correct |
72 |
Correct |
130 ms |
5884 KB |
Output is correct |
73 |
Correct |
149 ms |
5872 KB |
Output is correct |
74 |
Correct |
459 ms |
5960 KB |
Output is correct |
75 |
Correct |
703 ms |
6780 KB |
Output is correct |
76 |
Correct |
921 ms |
5748 KB |
Output is correct |
77 |
Correct |
787 ms |
6256 KB |
Output is correct |
78 |
Correct |
704 ms |
6652 KB |
Output is correct |
79 |
Correct |
661 ms |
5232 KB |
Output is correct |
80 |
Correct |
469 ms |
5672 KB |
Output is correct |
81 |
Correct |
613 ms |
6256 KB |
Output is correct |
82 |
Correct |
718 ms |
6768 KB |
Output is correct |
83 |
Execution timed out |
2065 ms |
3288 KB |
Time limit exceeded |
84 |
Halted |
0 ms |
0 KB |
- |