結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー AshurnasirpalAshurnasirpal
提出日時 2016-11-18 22:59:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,335 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 167,296 KB
実行使用メモリ 4,896 KB
最終ジャッジ日時 2023-08-17 11:27:50
合計ジャッジ時間 3,409 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 13 ms
4,440 KB
testcase_06 AC 16 ms
4,424 KB
testcase_07 AC 9 ms
4,380 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 17 ms
4,804 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 15 ms
4,588 KB
testcase_14 AC 18 ms
4,896 KB
testcase_15 AC 6 ms
4,376 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 5 ms
4,384 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 20 ms
4,552 KB
testcase_20 AC 18 ms
4,608 KB
testcase_21 AC 6 ms
4,376 KB
testcase_22 AC 5 ms
4,376 KB
testcase_23 AC 7 ms
4,376 KB
testcase_24 AC 14 ms
4,376 KB
testcase_25 AC 18 ms
4,400 KB
testcase_26 AC 9 ms
4,380 KB
testcase_27 AC 8 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int ac[30] = {};
int l[30];
struct node{
  string name;
  int score[30];
  int tot;
  int t;
  bool operator < (const node &right) const{
    if(tot != right.tot) 
      return tot > right.tot;
    else
      return t < right.t; 
  }
};
map<string, node> res;


int calc(int n,int m){
  return (int)floor(50*n + (50*n)/(0.8 + 0.2*m));
}

int main(void){
  int n,t;
  cin >> n;
  for(int i = 0;i < n;++i){
    cin >> l[i];
  }
  cin >> t;
  for(int i = 0;i < t;++i){
    string name;
    char prob;
    cin >> name >> prob;
    if(res.find(name) == res.end()){
      node n;
      n.name = name;
      fill(n.score, n.score+30,0);
      n.tot = 0;
      res[name] = n;
    }
    int p = prob - 'A';
    ++ac[p];
    int score = calc(l[p],ac[p]);
    node update = res[name];
    update.score[p] = score;
    update.tot += score;
    update.t = i+1;
    res[name] = update;
  }
  vector < node > rank;
  for(map<string, node>::iterator itr = res.begin();
      itr != res.end();++itr){
    rank.push_back(itr->second);
  }
  sort(rank.begin(),rank.end());
  for(int i = 0;i < (int)rank.size();++i){
    cout << i+1;
    cout << " " <<rank[i].name;
    for(int j = 0;j < n;++j){
      cout << " " << rank[i].score[j];
    }
    cout << " " << rank[i].tot;
    cout << endl;
  }
  return 0;
}
0