比赛 “Asm.Def战记之太平洋”杯 评测结果 WWWWWWWTTT
题目名称 Asm.Def谈笑风生 最终得分 0
用户昵称 pppoooiiizzy 运行时间 6.203 s
代码语言 C++ 内存使用 0.63 MiB
提交时间 2015-11-02 10:03:09
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<sstream>
#include<functional>
#include<set>

const int maxn = 100000 + 5;
using namespace std;

#define rep(i, j, k) for(int i = j; i <= k; i++)
#define drep(i, j, k) for(int i = j; i >= k; i--)
#define INF 03xfffffff

string a[maxn], temp;
int m, n, i, j, k, cnt = 1;
bool flag;

inline int read()
{
    int x = 0, f = 1;
    char ch = getchar();
    while( ch < '0' || ch > '9') {if( ch == '-') f = -1; ch = getchar();}
    while( ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    return x * f;
}

int main()
{
    freopen("asm_talk.in", "r", stdin);
    freopen("asm_talk.out", "w", stdout);
    n = read();
    cout<<n<<endl;
    rep(i, 1, n) {
        int tot = 0;
        m = read();
        if( m == 1) {
            cin>>a[++cnt];
        }
        else {
            cin>>temp;
            flag = 0;
            sort(a, a + cnt);
            rep(i, 1, cnt) {
                if(a[i] == temp) {cout<<"YES"<<endl; flag = 1;}
                for(int j = 0; j < a[i].size(); j++) {
                    if(a[i][j] == temp[j]) tot++;
                    if(a[i][j] == '*' && temp[j] != '*') a[i][j] = temp[j], tot++;
                }
                if(tot == a[i].size() && temp.size() == a[i].size() ) {cout<<"YES"<<endl; flag = 1;}
            }
            if( flag == 0) cout<<"NO"<<endl;
        }
    }
}