CSU 1503: ZZ买衣服

好吧,水了

有点要注意了,用ges(..)超时, scanf(...)就A掉了。。。

#include <iostream>

#include <stdio.h>

#include <string>

#include <set>

using namespace std;



int main ()

{

  set<string> st;

  pair< set<string>::iterator, bool > pr;

  char str[25];

  int n, m;

  while (scanf("%d%d", &n, &m) == 2)

  {

      getchar();

      while (n--)

      {

          scanf("%s",str);

          st.insert(str);

      }

      while (m--)

      {

          scanf("%s",str);

          pr = st.insert(str);

          if (pr.second)

              puts("YES");

          else

              puts("NO");

      }

      st.clear();

  }



  return 0;

}

 

你可能感兴趣的:(su)