Submission #256070

# Submission time Handle Problem Language Result Execution time Memory
256070 2020-08-02T09:27:37 Z 최은수(#5029) Joker (BOI20_joker) C++17
14 / 100
2000 ms 13048 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;
vector<pi>adj[200010];
int lo,hi;
int par[200010];
bool ok;
void dfs(int x,int p)
{
    par[x]=p;
    p^=3;
    for(pi&t:adj[x])
    {
        if(lo<=t.se&&t.se<=hi)
            continue;
        if(par[t.fi]==0)
            dfs(t.fi,p);
        else if(par[t.fi]!=p)
            ok=0;
    }
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m,q;
    cin>>n>>m>>q;
    for(int i=0;i++<m;)
    {
        int u,v;
        cin>>u>>v;
        adj[u].eb(v,i);
        adj[v].eb(u,i);
    }
    for(int i=0;i<q;i++)
    {
        cin>>lo>>hi;
        for(int i=0;i++<n;)
            par[i]=0;
        ok=1;
        for(int i=0;i++<n;)
            if(par[i]==0)
                dfs(i,1);
        cout<<(ok?"NO":"YES")<<'\n';
    }
    cout.flush();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 5 ms 4992 KB Output is correct
8 Correct 6 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 5 ms 4992 KB Output is correct
11 Correct 5 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 4 ms 4992 KB Output is correct
14 Correct 5 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 5 ms 4992 KB Output is correct
17 Correct 4 ms 4992 KB Output is correct
18 Correct 4 ms 4992 KB Output is correct
19 Correct 4 ms 4992 KB Output is correct
20 Correct 5 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 5 ms 4992 KB Output is correct
23 Correct 4 ms 4992 KB Output is correct
24 Correct 4 ms 4992 KB Output is correct
25 Correct 4 ms 4992 KB Output is correct
26 Correct 4 ms 4992 KB Output is correct
27 Correct 4 ms 4992 KB Output is correct
28 Correct 5 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 5 ms 4992 KB Output is correct
8 Correct 6 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 5 ms 4992 KB Output is correct
11 Correct 5 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 4 ms 4992 KB Output is correct
14 Correct 5 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 5 ms 4992 KB Output is correct
17 Correct 4 ms 4992 KB Output is correct
18 Correct 4 ms 4992 KB Output is correct
19 Correct 4 ms 4992 KB Output is correct
20 Correct 5 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 5 ms 4992 KB Output is correct
23 Correct 4 ms 4992 KB Output is correct
24 Correct 4 ms 4992 KB Output is correct
25 Correct 4 ms 4992 KB Output is correct
26 Correct 4 ms 4992 KB Output is correct
27 Correct 4 ms 4992 KB Output is correct
28 Correct 5 ms 4992 KB Output is correct
29 Correct 74 ms 5120 KB Output is correct
30 Correct 126 ms 5168 KB Output is correct
31 Correct 120 ms 5120 KB Output is correct
32 Correct 97 ms 5120 KB Output is correct
33 Correct 79 ms 5120 KB Output is correct
34 Correct 129 ms 5120 KB Output is correct
35 Correct 139 ms 5240 KB Output is correct
36 Correct 35 ms 5120 KB Output is correct
37 Correct 80 ms 5188 KB Output is correct
38 Correct 85 ms 5120 KB Output is correct
39 Correct 89 ms 5120 KB Output is correct
40 Correct 86 ms 5120 KB Output is correct
41 Correct 88 ms 5120 KB Output is correct
42 Correct 86 ms 5120 KB Output is correct
43 Correct 96 ms 5120 KB Output is correct
44 Correct 114 ms 5120 KB Output is correct
45 Correct 136 ms 5244 KB Output is correct
46 Correct 137 ms 5120 KB Output is correct
47 Correct 87 ms 5120 KB Output is correct
48 Correct 96 ms 5120 KB Output is correct
49 Correct 112 ms 5120 KB Output is correct
50 Correct 125 ms 5120 KB Output is correct
51 Correct 92 ms 5120 KB Output is correct
52 Correct 95 ms 5120 KB Output is correct
53 Correct 110 ms 5120 KB Output is correct
54 Correct 133 ms 5240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Execution timed out 2096 ms 12280 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 5 ms 4992 KB Output is correct
8 Correct 6 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 5 ms 4992 KB Output is correct
11 Correct 5 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 4 ms 4992 KB Output is correct
14 Correct 5 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 5 ms 4992 KB Output is correct
17 Correct 4 ms 4992 KB Output is correct
18 Correct 4 ms 4992 KB Output is correct
19 Correct 4 ms 4992 KB Output is correct
20 Correct 5 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 5 ms 4992 KB Output is correct
23 Correct 4 ms 4992 KB Output is correct
24 Correct 4 ms 4992 KB Output is correct
25 Correct 4 ms 4992 KB Output is correct
26 Correct 4 ms 4992 KB Output is correct
27 Correct 4 ms 4992 KB Output is correct
28 Correct 5 ms 4992 KB Output is correct
29 Execution timed out 2096 ms 12280 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 5 ms 4992 KB Output is correct
8 Correct 6 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 5 ms 4992 KB Output is correct
11 Correct 5 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 4 ms 4992 KB Output is correct
14 Correct 5 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 5 ms 4992 KB Output is correct
17 Correct 4 ms 4992 KB Output is correct
18 Correct 4 ms 4992 KB Output is correct
19 Correct 4 ms 4992 KB Output is correct
20 Correct 5 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 5 ms 4992 KB Output is correct
23 Correct 4 ms 4992 KB Output is correct
24 Correct 4 ms 4992 KB Output is correct
25 Correct 4 ms 4992 KB Output is correct
26 Correct 4 ms 4992 KB Output is correct
27 Correct 4 ms 4992 KB Output is correct
28 Correct 5 ms 4992 KB Output is correct
29 Correct 74 ms 5120 KB Output is correct
30 Correct 126 ms 5168 KB Output is correct
31 Correct 120 ms 5120 KB Output is correct
32 Correct 97 ms 5120 KB Output is correct
33 Correct 79 ms 5120 KB Output is correct
34 Correct 129 ms 5120 KB Output is correct
35 Correct 139 ms 5240 KB Output is correct
36 Correct 35 ms 5120 KB Output is correct
37 Correct 80 ms 5188 KB Output is correct
38 Correct 85 ms 5120 KB Output is correct
39 Correct 89 ms 5120 KB Output is correct
40 Correct 86 ms 5120 KB Output is correct
41 Correct 88 ms 5120 KB Output is correct
42 Correct 86 ms 5120 KB Output is correct
43 Correct 96 ms 5120 KB Output is correct
44 Correct 114 ms 5120 KB Output is correct
45 Correct 136 ms 5244 KB Output is correct
46 Correct 137 ms 5120 KB Output is correct
47 Correct 87 ms 5120 KB Output is correct
48 Correct 96 ms 5120 KB Output is correct
49 Correct 112 ms 5120 KB Output is correct
50 Correct 125 ms 5120 KB Output is correct
51 Correct 92 ms 5120 KB Output is correct
52 Correct 95 ms 5120 KB Output is correct
53 Correct 110 ms 5120 KB Output is correct
54 Correct 133 ms 5240 KB Output is correct
55 Execution timed out 2099 ms 13048 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 5 ms 4992 KB Output is correct
8 Correct 6 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 5 ms 4992 KB Output is correct
11 Correct 5 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 4 ms 4992 KB Output is correct
14 Correct 5 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 5 ms 4992 KB Output is correct
17 Correct 4 ms 4992 KB Output is correct
18 Correct 4 ms 4992 KB Output is correct
19 Correct 4 ms 4992 KB Output is correct
20 Correct 5 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 5 ms 4992 KB Output is correct
23 Correct 4 ms 4992 KB Output is correct
24 Correct 4 ms 4992 KB Output is correct
25 Correct 4 ms 4992 KB Output is correct
26 Correct 4 ms 4992 KB Output is correct
27 Correct 4 ms 4992 KB Output is correct
28 Correct 5 ms 4992 KB Output is correct
29 Correct 74 ms 5120 KB Output is correct
30 Correct 126 ms 5168 KB Output is correct
31 Correct 120 ms 5120 KB Output is correct
32 Correct 97 ms 5120 KB Output is correct
33 Correct 79 ms 5120 KB Output is correct
34 Correct 129 ms 5120 KB Output is correct
35 Correct 139 ms 5240 KB Output is correct
36 Correct 35 ms 5120 KB Output is correct
37 Correct 80 ms 5188 KB Output is correct
38 Correct 85 ms 5120 KB Output is correct
39 Correct 89 ms 5120 KB Output is correct
40 Correct 86 ms 5120 KB Output is correct
41 Correct 88 ms 5120 KB Output is correct
42 Correct 86 ms 5120 KB Output is correct
43 Correct 96 ms 5120 KB Output is correct
44 Correct 114 ms 5120 KB Output is correct
45 Correct 136 ms 5244 KB Output is correct
46 Correct 137 ms 5120 KB Output is correct
47 Correct 87 ms 5120 KB Output is correct
48 Correct 96 ms 5120 KB Output is correct
49 Correct 112 ms 5120 KB Output is correct
50 Correct 125 ms 5120 KB Output is correct
51 Correct 92 ms 5120 KB Output is correct
52 Correct 95 ms 5120 KB Output is correct
53 Correct 110 ms 5120 KB Output is correct
54 Correct 133 ms 5240 KB Output is correct
55 Execution timed out 2096 ms 12280 KB Time limit exceeded
56 Halted 0 ms 0 KB -