結果
問題 |
No.628 Tagの勢い
|
ユーザー |
|
提出日時 | 2018-10-24 14:05:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 981 bytes |
コンパイル時間 | 1,383 ms |
コンパイル使用メモリ | 99,272 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 19:05:32 |
合計ジャッジ時間 | 1,994 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <limits> #include <iostream> #include <algorithm> #include <vector> #include <iomanip> #include <map> #include <queue> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208; template <typename T> using GPQ = priority_queue<T, vector<T>, greater<T>>; int main() { int n; cin >> n; map<string, int> m; for (int i = 0; i < n; ++i) { int xxxxx; cin >> xxxxx; int a, b; cin >> a >> b; for (int j = 0; j < a; ++j) { string s; cin >> s; m[s] += b; } } GPQ<pair<int, string>> Q; for (auto &&k : m) { if(k.second){ Q.emplace(-k.second, k.first); } } for (int i = 0; i < 10 && !Q.empty(); ++i) { auto p = Q.top(); Q.pop(); cout << p.second << " " << -p.first << "\n"; } return 0; }