Submission #648582

# Submission time Handle Problem Language Result Execution time Memory
648582 2022-10-07T06:06:30 Z mychecksedad Joker (BOI20_joker) C++17
Compilation error
0 ms 0 KB
/* Author : Mychecksdead */
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define PI 3.1415926535
#define pb push_back
#define setp() cout << setprecision(15)
#define all(x) x.begin(), x.end()
#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(x) cerr << #x << " is " << x << '\n';
const int N = 1e6+100, M = 1e5+10, F = 2147483646, K = 20;


int n, m, q, pos[N];
bool ok;
vector<int> path;
vector<pair<int, int>> g[N];
void dfs(int v, int p){
    vis[v] = 1;
    path.pb(v);
    pos[v] = path.size();
    for(auto k: g[v]){
        int u = k.first;
        if(l <= k.second && k.second <= r) continue;
        if(u != p){
            if(vis[u]){
                if(pos[v] % 2 == pos[u] % 2){
                    ok = 1;
                }
            }
            else
                dfs(u, v);
        }
    }
    path.pop_back();
}
void solve(){
    cin >> n >> m >> q;
    for(int i = 0; i < m; ++i){
        int u, v; cin >> u >> v;
        g[u].pb({v, i + 1});
        g[v].pb({u, i + 1});
    }
    if(n <= 2000){
        for(int i = 0; i < q; ++i){
            cin >> l >> r;
            vis.clear();
            vis.resize(n+1);
            ok = 0;
            for(int v = 1; v <= n; ++v) if(!vis[v]) dfs(v, v);
            if(ok) cout << "YES\n";
            else cout << "NO\n";
        }
    }
    else{

    }
}





int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    int T = 1, aa;
    // cin >> T;aa=T;
    while(T--){
        // cout << "Case #" << aa-T << ": ";
        solve();
        cout << '\n';
    }
    return 0;
 
}

Compilation message

Joker.cpp: In function 'void dfs(int, int)':
Joker.cpp:24:5: error: 'vis' was not declared in this scope
   24 |     vis[v] = 1;
      |     ^~~
Joker.cpp:29:12: error: 'l' was not declared in this scope
   29 |         if(l <= k.second && k.second <= r) continue;
      |            ^
Joker.cpp:29:41: error: 'r' was not declared in this scope
   29 |         if(l <= k.second && k.second <= r) continue;
      |                                         ^
Joker.cpp: In function 'void solve()':
Joker.cpp:51:20: error: 'l' was not declared in this scope
   51 |             cin >> l >> r;
      |                    ^
Joker.cpp:51:25: error: 'r' was not declared in this scope
   51 |             cin >> l >> r;
      |                         ^
Joker.cpp:52:13: error: 'vis' was not declared in this scope
   52 |             vis.clear();
      |             ^~~
Joker.cpp: In function 'int main()':
Joker.cpp:71:16: warning: unused variable 'aa' [-Wunused-variable]
   71 |     int T = 1, aa;
      |                ^~