• UCF “Practice” Local Contest — Aug 25, 2018 Call Me Maybe


     

     根据题意模拟

    #include <bits/stdc++.h>
    #define ull unsigned long long
    #define P pair<int, int>
    #define sc(n) scanf("%d", &n)
    using namespace std;
    
    const int p = 131;
    
    int n, m, tot, w[100005];
    vector<P> ve[100005];
    map<ull, int> mp;
    char s[25];
    P pp[55];
    
    int main()
    {
        sc(m);
        for (int i = 1; i <= m; ++i)
        {
            sc(n);
            for (int j = 1; j <= n; ++j)
            {
                scanf("%s", s + 1);
                ull res = 0;
                for (int k = 1; s[k]; ++k) res = res * p + s[k];
                if (mp.count(res)) ve[mp[res]].emplace_back(make_pair(i, j));
                else mp[res] = ++tot, ve[tot].emplace_back(make_pair(i, j));
            }
        }
        sc(n); int flag = 1;
        for (int i = 1; i <= n; ++i)
        {
            scanf("%s", s + 1);
            ull res = 0;
            for (int j = 1; s[j]; ++j) res = res * p + s[j];
            if (!mp.count(res)) { flag = 0; break; }
            int id = mp[res];
            pp[i] = ve[id][(w[id]++) % ve[id].size()];
        }
        if (flag == 0) { puts("NOT POSSIBLE"); return 0; }
        for (int i = 1; i <= n; ++i) printf("%d %d
    ", pp[i].first, pp[i].second);
        return 0;
    }
    

      

  • 相关阅读:
    sharepoint 2013 configure my site
    格式化xml
    斗罗大陆
    spring的beans.xml的配置
    jdom学习:读取xml文件
    java中加载xml文件方法
    struts2中IOC控制反转应用
    struts2.xml的配置与技巧
    struts2中的路径问题
    struts.xml详细配置
  • 原文地址:https://www.cnblogs.com/2aptx4869/p/12636560.html
Copyright © 2020-2023  润新知