結果
問題 | No.628 Tagの勢い |
ユーザー |
![]() |
提出日時 | 2024-09-15 00:14:44 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 691 bytes |
コンパイル時間 | 3,568 ms |
コンパイル使用メモリ | 266,948 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 00:14:49 |
合計ジャッジ時間 | 4,595 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n; cin >> n; map<string, int> mp; rep(_, n) { int no, m, s; cin >> no >> m >> s; rep(__, m) { string name; cin >> name; mp[name] += s; } } vector<pair<int, string>> ans; for (auto [name, score] : mp) { ans.push_back({ -score, name }); } sort(ans.begin(), ans.end()); rep(i, min(10, (int) ans.size())) { cout << ans[i].second << " " << -ans[i].first << endl; } return 0; }