Submission #3874182


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

string s;
int i = 0;
map<char, int> map;

int read(){
    if (isalpha(s[i])) {
      return map[s[i++]];
    }
    i++;
    int l = read();
    i++;
    int r = read();
    i++;
    if (max(l, r) > 0 && min(l, r) == 0) {
      return max(l, r) - 1;
    }
    return -1;
}

int main(){
    cin >> s;
    char c;
    int d;
    while (cin >> c >> d) {
      map[c] = d;
    }
    if (read() != 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
}

Submission Info

Submission Time
Task B - Tournament Chart
User burgundyernie
Language C++14 (GCC 5.4.1)
Score 0
Code Size 557 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int read()’:
./Main.cpp:10:14: error: reference to ‘map’ is ambiguous
       return map[s[i++]];
              ^
./Main.cpp:6:16: note: candidates are: std::map<char, int> map
 map<char, int> map;
                ^
In file included from /usr/include/c++/5/map:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:80,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/stl_map.h:96:11: note:                 template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map
     class map
           ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:7: error: reference to ‘map’ is ambiguous
       map[c] = d;
       ^
./Main.cpp:6:16: note: candidates are: std::map<char, int> map
 map<char, int> map;
                ^
In file included from /usr/include/c++/5/map:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:80,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/stl_map.h:96:11: note:                ...