Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- #include <map>
- #include <string>
- #define para pair <int,int>
- using namespace std;
- int main ()
- {
- string str;
- cin >> str;
- int n = str.length();
- cout << n;
- int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
- for(int i = 0; i < n; i ++) {
- switch (str[i]) {
- case 'W' : x2--;
- break;
- case 'E' : x2++;
- break;
- case 'N' : y2++;
- break;
- case 'S' : y2--;
- break;
- set <para> myset;
- para para1 = make_pair(x1, y1);
- para para2 = make_pair(x2, y2);
- myset.insert(para2);
- mymap[para1] = myset;
- }
- /*map<para, set<para>> mymap;
- for (int i = 1; i < 2; i ++) {
- set <para> myset;
- myset.insert(make_pair(i, i));
- mymap[make_pair(0, 0)] = myset;
- }
- if(mymap.find(make_pair(0, 0)) != mymap.end()) {
- if(mymap[make_pair(0, 0)].find(make_pair(2, 2)) != mymap[make_pair(0, 0)].end()) cout << "is in set" << endl;
- else {
- cout << "not int set";
- mymap[make_pair(0, 0)].insert(make_pair(2, 2));
- if(mymap[make_pair(0, 0)].find(make_pair(2, 2)) != mymap[make_pair(0, 0)].end()) cout << "NOW is in set";
- }
- }
- else cout << "not in map";*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement