# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1096337 |
2024-10-04T10:04:08 Z |
laure |
Joker (BOI20_joker) |
C++14 |
|
40 ms |
676 KB |
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,q,l,r;
bool b;
vector<pair<int,int>>adj[2005];
bool vis[2005];
int d[2005];
void dfs(int node,int par,int de)
{
if(b)return;
d[node]=de;
vis[node]=1;
for(auto u:adj[node])
{
if(u.second>=l&&u.second<=r)continue;
if(u.first==par)continue;
if(vis[u.first]&&(de-d[u.first])%2==0){b=1;break;}
if(!vis[u.first])
{
dfs(u.first,node,de+1);
}
}
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m>>q;
for(int i=1;i<=m;i++)
{
int a,b;
cin>>a>>b;
adj[a].push_back({b,i});
adj[b].push_back({a,i});
}
while(q--)
{
b=0;
memset(vis,0,sizeof(vis));
memset(d,0,sizeof(d));
cin>>l>>r;
for(int i=1;i<n;i++)
{
if(!vis[i])dfs(i,i,1);
if(b)break;
}
if(b)cout<<"YES"<<'\n';
else cout<<"NO"<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
508 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
508 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
412 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
536 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
508 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
508 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
412 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
536 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
36 ms |
604 KB |
Output is correct |
30 |
Correct |
32 ms |
660 KB |
Output is correct |
31 |
Correct |
25 ms |
600 KB |
Output is correct |
32 |
Correct |
14 ms |
604 KB |
Output is correct |
33 |
Correct |
8 ms |
604 KB |
Output is correct |
34 |
Correct |
22 ms |
604 KB |
Output is correct |
35 |
Correct |
36 ms |
676 KB |
Output is correct |
36 |
Correct |
12 ms |
604 KB |
Output is correct |
37 |
Correct |
39 ms |
600 KB |
Output is correct |
38 |
Correct |
40 ms |
600 KB |
Output is correct |
39 |
Correct |
33 ms |
600 KB |
Output is correct |
40 |
Correct |
17 ms |
604 KB |
Output is correct |
41 |
Correct |
16 ms |
604 KB |
Output is correct |
42 |
Correct |
15 ms |
604 KB |
Output is correct |
43 |
Correct |
10 ms |
604 KB |
Output is correct |
44 |
Correct |
6 ms |
604 KB |
Output is correct |
45 |
Correct |
8 ms |
640 KB |
Output is correct |
46 |
Correct |
10 ms |
604 KB |
Output is correct |
47 |
Correct |
16 ms |
604 KB |
Output is correct |
48 |
Correct |
16 ms |
604 KB |
Output is correct |
49 |
Correct |
21 ms |
676 KB |
Output is correct |
50 |
Correct |
25 ms |
600 KB |
Output is correct |
51 |
Correct |
21 ms |
604 KB |
Output is correct |
52 |
Correct |
21 ms |
604 KB |
Output is correct |
53 |
Correct |
26 ms |
600 KB |
Output is correct |
54 |
Correct |
34 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
0 ms |
604 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
508 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
508 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
412 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
536 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Runtime error |
0 ms |
604 KB |
Execution killed with signal 11 |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
508 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
508 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
412 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
536 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
36 ms |
604 KB |
Output is correct |
30 |
Correct |
32 ms |
660 KB |
Output is correct |
31 |
Correct |
25 ms |
600 KB |
Output is correct |
32 |
Correct |
14 ms |
604 KB |
Output is correct |
33 |
Correct |
8 ms |
604 KB |
Output is correct |
34 |
Correct |
22 ms |
604 KB |
Output is correct |
35 |
Correct |
36 ms |
676 KB |
Output is correct |
36 |
Correct |
12 ms |
604 KB |
Output is correct |
37 |
Correct |
39 ms |
600 KB |
Output is correct |
38 |
Correct |
40 ms |
600 KB |
Output is correct |
39 |
Correct |
33 ms |
600 KB |
Output is correct |
40 |
Correct |
17 ms |
604 KB |
Output is correct |
41 |
Correct |
16 ms |
604 KB |
Output is correct |
42 |
Correct |
15 ms |
604 KB |
Output is correct |
43 |
Correct |
10 ms |
604 KB |
Output is correct |
44 |
Correct |
6 ms |
604 KB |
Output is correct |
45 |
Correct |
8 ms |
640 KB |
Output is correct |
46 |
Correct |
10 ms |
604 KB |
Output is correct |
47 |
Correct |
16 ms |
604 KB |
Output is correct |
48 |
Correct |
16 ms |
604 KB |
Output is correct |
49 |
Correct |
21 ms |
676 KB |
Output is correct |
50 |
Correct |
25 ms |
600 KB |
Output is correct |
51 |
Correct |
21 ms |
604 KB |
Output is correct |
52 |
Correct |
21 ms |
604 KB |
Output is correct |
53 |
Correct |
26 ms |
600 KB |
Output is correct |
54 |
Correct |
34 ms |
604 KB |
Output is correct |
55 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
508 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
508 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
412 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
536 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
36 ms |
604 KB |
Output is correct |
30 |
Correct |
32 ms |
660 KB |
Output is correct |
31 |
Correct |
25 ms |
600 KB |
Output is correct |
32 |
Correct |
14 ms |
604 KB |
Output is correct |
33 |
Correct |
8 ms |
604 KB |
Output is correct |
34 |
Correct |
22 ms |
604 KB |
Output is correct |
35 |
Correct |
36 ms |
676 KB |
Output is correct |
36 |
Correct |
12 ms |
604 KB |
Output is correct |
37 |
Correct |
39 ms |
600 KB |
Output is correct |
38 |
Correct |
40 ms |
600 KB |
Output is correct |
39 |
Correct |
33 ms |
600 KB |
Output is correct |
40 |
Correct |
17 ms |
604 KB |
Output is correct |
41 |
Correct |
16 ms |
604 KB |
Output is correct |
42 |
Correct |
15 ms |
604 KB |
Output is correct |
43 |
Correct |
10 ms |
604 KB |
Output is correct |
44 |
Correct |
6 ms |
604 KB |
Output is correct |
45 |
Correct |
8 ms |
640 KB |
Output is correct |
46 |
Correct |
10 ms |
604 KB |
Output is correct |
47 |
Correct |
16 ms |
604 KB |
Output is correct |
48 |
Correct |
16 ms |
604 KB |
Output is correct |
49 |
Correct |
21 ms |
676 KB |
Output is correct |
50 |
Correct |
25 ms |
600 KB |
Output is correct |
51 |
Correct |
21 ms |
604 KB |
Output is correct |
52 |
Correct |
21 ms |
604 KB |
Output is correct |
53 |
Correct |
26 ms |
600 KB |
Output is correct |
54 |
Correct |
34 ms |
604 KB |
Output is correct |
55 |
Runtime error |
0 ms |
604 KB |
Execution killed with signal 11 |
56 |
Halted |
0 ms |
0 KB |
- |