結果

問題 No.628 Tagの勢い
ユーザー kazuppakazuppa
提出日時 2024-07-23 19:15:14
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,615 bytes
コンパイル時間 9,660 ms
コンパイル使用メモリ 337,196 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-23 19:15:25
合計ジャッジ時間 9,525 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define moda 998244353LL
#define modb 1000000007LL
#define dai 2500000000000000000LL
#define tyu 2500000000
#define sho -dai
#define eps 1e-14
#define yn(x) cout<<(x ? "Yes":"No")<<endl;
#define YN(x) cout<<(x ? "YES":"NO")<<endl;
using it=long long;
using un=unsigned long long;
using db=long double;
using st=string;
using ch=char;
using bo=bool;
using P=pair<it,it>;
using T=tuple<it,it,it>;
using vi=vector<it>;
using vd=vector<db>;
using vs=vector<st>;
using vc=vector<ch>;
using vb=vector<bo>;
using vp=vector<P>;
using sp=set<P>;
using ss=set<st>;
using si=set<it>;
using vvi=vector<vi>;
using vvd=vector<vd>;
using vvs=vector<vs>;
using vvb=vector<vb>;
using vvc=vector<vc>;
using vvp=vector<vp>;
using vsi=vector<si>;
using vsp=vector<sp>;
using vvsi=vector<vsi>;
using vvsp=vector<vsp>;
using vvvi=vector<vvi>;
using vvvd=vector<vvd>;
using vvvvi=vector<vvvi>;
using mint=modint;
const it dx[4]={0,1,0,-1};
const it dy[4]={1,0,-1,0};

bo comp(pair<st,it> &a,pair<st,it> &b){
  if(a.second!=b.second)return a.second>b.second;
  return a.first<b.first;
}

int main(){
  it n;cin>>n;
  map<st,it> yu;
  rep(i,1,n){
    it no,m,s;cin>>no>>m>>s;
    rep(j,1,m){
      st t;cin>>t;
      yu[t]+=s;
    }
  }
  vector<pair<st,it>> wai;
  for(auto i:yu)wai.push_back({i.first,i.second});
  sort(all(wai),comp);
  rep(i,0LL,min((it)(yu.size()),10LL)-1)cout<<wai[i].first<<" "<<wai[i].second<<endl;
}
0