Submission #792940

# Submission time Handle Problem Language Result Execution time Memory
792940 2023-07-25T11:23:28 Z Trisanu_Das Zamjena (COCI18_zamjena) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

int n, cond;
string a[50005], b[50005];
map<string, vector<string> > adj;
set<string> vis;

void dfs(string u){
  vis.insert(u);
  c += isdigit(u[0]);
  for(auto v : adj[u]) if(vis.find(v) == vis.end()) dfs(v);
}

int main(){
  int n; cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];
  for(int i = 0; i < n; i++){
    if(a[i] != b[i]){
      adj[a[i]].pb(b[i]);
      adj[b[i]].pb(a[i]);
    }
  }
  for(auto u : adj){
    if(vis.find(u.first) == v.end()){
      c = 0; dfs(u.first);
      if(c > 1){
        cout << "NE\n"; return 0;
      }
    }
  }
  cout << "DA\n";
}

Compilation message

zamjena.cpp: In function 'void dfs(std::string)':
zamjena.cpp:12:3: error: 'c' was not declared in this scope
   12 |   c += isdigit(u[0]);
      |   ^
zamjena.cpp: In function 'int main()':
zamjena.cpp:27:29: error: 'v' was not declared in this scope
   27 |     if(vis.find(u.first) == v.end()){
      |                             ^
zamjena.cpp:28:7: error: 'c' was not declared in this scope
   28 |       c = 0; dfs(u.first);
      |       ^