Submission #256076

# Submission time Handle Problem Language Result Execution time Memory
256076 2020-08-02T09:31:55 Z 최은수(#5029) Joker (BOI20_joker) C++17
14 / 100
2000 ms 10204 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;
int top;
int stk[200010];
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;
        fill(par,par+n+1,0);
        ok=1;
        for(int i=0;i++<n;)
        {
            if(par[i]==0)
            {
                stk[top=1]=i;
                par[i]=1;
                while(top>0)
                {
                    int x=stk[top--];
                    for(pi&t:adj[x])
                    {
                        if(lo<=t.se&&t.se<=hi)
                            continue;
                        if(par[t.fi]==0)
                            par[t.fi]=par[x]^3,stk[++top]=t.fi;
                        else if(par[t.fi]==par[x])
                        {
                            ok=0;
                            break;
                        }
                    }
                    if(!ok)
                        break;
                }
                if(!ok)
                    break;
            }
        }
        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 3 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 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 4 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 4 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 3 ms 4992 KB Output is correct
20 Correct 4 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 4 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 3 ms 4992 KB Output is correct
26 Correct 5 ms 4992 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 3 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 3 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 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 4 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 4 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 3 ms 4992 KB Output is correct
20 Correct 4 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 4 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 3 ms 4992 KB Output is correct
26 Correct 5 ms 4992 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 3 ms 4992 KB Output is correct
29 Correct 86 ms 5240 KB Output is correct
30 Correct 58 ms 5120 KB Output is correct
31 Correct 43 ms 5120 KB Output is correct
32 Correct 24 ms 5120 KB Output is correct
33 Correct 12 ms 5120 KB Output is correct
34 Correct 45 ms 5180 KB Output is correct
35 Correct 65 ms 5120 KB Output is correct
36 Correct 20 ms 5120 KB Output is correct
37 Correct 74 ms 5120 KB Output is correct
38 Correct 81 ms 5120 KB Output is correct
39 Correct 56 ms 5172 KB Output is correct
40 Correct 26 ms 5120 KB Output is correct
41 Correct 25 ms 5120 KB Output is correct
42 Correct 26 ms 5120 KB Output is correct
43 Correct 7 ms 5120 KB Output is correct
44 Correct 7 ms 5120 KB Output is correct
45 Correct 14 ms 5120 KB Output is correct
46 Correct 16 ms 5120 KB Output is correct
47 Correct 28 ms 5120 KB Output is correct
48 Correct 32 ms 5248 KB Output is correct
49 Correct 42 ms 5120 KB Output is correct
50 Correct 50 ms 5120 KB Output is correct
51 Correct 28 ms 5120 KB Output is correct
52 Correct 34 ms 5164 KB Output is correct
53 Correct 44 ms 5120 KB Output is correct
54 Correct 60 ms 5172 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 2090 ms 10104 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 3 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 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 4 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 4 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 3 ms 4992 KB Output is correct
20 Correct 4 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 4 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 3 ms 4992 KB Output is correct
26 Correct 5 ms 4992 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 3 ms 4992 KB Output is correct
29 Execution timed out 2090 ms 10104 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 3 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 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 4 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 4 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 3 ms 4992 KB Output is correct
20 Correct 4 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 4 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 3 ms 4992 KB Output is correct
26 Correct 5 ms 4992 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 3 ms 4992 KB Output is correct
29 Correct 86 ms 5240 KB Output is correct
30 Correct 58 ms 5120 KB Output is correct
31 Correct 43 ms 5120 KB Output is correct
32 Correct 24 ms 5120 KB Output is correct
33 Correct 12 ms 5120 KB Output is correct
34 Correct 45 ms 5180 KB Output is correct
35 Correct 65 ms 5120 KB Output is correct
36 Correct 20 ms 5120 KB Output is correct
37 Correct 74 ms 5120 KB Output is correct
38 Correct 81 ms 5120 KB Output is correct
39 Correct 56 ms 5172 KB Output is correct
40 Correct 26 ms 5120 KB Output is correct
41 Correct 25 ms 5120 KB Output is correct
42 Correct 26 ms 5120 KB Output is correct
43 Correct 7 ms 5120 KB Output is correct
44 Correct 7 ms 5120 KB Output is correct
45 Correct 14 ms 5120 KB Output is correct
46 Correct 16 ms 5120 KB Output is correct
47 Correct 28 ms 5120 KB Output is correct
48 Correct 32 ms 5248 KB Output is correct
49 Correct 42 ms 5120 KB Output is correct
50 Correct 50 ms 5120 KB Output is correct
51 Correct 28 ms 5120 KB Output is correct
52 Correct 34 ms 5164 KB Output is correct
53 Correct 44 ms 5120 KB Output is correct
54 Correct 60 ms 5172 KB Output is correct
55 Execution timed out 2070 ms 10204 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 3 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 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 4 ms 4992 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 4 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 3 ms 4992 KB Output is correct
20 Correct 4 ms 4992 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 4 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 3 ms 4992 KB Output is correct
26 Correct 5 ms 4992 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 3 ms 4992 KB Output is correct
29 Correct 86 ms 5240 KB Output is correct
30 Correct 58 ms 5120 KB Output is correct
31 Correct 43 ms 5120 KB Output is correct
32 Correct 24 ms 5120 KB Output is correct
33 Correct 12 ms 5120 KB Output is correct
34 Correct 45 ms 5180 KB Output is correct
35 Correct 65 ms 5120 KB Output is correct
36 Correct 20 ms 5120 KB Output is correct
37 Correct 74 ms 5120 KB Output is correct
38 Correct 81 ms 5120 KB Output is correct
39 Correct 56 ms 5172 KB Output is correct
40 Correct 26 ms 5120 KB Output is correct
41 Correct 25 ms 5120 KB Output is correct
42 Correct 26 ms 5120 KB Output is correct
43 Correct 7 ms 5120 KB Output is correct
44 Correct 7 ms 5120 KB Output is correct
45 Correct 14 ms 5120 KB Output is correct
46 Correct 16 ms 5120 KB Output is correct
47 Correct 28 ms 5120 KB Output is correct
48 Correct 32 ms 5248 KB Output is correct
49 Correct 42 ms 5120 KB Output is correct
50 Correct 50 ms 5120 KB Output is correct
51 Correct 28 ms 5120 KB Output is correct
52 Correct 34 ms 5164 KB Output is correct
53 Correct 44 ms 5120 KB Output is correct
54 Correct 60 ms 5172 KB Output is correct
55 Execution timed out 2090 ms 10104 KB Time limit exceeded
56 Halted 0 ms 0 KB -