Submission #858293

# Submission time Handle Problem Language Result Execution time Memory
858293 2023-10-08T03:22:27 Z Trisanu_Das Joker (BOI20_joker) C++17
14 / 100
2000 ms 20208 KB
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
 
int n, m, q;
int vis[200005];
vector<pair<int, int> > adj[200005];
bool ok;
 
void dfs(int u, int p, int c, int l, int r){
  vis[u] = c;
  for(auto v : adj[u]){
    if(v.ff == p || (l <= v.ss && v.ss <= r)) continue;
    if(vis[v.ff] == vis[u]) ok = true;
    if(!vis[v.ff]) dfs(v.ff, u, 3 - c, l, r);
  }
}
 
int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  cin >> n >> m >> q;
  for(int e = 1; e < m + 1; e++){
    int u, v; cin >> u >> v;
    adj[u].push_back(make_pair(v, e));
    adj[v].push_back(make_pair(u, e));
  }
  while(q--){
    int l, r; cin >> l >> r;
    ok = false;
    memset(vis, 0, sizeof(vis));
    for(int i = 1; i <= n; i++) if(!vis[i]) dfs(i, 0, 1, l, r);
    if(ok) cout << "YES\n";
    else cout << "NO\n";
  }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5720 KB Output is correct
2 Correct 1 ms 5720 KB Output is correct
3 Correct 1 ms 5732 KB Output is correct
4 Correct 2 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 4 ms 5724 KB Output is correct
8 Correct 5 ms 5932 KB Output is correct
9 Correct 5 ms 5724 KB Output is correct
10 Correct 4 ms 5724 KB Output is correct
11 Correct 5 ms 5720 KB Output is correct
12 Correct 5 ms 5724 KB Output is correct
13 Correct 4 ms 5724 KB Output is correct
14 Correct 4 ms 5724 KB Output is correct
15 Correct 4 ms 5724 KB Output is correct
16 Correct 4 ms 5920 KB Output is correct
17 Correct 4 ms 5724 KB Output is correct
18 Correct 4 ms 5948 KB Output is correct
19 Correct 5 ms 5724 KB Output is correct
20 Correct 5 ms 5740 KB Output is correct
21 Correct 5 ms 5720 KB Output is correct
22 Correct 5 ms 5724 KB Output is correct
23 Correct 4 ms 5928 KB Output is correct
24 Correct 4 ms 5944 KB Output is correct
25 Correct 4 ms 5724 KB Output is correct
26 Correct 4 ms 5724 KB Output is correct
27 Correct 4 ms 5724 KB Output is correct
28 Correct 5 ms 5948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5720 KB Output is correct
2 Correct 1 ms 5720 KB Output is correct
3 Correct 1 ms 5732 KB Output is correct
4 Correct 2 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 4 ms 5724 KB Output is correct
8 Correct 5 ms 5932 KB Output is correct
9 Correct 5 ms 5724 KB Output is correct
10 Correct 4 ms 5724 KB Output is correct
11 Correct 5 ms 5720 KB Output is correct
12 Correct 5 ms 5724 KB Output is correct
13 Correct 4 ms 5724 KB Output is correct
14 Correct 4 ms 5724 KB Output is correct
15 Correct 4 ms 5724 KB Output is correct
16 Correct 4 ms 5920 KB Output is correct
17 Correct 4 ms 5724 KB Output is correct
18 Correct 4 ms 5948 KB Output is correct
19 Correct 5 ms 5724 KB Output is correct
20 Correct 5 ms 5740 KB Output is correct
21 Correct 5 ms 5720 KB Output is correct
22 Correct 5 ms 5724 KB Output is correct
23 Correct 4 ms 5928 KB Output is correct
24 Correct 4 ms 5944 KB Output is correct
25 Correct 4 ms 5724 KB Output is correct
26 Correct 4 ms 5724 KB Output is correct
27 Correct 4 ms 5724 KB Output is correct
28 Correct 5 ms 5948 KB Output is correct
29 Correct 83 ms 5976 KB Output is correct
30 Correct 129 ms 6056 KB Output is correct
31 Correct 128 ms 5976 KB Output is correct
32 Correct 108 ms 6064 KB Output is correct
33 Correct 93 ms 5976 KB Output is correct
34 Correct 136 ms 5980 KB Output is correct
35 Correct 137 ms 5976 KB Output is correct
36 Correct 51 ms 6104 KB Output is correct
37 Correct 86 ms 6064 KB Output is correct
38 Correct 75 ms 5980 KB Output is correct
39 Correct 99 ms 5980 KB Output is correct
40 Correct 98 ms 6072 KB Output is correct
41 Correct 99 ms 6076 KB Output is correct
42 Correct 100 ms 5980 KB Output is correct
43 Correct 102 ms 6056 KB Output is correct
44 Correct 117 ms 6064 KB Output is correct
45 Correct 134 ms 6064 KB Output is correct
46 Correct 138 ms 6060 KB Output is correct
47 Correct 96 ms 6064 KB Output is correct
48 Correct 104 ms 5976 KB Output is correct
49 Correct 116 ms 6072 KB Output is correct
50 Correct 125 ms 5980 KB Output is correct
51 Correct 98 ms 5980 KB Output is correct
52 Correct 108 ms 6060 KB Output is correct
53 Correct 122 ms 6072 KB Output is correct
54 Correct 137 ms 6064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5720 KB Output is correct
2 Correct 1 ms 5720 KB Output is correct
3 Execution timed out 2047 ms 18768 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5720 KB Output is correct
2 Correct 1 ms 5720 KB Output is correct
3 Correct 1 ms 5732 KB Output is correct
4 Correct 2 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 4 ms 5724 KB Output is correct
8 Correct 5 ms 5932 KB Output is correct
9 Correct 5 ms 5724 KB Output is correct
10 Correct 4 ms 5724 KB Output is correct
11 Correct 5 ms 5720 KB Output is correct
12 Correct 5 ms 5724 KB Output is correct
13 Correct 4 ms 5724 KB Output is correct
14 Correct 4 ms 5724 KB Output is correct
15 Correct 4 ms 5724 KB Output is correct
16 Correct 4 ms 5920 KB Output is correct
17 Correct 4 ms 5724 KB Output is correct
18 Correct 4 ms 5948 KB Output is correct
19 Correct 5 ms 5724 KB Output is correct
20 Correct 5 ms 5740 KB Output is correct
21 Correct 5 ms 5720 KB Output is correct
22 Correct 5 ms 5724 KB Output is correct
23 Correct 4 ms 5928 KB Output is correct
24 Correct 4 ms 5944 KB Output is correct
25 Correct 4 ms 5724 KB Output is correct
26 Correct 4 ms 5724 KB Output is correct
27 Correct 4 ms 5724 KB Output is correct
28 Correct 5 ms 5948 KB Output is correct
29 Execution timed out 2047 ms 18768 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5720 KB Output is correct
2 Correct 1 ms 5720 KB Output is correct
3 Correct 1 ms 5732 KB Output is correct
4 Correct 2 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 4 ms 5724 KB Output is correct
8 Correct 5 ms 5932 KB Output is correct
9 Correct 5 ms 5724 KB Output is correct
10 Correct 4 ms 5724 KB Output is correct
11 Correct 5 ms 5720 KB Output is correct
12 Correct 5 ms 5724 KB Output is correct
13 Correct 4 ms 5724 KB Output is correct
14 Correct 4 ms 5724 KB Output is correct
15 Correct 4 ms 5724 KB Output is correct
16 Correct 4 ms 5920 KB Output is correct
17 Correct 4 ms 5724 KB Output is correct
18 Correct 4 ms 5948 KB Output is correct
19 Correct 5 ms 5724 KB Output is correct
20 Correct 5 ms 5740 KB Output is correct
21 Correct 5 ms 5720 KB Output is correct
22 Correct 5 ms 5724 KB Output is correct
23 Correct 4 ms 5928 KB Output is correct
24 Correct 4 ms 5944 KB Output is correct
25 Correct 4 ms 5724 KB Output is correct
26 Correct 4 ms 5724 KB Output is correct
27 Correct 4 ms 5724 KB Output is correct
28 Correct 5 ms 5948 KB Output is correct
29 Correct 83 ms 5976 KB Output is correct
30 Correct 129 ms 6056 KB Output is correct
31 Correct 128 ms 5976 KB Output is correct
32 Correct 108 ms 6064 KB Output is correct
33 Correct 93 ms 5976 KB Output is correct
34 Correct 136 ms 5980 KB Output is correct
35 Correct 137 ms 5976 KB Output is correct
36 Correct 51 ms 6104 KB Output is correct
37 Correct 86 ms 6064 KB Output is correct
38 Correct 75 ms 5980 KB Output is correct
39 Correct 99 ms 5980 KB Output is correct
40 Correct 98 ms 6072 KB Output is correct
41 Correct 99 ms 6076 KB Output is correct
42 Correct 100 ms 5980 KB Output is correct
43 Correct 102 ms 6056 KB Output is correct
44 Correct 117 ms 6064 KB Output is correct
45 Correct 134 ms 6064 KB Output is correct
46 Correct 138 ms 6060 KB Output is correct
47 Correct 96 ms 6064 KB Output is correct
48 Correct 104 ms 5976 KB Output is correct
49 Correct 116 ms 6072 KB Output is correct
50 Correct 125 ms 5980 KB Output is correct
51 Correct 98 ms 5980 KB Output is correct
52 Correct 108 ms 6060 KB Output is correct
53 Correct 122 ms 6072 KB Output is correct
54 Correct 137 ms 6064 KB Output is correct
55 Execution timed out 2056 ms 20208 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5720 KB Output is correct
2 Correct 1 ms 5720 KB Output is correct
3 Correct 1 ms 5732 KB Output is correct
4 Correct 2 ms 5724 KB Output is correct
5 Correct 2 ms 5724 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 4 ms 5724 KB Output is correct
8 Correct 5 ms 5932 KB Output is correct
9 Correct 5 ms 5724 KB Output is correct
10 Correct 4 ms 5724 KB Output is correct
11 Correct 5 ms 5720 KB Output is correct
12 Correct 5 ms 5724 KB Output is correct
13 Correct 4 ms 5724 KB Output is correct
14 Correct 4 ms 5724 KB Output is correct
15 Correct 4 ms 5724 KB Output is correct
16 Correct 4 ms 5920 KB Output is correct
17 Correct 4 ms 5724 KB Output is correct
18 Correct 4 ms 5948 KB Output is correct
19 Correct 5 ms 5724 KB Output is correct
20 Correct 5 ms 5740 KB Output is correct
21 Correct 5 ms 5720 KB Output is correct
22 Correct 5 ms 5724 KB Output is correct
23 Correct 4 ms 5928 KB Output is correct
24 Correct 4 ms 5944 KB Output is correct
25 Correct 4 ms 5724 KB Output is correct
26 Correct 4 ms 5724 KB Output is correct
27 Correct 4 ms 5724 KB Output is correct
28 Correct 5 ms 5948 KB Output is correct
29 Correct 83 ms 5976 KB Output is correct
30 Correct 129 ms 6056 KB Output is correct
31 Correct 128 ms 5976 KB Output is correct
32 Correct 108 ms 6064 KB Output is correct
33 Correct 93 ms 5976 KB Output is correct
34 Correct 136 ms 5980 KB Output is correct
35 Correct 137 ms 5976 KB Output is correct
36 Correct 51 ms 6104 KB Output is correct
37 Correct 86 ms 6064 KB Output is correct
38 Correct 75 ms 5980 KB Output is correct
39 Correct 99 ms 5980 KB Output is correct
40 Correct 98 ms 6072 KB Output is correct
41 Correct 99 ms 6076 KB Output is correct
42 Correct 100 ms 5980 KB Output is correct
43 Correct 102 ms 6056 KB Output is correct
44 Correct 117 ms 6064 KB Output is correct
45 Correct 134 ms 6064 KB Output is correct
46 Correct 138 ms 6060 KB Output is correct
47 Correct 96 ms 6064 KB Output is correct
48 Correct 104 ms 5976 KB Output is correct
49 Correct 116 ms 6072 KB Output is correct
50 Correct 125 ms 5980 KB Output is correct
51 Correct 98 ms 5980 KB Output is correct
52 Correct 108 ms 6060 KB Output is correct
53 Correct 122 ms 6072 KB Output is correct
54 Correct 137 ms 6064 KB Output is correct
55 Execution timed out 2047 ms 18768 KB Time limit exceeded
56 Halted 0 ms 0 KB -