Lanqiao Cup uses unordered_map to pay attention to details

When I was doing the real questions of the Lanqiao Cup today, I found that when submitting the code on the official website of the Lanqiao Cup, a compilation error occurred. After going in and looking at it, I found that the unordered_map could not be recognized during the Lanqiao Cup evaluation.

The specific error is as follows:

After searching, I found that if the code submitted in the Lanqiao Cup uses unordered_map or unordered_set, a header file needs to be added.

#include<tr1/unordered_set>

#include<tr1/unordered_map>

and namespace using namespace std::tr1;

#include<tr1/unordered_set>
#include<tr1/unordered_map>
using namespace std::tr1;

In addition, it should be noted that after adding the namespace using namespace std::tr1;, you still need to add the namespace using namespace std; otherwise, if the pair syntax is used in the code, a compilation error will occur.

And when using unordered_map<int,pair<int,int> > s , you need to note that there is a space between >> . If you do not add a space, the following error will appear.

Guess you like

Origin blog.csdn.net/weixin_54106682/article/details/128725343