結果
問題 | No.628 Tagの勢い |
ユーザー |
![]() |
提出日時 | 2018-04-05 00:14:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,047 bytes |
コンパイル時間 | 1,457 ms |
コンパイル使用メモリ | 83,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 22:40:12 |
合計ジャッジ時間 | 2,301 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 7 |
ソースコード
#include <stdio.h>#include <algorithm>#include <deque>#include <string>#include <iostream>using namespace std;using ll = long long;void solve();int main() {solve();#ifdef DBGwhile (true);#endif}class Score {public:string tag;int score;};void solve() {int n, no, m, s, sp = 0, np = 0;Score scores[10000];cin >> n;for (int i = 0; i < n; i++) {cin >> no >> m >> s;for (int j = 0; j < m; j++) {cin >> scores[sp].tag;scores[sp++].score = s;}}sort(scores, scores + sp, [](const Score& a, const Score& b) {if (a.tag != b.tag)return a.tag < b.tag;return a.score < b.score;});for (int i = 1; i < sp; i++) {if (scores[np].tag != scores[i].tag) {scores[++np].tag = scores[i].tag;scores[np].score = scores[i].score;} else {scores[np].score += scores[i].score;}}np++;sort(scores, scores + np, [](const Score& a, const Score& b) {return a.score > b.score;});for (int i = 0; i < min(10, np); i++)printf("%s %d\n", scores[i].tag.c_str(), scores[i].score);}