# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1093520 | 2024-09-27T02:01:34 Z | duyhoanho | Joker (BOI20_joker) | C++14 | 2000 ms | 16208 KB |
#include<bits/stdc++.h> #define int long long #define forinc(i,a,b) for(int i=a;i<=b;i++) #define fi first #define se second #define pii pair<int,int> #define pb push_back using namespace std; const int N = 2e5+10; int n,m,q,fre[N]; pii a[N]; vector<int> ad[N]; bool qu(int l,int r) { bool ok = 0; forinc(i,1,n) ad[i].clear(); forinc(i,1,m) { if(l<=i && i<=r) continue; int x,y; tie(x,y) = a[i]; ad[x].pb(y); ad[y].pb(x); } for(int i=1; i<=n; i++) fre[i] = -1; for(int i=1; i<=n; i++) { if(fre[i] == -1) { queue<int> q; q.push(i); fre[i] = 0; while(q.size()) { int u = q.front();q.pop(); for(int v:ad[u]) { if(fre[v] == fre[u]) return true; if(fre[v] != -1) continue; fre[v] = 1 - fre[u]; q.push(v); } } //if(ok == 1) return true; } } return false; } int32_t main() { if(fopen("task.inp","r")) { freopen("task.inp","r",stdin); freopen("task.out","w",stdout); } ios_base::sync_with_stdio(false); cin.tie(0); cin>>n>>m>>q; forinc(i,1,m) { int x,y; cin>>x>>y; a[i] = {x,y}; } while(q--) { int l,r; cin>>l>>r; cout<< (qu(l,r) ? "YES\n" : "NO\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 2 ms | 4956 KB | Output is correct |
5 | Correct | 2 ms | 5144 KB | Output is correct |
6 | Correct | 2 ms | 4956 KB | Output is correct |
7 | Correct | 3 ms | 4956 KB | Output is correct |
8 | Correct | 3 ms | 4956 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 3 ms | 4952 KB | Output is correct |
11 | Correct | 3 ms | 4956 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 2 ms | 4956 KB | Output is correct |
14 | Correct | 4 ms | 4956 KB | Output is correct |
15 | Correct | 3 ms | 5164 KB | Output is correct |
16 | Correct | 3 ms | 4956 KB | Output is correct |
17 | Correct | 2 ms | 4956 KB | Output is correct |
18 | Correct | 2 ms | 4956 KB | Output is correct |
19 | Correct | 2 ms | 5164 KB | Output is correct |
20 | Correct | 3 ms | 5164 KB | Output is correct |
21 | Correct | 3 ms | 4956 KB | Output is correct |
22 | Correct | 2 ms | 4956 KB | Output is correct |
23 | Correct | 3 ms | 4956 KB | Output is correct |
24 | Correct | 3 ms | 5168 KB | Output is correct |
25 | Correct | 2 ms | 4956 KB | Output is correct |
26 | Correct | 3 ms | 4956 KB | Output is correct |
27 | Correct | 2 ms | 4956 KB | Output is correct |
28 | Correct | 3 ms | 5192 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 2 ms | 4956 KB | Output is correct |
5 | Correct | 2 ms | 5144 KB | Output is correct |
6 | Correct | 2 ms | 4956 KB | Output is correct |
7 | Correct | 3 ms | 4956 KB | Output is correct |
8 | Correct | 3 ms | 4956 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 3 ms | 4952 KB | Output is correct |
11 | Correct | 3 ms | 4956 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 2 ms | 4956 KB | Output is correct |
14 | Correct | 4 ms | 4956 KB | Output is correct |
15 | Correct | 3 ms | 5164 KB | Output is correct |
16 | Correct | 3 ms | 4956 KB | Output is correct |
17 | Correct | 2 ms | 4956 KB | Output is correct |
18 | Correct | 2 ms | 4956 KB | Output is correct |
19 | Correct | 2 ms | 5164 KB | Output is correct |
20 | Correct | 3 ms | 5164 KB | Output is correct |
21 | Correct | 3 ms | 4956 KB | Output is correct |
22 | Correct | 2 ms | 4956 KB | Output is correct |
23 | Correct | 3 ms | 4956 KB | Output is correct |
24 | Correct | 3 ms | 5168 KB | Output is correct |
25 | Correct | 2 ms | 4956 KB | Output is correct |
26 | Correct | 3 ms | 4956 KB | Output is correct |
27 | Correct | 2 ms | 4956 KB | Output is correct |
28 | Correct | 3 ms | 5192 KB | Output is correct |
29 | Correct | 94 ms | 5464 KB | Output is correct |
30 | Correct | 69 ms | 5304 KB | Output is correct |
31 | Correct | 49 ms | 5212 KB | Output is correct |
32 | Correct | 27 ms | 5212 KB | Output is correct |
33 | Correct | 18 ms | 5252 KB | Output is correct |
34 | Correct | 54 ms | 5208 KB | Output is correct |
35 | Correct | 70 ms | 5208 KB | Output is correct |
36 | Correct | 38 ms | 5208 KB | Output is correct |
37 | Correct | 92 ms | 5224 KB | Output is correct |
38 | Correct | 77 ms | 5304 KB | Output is correct |
39 | Correct | 72 ms | 5172 KB | Output is correct |
40 | Correct | 38 ms | 5212 KB | Output is correct |
41 | Correct | 40 ms | 5208 KB | Output is correct |
42 | Correct | 37 ms | 5212 KB | Output is correct |
43 | Correct | 18 ms | 5212 KB | Output is correct |
44 | Correct | 21 ms | 5300 KB | Output is correct |
45 | Correct | 25 ms | 5212 KB | Output is correct |
46 | Correct | 30 ms | 5208 KB | Output is correct |
47 | Correct | 34 ms | 5212 KB | Output is correct |
48 | Correct | 36 ms | 5212 KB | Output is correct |
49 | Correct | 56 ms | 5212 KB | Output is correct |
50 | Correct | 71 ms | 5208 KB | Output is correct |
51 | Correct | 28 ms | 5208 KB | Output is correct |
52 | Correct | 38 ms | 5320 KB | Output is correct |
53 | Correct | 49 ms | 5212 KB | Output is correct |
54 | Correct | 66 ms | 5212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Execution timed out | 2049 ms | 13780 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 2 ms | 4956 KB | Output is correct |
5 | Correct | 2 ms | 5144 KB | Output is correct |
6 | Correct | 2 ms | 4956 KB | Output is correct |
7 | Correct | 3 ms | 4956 KB | Output is correct |
8 | Correct | 3 ms | 4956 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 3 ms | 4952 KB | Output is correct |
11 | Correct | 3 ms | 4956 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 2 ms | 4956 KB | Output is correct |
14 | Correct | 4 ms | 4956 KB | Output is correct |
15 | Correct | 3 ms | 5164 KB | Output is correct |
16 | Correct | 3 ms | 4956 KB | Output is correct |
17 | Correct | 2 ms | 4956 KB | Output is correct |
18 | Correct | 2 ms | 4956 KB | Output is correct |
19 | Correct | 2 ms | 5164 KB | Output is correct |
20 | Correct | 3 ms | 5164 KB | Output is correct |
21 | Correct | 3 ms | 4956 KB | Output is correct |
22 | Correct | 2 ms | 4956 KB | Output is correct |
23 | Correct | 3 ms | 4956 KB | Output is correct |
24 | Correct | 3 ms | 5168 KB | Output is correct |
25 | Correct | 2 ms | 4956 KB | Output is correct |
26 | Correct | 3 ms | 4956 KB | Output is correct |
27 | Correct | 2 ms | 4956 KB | Output is correct |
28 | Correct | 3 ms | 5192 KB | Output is correct |
29 | Execution timed out | 2049 ms | 13780 KB | Time limit exceeded |
30 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 2 ms | 4956 KB | Output is correct |
5 | Correct | 2 ms | 5144 KB | Output is correct |
6 | Correct | 2 ms | 4956 KB | Output is correct |
7 | Correct | 3 ms | 4956 KB | Output is correct |
8 | Correct | 3 ms | 4956 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 3 ms | 4952 KB | Output is correct |
11 | Correct | 3 ms | 4956 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 2 ms | 4956 KB | Output is correct |
14 | Correct | 4 ms | 4956 KB | Output is correct |
15 | Correct | 3 ms | 5164 KB | Output is correct |
16 | Correct | 3 ms | 4956 KB | Output is correct |
17 | Correct | 2 ms | 4956 KB | Output is correct |
18 | Correct | 2 ms | 4956 KB | Output is correct |
19 | Correct | 2 ms | 5164 KB | Output is correct |
20 | Correct | 3 ms | 5164 KB | Output is correct |
21 | Correct | 3 ms | 4956 KB | Output is correct |
22 | Correct | 2 ms | 4956 KB | Output is correct |
23 | Correct | 3 ms | 4956 KB | Output is correct |
24 | Correct | 3 ms | 5168 KB | Output is correct |
25 | Correct | 2 ms | 4956 KB | Output is correct |
26 | Correct | 3 ms | 4956 KB | Output is correct |
27 | Correct | 2 ms | 4956 KB | Output is correct |
28 | Correct | 3 ms | 5192 KB | Output is correct |
29 | Correct | 94 ms | 5464 KB | Output is correct |
30 | Correct | 69 ms | 5304 KB | Output is correct |
31 | Correct | 49 ms | 5212 KB | Output is correct |
32 | Correct | 27 ms | 5212 KB | Output is correct |
33 | Correct | 18 ms | 5252 KB | Output is correct |
34 | Correct | 54 ms | 5208 KB | Output is correct |
35 | Correct | 70 ms | 5208 KB | Output is correct |
36 | Correct | 38 ms | 5208 KB | Output is correct |
37 | Correct | 92 ms | 5224 KB | Output is correct |
38 | Correct | 77 ms | 5304 KB | Output is correct |
39 | Correct | 72 ms | 5172 KB | Output is correct |
40 | Correct | 38 ms | 5212 KB | Output is correct |
41 | Correct | 40 ms | 5208 KB | Output is correct |
42 | Correct | 37 ms | 5212 KB | Output is correct |
43 | Correct | 18 ms | 5212 KB | Output is correct |
44 | Correct | 21 ms | 5300 KB | Output is correct |
45 | Correct | 25 ms | 5212 KB | Output is correct |
46 | Correct | 30 ms | 5208 KB | Output is correct |
47 | Correct | 34 ms | 5212 KB | Output is correct |
48 | Correct | 36 ms | 5212 KB | Output is correct |
49 | Correct | 56 ms | 5212 KB | Output is correct |
50 | Correct | 71 ms | 5208 KB | Output is correct |
51 | Correct | 28 ms | 5208 KB | Output is correct |
52 | Correct | 38 ms | 5320 KB | Output is correct |
53 | Correct | 49 ms | 5212 KB | Output is correct |
54 | Correct | 66 ms | 5212 KB | Output is correct |
55 | Execution timed out | 2015 ms | 16208 KB | Time limit exceeded |
56 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4956 KB | Output is correct |
2 | Correct | 2 ms | 4956 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 2 ms | 4956 KB | Output is correct |
5 | Correct | 2 ms | 5144 KB | Output is correct |
6 | Correct | 2 ms | 4956 KB | Output is correct |
7 | Correct | 3 ms | 4956 KB | Output is correct |
8 | Correct | 3 ms | 4956 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 3 ms | 4952 KB | Output is correct |
11 | Correct | 3 ms | 4956 KB | Output is correct |
12 | Correct | 3 ms | 4956 KB | Output is correct |
13 | Correct | 2 ms | 4956 KB | Output is correct |
14 | Correct | 4 ms | 4956 KB | Output is correct |
15 | Correct | 3 ms | 5164 KB | Output is correct |
16 | Correct | 3 ms | 4956 KB | Output is correct |
17 | Correct | 2 ms | 4956 KB | Output is correct |
18 | Correct | 2 ms | 4956 KB | Output is correct |
19 | Correct | 2 ms | 5164 KB | Output is correct |
20 | Correct | 3 ms | 5164 KB | Output is correct |
21 | Correct | 3 ms | 4956 KB | Output is correct |
22 | Correct | 2 ms | 4956 KB | Output is correct |
23 | Correct | 3 ms | 4956 KB | Output is correct |
24 | Correct | 3 ms | 5168 KB | Output is correct |
25 | Correct | 2 ms | 4956 KB | Output is correct |
26 | Correct | 3 ms | 4956 KB | Output is correct |
27 | Correct | 2 ms | 4956 KB | Output is correct |
28 | Correct | 3 ms | 5192 KB | Output is correct |
29 | Correct | 94 ms | 5464 KB | Output is correct |
30 | Correct | 69 ms | 5304 KB | Output is correct |
31 | Correct | 49 ms | 5212 KB | Output is correct |
32 | Correct | 27 ms | 5212 KB | Output is correct |
33 | Correct | 18 ms | 5252 KB | Output is correct |
34 | Correct | 54 ms | 5208 KB | Output is correct |
35 | Correct | 70 ms | 5208 KB | Output is correct |
36 | Correct | 38 ms | 5208 KB | Output is correct |
37 | Correct | 92 ms | 5224 KB | Output is correct |
38 | Correct | 77 ms | 5304 KB | Output is correct |
39 | Correct | 72 ms | 5172 KB | Output is correct |
40 | Correct | 38 ms | 5212 KB | Output is correct |
41 | Correct | 40 ms | 5208 KB | Output is correct |
42 | Correct | 37 ms | 5212 KB | Output is correct |
43 | Correct | 18 ms | 5212 KB | Output is correct |
44 | Correct | 21 ms | 5300 KB | Output is correct |
45 | Correct | 25 ms | 5212 KB | Output is correct |
46 | Correct | 30 ms | 5208 KB | Output is correct |
47 | Correct | 34 ms | 5212 KB | Output is correct |
48 | Correct | 36 ms | 5212 KB | Output is correct |
49 | Correct | 56 ms | 5212 KB | Output is correct |
50 | Correct | 71 ms | 5208 KB | Output is correct |
51 | Correct | 28 ms | 5208 KB | Output is correct |
52 | Correct | 38 ms | 5320 KB | Output is correct |
53 | Correct | 49 ms | 5212 KB | Output is correct |
54 | Correct | 66 ms | 5212 KB | Output is correct |
55 | Execution timed out | 2049 ms | 13780 KB | Time limit exceeded |
56 | Halted | 0 ms | 0 KB | - |