{"id":7435,"date":"2024-03-30T17:01:03","date_gmt":"2024-03-30T09:01:03","guid":{"rendered":""},"modified":"2024-03-30T17:01:03","modified_gmt":"2024-03-30T09:01:03","slug":"HRBUST 1314 \u706b\u5f71\u5fcd\u8005\u4e4b\uff5e\u7eb2\u624b\u3010MAP\u3011","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7435.html","title":{"rendered":"HRBUST 1314 \u706b\u5f71\u5fcd\u8005\u4e4b\uff5e\u7eb2\u624b\u3010MAP\u3011"},"content":{"rendered":"

\u706b\u5f71\u5fcd\u8005\u4e4b\uff5e\u7eb2\u624b<\/p>\n\n\n\n\n
 <\/td>\n<\/tr>\n
\n\n\n\n
Time Limit: 3000 MS<\/td>\nMemory Limit: 65536 K<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Total Submit: 246(78 users)<\/span><\/td>\nTotal Accepted: 101(69 users)<\/span><\/td>\nRating:\"HRBUST\"HRBUST\"HRBUST<\/td>\nSpecial Judge: No<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n
Description<\/td>\n<\/tr>\n
\n

\u56e0\u4e3a\u5927\u86c7\u4e38\u7684\u6363\u4e71\uff0c\u6728\u53f6\u5fcd\u8005\u6751\u75db\u5931\u4e86\u548c\u853c\u7684\u4e09\u4ee3\u706b\u5f71\uff0c\u6240\u4ee5\u8eab\u4e3a\u4e09\u4ee3\u706b\u5f71\u5f92\u5f1f\u4e4b\u4e00\u7684\u7eb2\u624b\u4e0d\u5f97\u4e0d\u63a5\u53d7\u6728\u53f6\u6751\u706b\u5f71\u7684\u804c\u52a1\uff5e\uff0c\u56e0\u4e3a\u521a\u521a\u4e0a\u4efb\uff0c\u6240\u4ee5\u7eb2\u624b\u5927\u4eba\u9700\u8981\u5bf9\u6728\u53f6\u6751\u4e3b\u8981\u5fcd\u8005\u7684\u5b9e\u529b\u6709\u4e2a\u4e86\u89e3\uff0c\u4ee5\u65b9\u4fbf\u4ee5\u540e\u5206\u914d\u4efb\u52a1\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u7edf\u8ba1\u4e00\u4e0b\u6bcf\u4e2a\u5fcd\u8005\u7684\u5b9e\u529b\u9ad8\u4f4e\uff0c\u4f5c\u4e3a\u521a\u521a\u901a\u8fc7\u516c\u52a1\u5458\u9009\u62d4\u7684\u4f60\uff0c\u8fd9\u53ef\u662f\u4e2a\u5f88\u597d\u7684\u8868\u73b0\u673a\u4f1a\uff5e\u4f60\u9700\u8981\u505a\u7684\u662f\u5c06\u6240\u6709\u7ed9\u5b9a\u5fcd\u8005\u90e8\u5206\u5b9e\u529b\u9ad8\u4f4e\u5173\u7cfb\uff0c\u7136\u540e\u5728\u9700\u8981\u7684\u65f6\u5019\u80fd\u591f\u5feb\u901f\u7684\u67e5\u627e\u5230.<\/p>\n

\"HRBUST<\/p>\n<\/td>\n<\/tr>\n

Input<\/td>\n<\/tr>\n
\u7ed9\u51fa\u4e00\u4e2a\u6574\u6570<\/span>n<\/span>\uff0c\u7136\u540e<\/span>n<\/span>\u884c\u6bcf\u884c\u7ed9\u51fa\u4e24\u4e2a\u540d\u5b57\uff0c\u8868\u793a\u524d\u4e00\u4e2a\u5fcd\u8005\u5f3a\u4e8e\u540e\u4e00\u4e2a\uff0c\u7136\u540e\u662f\u4e00\u4e2a\u6574\u6570<\/span>m<\/span>\uff0c\u8868\u793a<\/span>m<\/span>\u4e2a\u67e5\u627e\uff0c\u7136\u540e\u662f<\/span>m<\/span>\u884c\uff0c\u6bcf\u884c\u4e5f\u662f\u4e24\u4e2a\u540d\u5b57\u3002\u8f93\u5165\u5230\u6587\u4ef6\u5c3e\u3002\u5fcd\u8005\u7684\u4e2a\u6570\u5728<\/span>1000<\/span>\u4ee5\u5185\uff0c\u540d\u5b57\u4e0d\u957f\u4e8e<\/span>20<\/span>\uff0c<\/span>n<1000000,m<=1000<\/span>\u3002<\/span><\/td>\n<\/tr>\n
Output<\/td>\n<\/tr>\n
\u5bf9\u4e8e\u6bcf\u4e2a\u67e5\u627e\uff0c\u8f93\u51fa\u4e24\u4e2a\u5fcd\u8005\u7684\u5f3a\u5f31\u5173\u7cfb\uff0c\u5982\u679c\u524d\u4e00\u4e2a\u5f3a\u4e8e\u540e\u4e00\u4e2a\uff0c\u8f93\u51fa\u201c<\/span>win\u201d<\/span>\uff0c\u5982\u679c\u524d\u4e00\u4e2a\u5f31\u4e8e\u540e\u4e00\u4e2a\uff0c\u8f93\u51fa\u201d<\/span>lose\u201d,<\/span>\u5982\u679c\u4e0d\u80fd\u786e\u5b9a\u6216\u67e5\u627e\u4e0d\u5230\uff0c\u8f93\u51fa\u201d<\/span>unknown\u201d<\/span>\u3002<\/span>(<\/span>\u5f3a\u5f31\u5173\u7cfb\u4e0d\u80fd\u4f20\u9012\u3002\uff09<\/span><\/td>\n<\/tr>\n
Sample Input<\/td>\n<\/tr>\n
\n

3<\/p>\n

abc bcd<\/p>\n

def fgh<\/p>\n

def abc<\/p>\n

2<\/p>\n

bcd fgh<\/p>\n

fgh def<\/p>\n<\/td>\n<\/tr>\n

Sample Output<\/td>\n<\/tr>\n
\n

unknown<\/p>\n

lose<\/p>\n<\/td>\n<\/tr>\n

Source<\/td>\n<\/tr>\n
2012 Spring Contest 3 - STL<\/td>\n<\/tr>\n
Author<\/td>\n<\/tr>\n
\u62c2\u6653<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/p>\n

\u539f\u672c\u89c9\u5f97\u5e94\u8be5\u662f\u5e76\u67e5\u96c6\uff0c\u3002\u3002\u3002\u7136\u540e\u53d1\u73b0\u6ca1\u6709\u5f3a\u5f31\u5173\u7cfb\u4f20\u9012\u3002\u3002\u3002\u55ef\uff0c\uff0c\uff0c\u8fd8\u662f\u60f3\u9ebb\u70e6\u4e86\u3002\u3002<\/p>\n

\u4f46\u8fd9\u9898\u8fd8\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u601d\u8def\u9898\u3002\u3002<\/p>\n

<\/p>\n<\/p>\n

#include<cstdio>\n#include<algorithm>\n#include<iostream>\n#include<cstring>\n#include<cmath>\n#include<map>\nusing namespace std;\n\nint vis[1005][1005];\/\/\/\u8bb0\u5f55\u6bd4\u8d5b\u60c5\u51b5\uff0c\u5c31\u662f\u8bb0\u5f55\u8c01\u548c\u8c01\u6bd4\u8d5b\u8fc7\n\nint main()\n{\n\n    char namea[25];\n    char nameb[25];\n\n    map<string,int>m;\/\/\/\u786e\u7acbmap\u5bf9\u7acb\u5173\u7cfb\n\n    int n;\n    while(cin>>n)\n    {\n        m.clear();\/\/\/\u522b\u5fd8\u6e05\u7a7a\n        memset(vis,0,sizeof(vis));\n\n        int flag=0;\n\n        for(int i=0; i<n; i++)\n        {\n            scanf(\"%s %s\",namea,nameb);\n\n            if(!m[namea])\n            {\n                m[namea]=flag++;\/\/\/\u5982\u679c\u6ca1\u6709\u6bd4\u8d5b\u8fc7\uff0c\u5c31\u81ea\u589e\u3002\n            }\n            if(!m[nameb])\n            {\n                m[nameb]=flag++;\n            }\n            vis[m[namea]][m[nameb]]=1;\n        }\n        int n2;\n        scanf(\"%d\",&n2);\n\n        while(n2--)\n        {\n\n            scanf(\"%s %s\",namea,nameb);\n            \/*\n            unknow\u60c5\u51b5\u6709\u4ee5\u4e0b\u51e0\u79cd\n            !m[namea]||!m[nameb] \u4ee3\u8868\u4e24\u8005\u90fd\u6ca1\u6709\u53bb\u6bd4\u8d5b\n            vis[m[namea]][m[nameb]]&&vis[m[nameb]][m[namea]]  \u4ee3\u8868A\u6218\u80dc\u4e86B B\u53c8\u6218\u80dc\u4e86A\uff0c\u4e92\u76f8\u77db\u76fe\n            vis[m[namea]][m[nameb]]==0&&vis[m[nameb]][m[namea]]==0  \u4ee3\u8868\u4e24\u8005\u6ca1\u6709\u5fc5\u8fc7\u8d5b\n            *\/\n\n\n            if(!m[namea]||!m[nameb]||(vis[m[namea]][m[nameb]]&&vis[m[nameb]][m[namea]])||(vis[m[namea]][m[nameb]]==0&&vis[m[nameb]][m[namea]]==0))\n            {\n                printf(\"unknown\\n\");\n            }\n            else if(vis[m[namea]][m[nameb]])\n            {\n                printf(\"win\\n\");\n            }\n            else if(vis[m[nameb]][m[namea]])\n            {\n                printf(\"lose\\n\");\n            }\n\n        }\n    }\n    return 0;\n}\n\n<\/code><\/pre>\n<\/p>\n

<\/p>\n

<\/p>\n

<\/p>\n

<\/p>\n","protected":false},"excerpt":{"rendered":"HRBUST 1314 \u706b\u5f71\u5fcd\u8005\u4e4b\uff5e\u7eb2\u624b\u3010MAP\u3011\u706b\u5f71\u5fcd\u8005\u4e4b\uff5e\u7eb2\u624bTimeLimit:3000MSMemoryLimit:65536KTotalSubmit:246(78users)TotalAcc...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7435"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7435"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7435\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}