답안 #1054856

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1054856 2024-08-12T12:40:02 Z cnastea Joker (BOI20_joker) C++14
14 / 100
410 ms 736 KB
#include <bits/stdc++.h>
using namespace std;
vector<int> a[2000];
map<pair<int, int>, int> t;
int l, r, c, b[2000], d[2000];

void dfs(int u, int p){
    if(c) return;
    for(int v : a[u]){
        if(v == p || (t[{min(u, v), max(u, v)}] >= l && t[{min(u, v), max(u, v)}] <= r) || c) continue;
        if(b[v] && (d[v] == d[u])) {c = 1; continue;}
        else if(b[v]) continue;
        b[v] = 1;
        d[v] = (d[u]+1)%2;
        dfs(v, u);
    }
}

int main(){
    int n, m, q;
    cin >> n >> m >> q;
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        t[{min(x, y), max(x, y)}] = i;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    while(q--){
        cin >> l >> r;
        l--; r--;
        for(int i = 0; i < n; i++) b[i] = 0;
        c = 0;
        for(int i = 0; i < n; i++){
            if(c || b[i]) continue;
            b[i] = 1;
            dfs(i, -1);
        }
        if(c) cout << "YES\n";
        else cout << "NO\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 488 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 600 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 488 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 600 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 144 ms 604 KB Output is correct
30 Correct 253 ms 604 KB Output is correct
31 Correct 258 ms 724 KB Output is correct
32 Correct 214 ms 600 KB Output is correct
33 Correct 141 ms 604 KB Output is correct
34 Correct 222 ms 604 KB Output is correct
35 Correct 303 ms 600 KB Output is correct
36 Correct 310 ms 604 KB Output is correct
37 Correct 410 ms 604 KB Output is correct
38 Correct 401 ms 604 KB Output is correct
39 Correct 389 ms 604 KB Output is correct
40 Correct 320 ms 604 KB Output is correct
41 Correct 297 ms 728 KB Output is correct
42 Correct 282 ms 604 KB Output is correct
43 Correct 111 ms 600 KB Output is correct
44 Correct 40 ms 720 KB Output is correct
45 Correct 48 ms 600 KB Output is correct
46 Correct 65 ms 600 KB Output is correct
47 Correct 319 ms 736 KB Output is correct
48 Correct 308 ms 708 KB Output is correct
49 Correct 296 ms 604 KB Output is correct
50 Correct 292 ms 704 KB Output is correct
51 Correct 294 ms 604 KB Output is correct
52 Correct 286 ms 600 KB Output is correct
53 Correct 291 ms 604 KB Output is correct
54 Correct 285 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 604 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 488 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 600 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Runtime error 1 ms 604 KB Execution killed with signal 11
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 488 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 600 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 144 ms 604 KB Output is correct
30 Correct 253 ms 604 KB Output is correct
31 Correct 258 ms 724 KB Output is correct
32 Correct 214 ms 600 KB Output is correct
33 Correct 141 ms 604 KB Output is correct
34 Correct 222 ms 604 KB Output is correct
35 Correct 303 ms 600 KB Output is correct
36 Correct 310 ms 604 KB Output is correct
37 Correct 410 ms 604 KB Output is correct
38 Correct 401 ms 604 KB Output is correct
39 Correct 389 ms 604 KB Output is correct
40 Correct 320 ms 604 KB Output is correct
41 Correct 297 ms 728 KB Output is correct
42 Correct 282 ms 604 KB Output is correct
43 Correct 111 ms 600 KB Output is correct
44 Correct 40 ms 720 KB Output is correct
45 Correct 48 ms 600 KB Output is correct
46 Correct 65 ms 600 KB Output is correct
47 Correct 319 ms 736 KB Output is correct
48 Correct 308 ms 708 KB Output is correct
49 Correct 296 ms 604 KB Output is correct
50 Correct 292 ms 704 KB Output is correct
51 Correct 294 ms 604 KB Output is correct
52 Correct 286 ms 600 KB Output is correct
53 Correct 291 ms 604 KB Output is correct
54 Correct 285 ms 600 KB Output is correct
55 Runtime error 1 ms 604 KB Execution killed with signal 11
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 488 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 600 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 144 ms 604 KB Output is correct
30 Correct 253 ms 604 KB Output is correct
31 Correct 258 ms 724 KB Output is correct
32 Correct 214 ms 600 KB Output is correct
33 Correct 141 ms 604 KB Output is correct
34 Correct 222 ms 604 KB Output is correct
35 Correct 303 ms 600 KB Output is correct
36 Correct 310 ms 604 KB Output is correct
37 Correct 410 ms 604 KB Output is correct
38 Correct 401 ms 604 KB Output is correct
39 Correct 389 ms 604 KB Output is correct
40 Correct 320 ms 604 KB Output is correct
41 Correct 297 ms 728 KB Output is correct
42 Correct 282 ms 604 KB Output is correct
43 Correct 111 ms 600 KB Output is correct
44 Correct 40 ms 720 KB Output is correct
45 Correct 48 ms 600 KB Output is correct
46 Correct 65 ms 600 KB Output is correct
47 Correct 319 ms 736 KB Output is correct
48 Correct 308 ms 708 KB Output is correct
49 Correct 296 ms 604 KB Output is correct
50 Correct 292 ms 704 KB Output is correct
51 Correct 294 ms 604 KB Output is correct
52 Correct 286 ms 600 KB Output is correct
53 Correct 291 ms 604 KB Output is correct
54 Correct 285 ms 600 KB Output is correct
55 Runtime error 1 ms 604 KB Execution killed with signal 11
56 Halted 0 ms 0 KB -