UCF “Practice” Local Contest — Aug 25, 2018 Call Me Maybe
Posted 2aptx4869
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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; }
以上是关于UCF “Practice” Local Contest — Aug 25, 2018 Call Me Maybe的主要内容,如果未能解决你的问题,请参考以下文章
UCF Local Programming Contest 2015(Practice)个人分析
UCF Local Programming Contest 2012(Practice)
UCF “Practice” Local Contest — Aug 25, 2018 Rummy Score
UCF “Practice” Local Contest — Aug 25, 2018 Call Me Maybe
UCF “Practice” Local Contest — Aug 25, 2018 Boots Exchange 水题