2014 Super Training #6 F Search in the Wiki --集合取交+暴力

原题: ZOJ 3674 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3674

题意不难理解,很容易想到用暴力,但是无从下手,不知道怎么实现。后来看了网上的代码,直接用vector和map暴力,用到了set_intersection()函数,之前也听过这个函数,但是一直没写过,于是照着他的代码打了一遍,算是见识一下这个函数了。

代码看一下就能看懂了,关键看自己能不能写出来。

代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
using namespace std;
#define N 10007

char name[35],ss[210],tips[210];
int check[110];

int main()
{
    int n,m,i,j,a,b;
    int cword,ctips,ind,ccheck;
    while(scanf("%d",&n)!=EOF)
    {
        cword = ctips = 0;
        map<string,int> word;
        map<string,int> tip;
        map<int,string> atip;
        vector<int> G[110],K1,K2;
        for(j=1;j<=n;j++)
        {
            scanf("%s",name);
            if(!word[name])
                word[name] = ++cword;  //hash
            a = word[name];
            getchar();
            gets(ss);
            ind = 0;
            for(i=0;ss[i];i++)
            {
                if(ss[i] == ' ')
                {
                    tips[ind] = '