Submission #691812

# Submission time Handle Problem Language Result Execution time Memory
691812 2023-01-31T15:38:14 Z sunshine19 Vlak (COCI20_vlak) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<vector>
#include<map>

using namespace std;

struct Node {
    int num = 0;
    map<char, Node*> next;

};

void add(Node* root, string s) {
    for(char c : s) {
        if(root->next.find(c) == root->next.end()) 
            root->next[c] = new Node();
        root = root->next[c];
    }
}

bool traverse(Node* ni, Node* em, bool move, int d) {
    Node* ts[] = {em, ni};
    if(ts[move]->next.empty())
        return !move;

    for(auto p : ts[move]->next) {
        if(ts[!move]->next.find(p.first) == ts[!move]->next.end())
            return move;
        if(traverse(ni->next[p.first], em->next[p.first], !move, d+1) == move)
            return move; 
    }

    return !move; 
    
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    Node* nina = new Node();
    Node* ema = new Node();

    int n, m;
    string s;

    cin>>n;
    while(n--) {
        cin>>s;
        add(nina, s);
    }

    cin>>m;
    while(m--) {
        cin>>s;
        add(ema, s);
    }

    cout<<(traverse(nina, ema, true, 0) ? "Nina" : "Emilija")<<endl;

return 0;
}
v

Compilation message

Main.cpp:64:1: error: 'v' does not name a type
   64 | v
      | ^