結果
| 問題 | No.628 Tagの勢い | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2020-01-22 08:01:58 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 730 bytes | 
| コンパイル時間 | 1,132 ms | 
| コンパイル使用メモリ | 93,080 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-07 06:47:46 | 
| 合計ジャッジ時間 | 1,761 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<string,int> P;
bool Pya(const P& pf,P&ps){
    if(ps.second == pf.second){
        return ps.first > pf.first;
    }else{
        return ps.second < pf.second;
    }
}
int main(){
    map<string,int> A;
    int q;cin>>q;
    for(int _ = 0; q > _; _++){
        int ne;cin>>ne;
        int n,s;cin>>n>>s;
        for(int i = 0; n > i; i++){
            string z;cin>>z;
            A[z]+=s;
        }
    }
    vector<P> L;
    for(auto x:A){
        L.push_back(x);
    }
    sort(L.begin(),L.end(),Pya);
    for(int i = 0; min((int)L.size(),10) > i; i++){
        cout << L[i].first << " " << L[i].second << endl;
    }
}
            
            
            
        