結果

問題 No.628 Tagの勢い
ユーザー T.Stream
提出日時 2020-04-14 15:46:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 647 bytes
コンパイル時間 3,243 ms
コンパイル使用メモリ 206,200 KB
最終ジャッジ日時 2025-01-09 18:41:08
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    long n,i,j,k,m,s;
    cin >> n;
    string tag;
    vector<pair<long,string>> t(0);
    for(i=0; i<n; i++){
    	cin >> m >> m >> s;
    	for(j=0; j<m; j++){
    		cin >> tag;
    		for(k=0; k<t.size(); k++){
    			if(t[k].second==tag){
    				t[k].first+=s;
    				k=t.size()+1;
    			}
    		}
    		if(k==t.size()){
    			t.push_back({s,tag});
    		}
    	}
    }
    for(i=0; i<t.size(); i++){
    	t[i].first*=-1;
    }
    sort(t.begin(),t.end());
    
    for(i=0; i<10 && i<t.size(); i++){
    	cout << t[i].second << ' ' << -1*t[i].first << endl;
    }
    return 0;
}
0