답안 #925665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925665 2024-02-12T07:10:53 Z vjudge1 Joker (BOI20_joker) C++17
14 / 100
2000 ms 35768 KB
// By ObeliX
#include <bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include <unordered_map>
#include <cstddef>
#include <cassert>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>

using namespace std;

const long long N = 1e6 + 5;
const long long mod = 1e7 + 7;
const long long INF = 1e18;

long long n , m , q , can ;
long long used[N];

vector <pair<long long , long long>> g[N];

void dfs( int v , int l , int r ) {
    for ( auto it : g[v] ) {
        long long to = it.first , pos = it.second;
        if ( pos >= l && pos <= r ) {
            continue;
        }
        if ( used[to] == 0 ) {
            used[to] = used[v] + 1;
            dfs( to , l , r );
        }
        else {
            if ( abs( used[to] - used[v] ) % 2 == 0 ) {
                can = 1;
            }
        }
    }
}

int main(){
    //freopen( "cinema.in" , "r" , stdin );
    //freopen( "cinema.out" , "w" , stdout );
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> q;
    for ( int i = 1 ; i <= m ; i++ ) {
        long long x , y;
        cin >> x >> y;
        g[x].push_back( { y , i } );
        g[y].push_back( { x , i } );
    }
    while ( q-- ) {
        long long l , r;
        cin >> l >> r;
        can = 0;
        for ( int i = 1 ; i <= n ; i++ ) {
            if ( used[i] == 0 ) {
                used[i] = 1;
                dfs( i , l , r );
            }
            used[i] = 0;
        }
        if ( can == 1 ) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25188 KB Output is correct
2 Correct 5 ms 25208 KB Output is correct
3 Correct 5 ms 25204 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 6 ms 25180 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 7 ms 25180 KB Output is correct
10 Correct 7 ms 25180 KB Output is correct
11 Correct 7 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25176 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25180 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 6 ms 25176 KB Output is correct
20 Correct 6 ms 25176 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 7 ms 25224 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 6 ms 25180 KB Output is correct
26 Correct 7 ms 25180 KB Output is correct
27 Correct 6 ms 25180 KB Output is correct
28 Correct 7 ms 25176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25188 KB Output is correct
2 Correct 5 ms 25208 KB Output is correct
3 Correct 5 ms 25204 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 6 ms 25180 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 7 ms 25180 KB Output is correct
10 Correct 7 ms 25180 KB Output is correct
11 Correct 7 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25176 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25180 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 6 ms 25176 KB Output is correct
20 Correct 6 ms 25176 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 7 ms 25224 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 6 ms 25180 KB Output is correct
26 Correct 7 ms 25180 KB Output is correct
27 Correct 6 ms 25180 KB Output is correct
28 Correct 7 ms 25176 KB Output is correct
29 Correct 44 ms 25176 KB Output is correct
30 Correct 95 ms 25356 KB Output is correct
31 Correct 101 ms 25180 KB Output is correct
32 Correct 80 ms 25376 KB Output is correct
33 Correct 66 ms 25176 KB Output is correct
34 Correct 94 ms 25372 KB Output is correct
35 Correct 105 ms 25364 KB Output is correct
36 Correct 30 ms 25176 KB Output is correct
37 Correct 59 ms 25180 KB Output is correct
38 Correct 48 ms 25176 KB Output is correct
39 Correct 67 ms 25364 KB Output is correct
40 Correct 74 ms 25180 KB Output is correct
41 Correct 72 ms 25372 KB Output is correct
42 Correct 70 ms 25180 KB Output is correct
43 Correct 70 ms 25176 KB Output is correct
44 Correct 88 ms 25388 KB Output is correct
45 Correct 90 ms 25180 KB Output is correct
46 Correct 92 ms 25180 KB Output is correct
47 Correct 67 ms 25180 KB Output is correct
48 Correct 72 ms 25180 KB Output is correct
49 Correct 80 ms 25368 KB Output is correct
50 Correct 88 ms 25180 KB Output is correct
51 Correct 77 ms 25176 KB Output is correct
52 Correct 80 ms 25176 KB Output is correct
53 Correct 87 ms 25176 KB Output is correct
54 Correct 110 ms 25176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25188 KB Output is correct
2 Correct 5 ms 25208 KB Output is correct
3 Execution timed out 2059 ms 35052 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25188 KB Output is correct
2 Correct 5 ms 25208 KB Output is correct
3 Correct 5 ms 25204 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 6 ms 25180 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 7 ms 25180 KB Output is correct
10 Correct 7 ms 25180 KB Output is correct
11 Correct 7 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25176 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25180 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 6 ms 25176 KB Output is correct
20 Correct 6 ms 25176 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 7 ms 25224 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 6 ms 25180 KB Output is correct
26 Correct 7 ms 25180 KB Output is correct
27 Correct 6 ms 25180 KB Output is correct
28 Correct 7 ms 25176 KB Output is correct
29 Execution timed out 2059 ms 35052 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25188 KB Output is correct
2 Correct 5 ms 25208 KB Output is correct
3 Correct 5 ms 25204 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 6 ms 25180 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 7 ms 25180 KB Output is correct
10 Correct 7 ms 25180 KB Output is correct
11 Correct 7 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25176 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25180 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 6 ms 25176 KB Output is correct
20 Correct 6 ms 25176 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 7 ms 25224 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 6 ms 25180 KB Output is correct
26 Correct 7 ms 25180 KB Output is correct
27 Correct 6 ms 25180 KB Output is correct
28 Correct 7 ms 25176 KB Output is correct
29 Correct 44 ms 25176 KB Output is correct
30 Correct 95 ms 25356 KB Output is correct
31 Correct 101 ms 25180 KB Output is correct
32 Correct 80 ms 25376 KB Output is correct
33 Correct 66 ms 25176 KB Output is correct
34 Correct 94 ms 25372 KB Output is correct
35 Correct 105 ms 25364 KB Output is correct
36 Correct 30 ms 25176 KB Output is correct
37 Correct 59 ms 25180 KB Output is correct
38 Correct 48 ms 25176 KB Output is correct
39 Correct 67 ms 25364 KB Output is correct
40 Correct 74 ms 25180 KB Output is correct
41 Correct 72 ms 25372 KB Output is correct
42 Correct 70 ms 25180 KB Output is correct
43 Correct 70 ms 25176 KB Output is correct
44 Correct 88 ms 25388 KB Output is correct
45 Correct 90 ms 25180 KB Output is correct
46 Correct 92 ms 25180 KB Output is correct
47 Correct 67 ms 25180 KB Output is correct
48 Correct 72 ms 25180 KB Output is correct
49 Correct 80 ms 25368 KB Output is correct
50 Correct 88 ms 25180 KB Output is correct
51 Correct 77 ms 25176 KB Output is correct
52 Correct 80 ms 25176 KB Output is correct
53 Correct 87 ms 25176 KB Output is correct
54 Correct 110 ms 25176 KB Output is correct
55 Execution timed out 2097 ms 35768 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 25188 KB Output is correct
2 Correct 5 ms 25208 KB Output is correct
3 Correct 5 ms 25204 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 6 ms 25180 KB Output is correct
8 Correct 6 ms 25180 KB Output is correct
9 Correct 7 ms 25180 KB Output is correct
10 Correct 7 ms 25180 KB Output is correct
11 Correct 7 ms 25176 KB Output is correct
12 Correct 6 ms 25180 KB Output is correct
13 Correct 6 ms 25180 KB Output is correct
14 Correct 6 ms 25176 KB Output is correct
15 Correct 6 ms 25180 KB Output is correct
16 Correct 6 ms 25180 KB Output is correct
17 Correct 6 ms 25180 KB Output is correct
18 Correct 6 ms 25180 KB Output is correct
19 Correct 6 ms 25176 KB Output is correct
20 Correct 6 ms 25176 KB Output is correct
21 Correct 6 ms 25180 KB Output is correct
22 Correct 6 ms 25180 KB Output is correct
23 Correct 7 ms 25224 KB Output is correct
24 Correct 6 ms 25180 KB Output is correct
25 Correct 6 ms 25180 KB Output is correct
26 Correct 7 ms 25180 KB Output is correct
27 Correct 6 ms 25180 KB Output is correct
28 Correct 7 ms 25176 KB Output is correct
29 Correct 44 ms 25176 KB Output is correct
30 Correct 95 ms 25356 KB Output is correct
31 Correct 101 ms 25180 KB Output is correct
32 Correct 80 ms 25376 KB Output is correct
33 Correct 66 ms 25176 KB Output is correct
34 Correct 94 ms 25372 KB Output is correct
35 Correct 105 ms 25364 KB Output is correct
36 Correct 30 ms 25176 KB Output is correct
37 Correct 59 ms 25180 KB Output is correct
38 Correct 48 ms 25176 KB Output is correct
39 Correct 67 ms 25364 KB Output is correct
40 Correct 74 ms 25180 KB Output is correct
41 Correct 72 ms 25372 KB Output is correct
42 Correct 70 ms 25180 KB Output is correct
43 Correct 70 ms 25176 KB Output is correct
44 Correct 88 ms 25388 KB Output is correct
45 Correct 90 ms 25180 KB Output is correct
46 Correct 92 ms 25180 KB Output is correct
47 Correct 67 ms 25180 KB Output is correct
48 Correct 72 ms 25180 KB Output is correct
49 Correct 80 ms 25368 KB Output is correct
50 Correct 88 ms 25180 KB Output is correct
51 Correct 77 ms 25176 KB Output is correct
52 Correct 80 ms 25176 KB Output is correct
53 Correct 87 ms 25176 KB Output is correct
54 Correct 110 ms 25176 KB Output is correct
55 Execution timed out 2059 ms 35052 KB Time limit exceeded
56 Halted 0 ms 0 KB -