Submission #858291

# Submission time Handle Problem Language Result Execution time Memory
858291 2023-10-08T03:20:50 Z Trisanu_Das Joker (BOI20_joker) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

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({v, i});
    adj[v].push_back({u, i});
  }
  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";
  }
}

Compilation message

Joker.cpp: In function 'void dfs(int, int, int, int, int)':
Joker.cpp:12:10: error: 'struct std::pair<int, int>' has no member named 'ff'
   12 |     if(v.ff == p || (l <= v.ss && v.ss <= r)) continue;
      |          ^~
Joker.cpp:12:29: error: 'struct std::pair<int, int>' has no member named 'ss'
   12 |     if(v.ff == p || (l <= v.ss && v.ss <= r)) continue;
      |                             ^~
Joker.cpp:12:37: error: 'struct std::pair<int, int>' has no member named 'ss'
   12 |     if(v.ff == p || (l <= v.ss && v.ss <= r)) continue;
      |                                     ^~
Joker.cpp:13:14: error: 'struct std::pair<int, int>' has no member named 'ff'
   13 |     if(vis[v.ff] == vis[u]) ok = true;
      |              ^~
Joker.cpp:14:15: error: 'struct std::pair<int, int>' has no member named 'ff'
   14 |     if(!vis[v.ff]) dfs(v.ff, u, 3 - c, l, r);
      |               ^~
Joker.cpp:14:26: error: 'struct std::pair<int, int>' has no member named 'ff'
   14 |     if(!vis[v.ff]) dfs(v.ff, u, 3 - c, l, r);
      |                          ^~
Joker.cpp: In function 'int main()':
Joker.cpp:23:26: error: 'i' was not declared in this scope
   23 |     adj[u].push_back({v, i});
      |                          ^
Joker.cpp:23:28: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   23 |     adj[u].push_back({v, i});
      |                            ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Joker.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Joker.cpp:24:28: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   24 |     adj[v].push_back({u, i});
      |                            ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Joker.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~