結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー tossytossy
提出日時 2016-11-19 00:18:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 1,825 bytes
コンパイル時間 1,470 ms
コンパイル使用メモリ 114,780 KB
実行使用メモリ 4,496 KB
最終ジャッジ日時 2023-08-17 13:01:28
合計ジャッジ時間 2,976 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second

#define INF 2147483600

struct person{
  string name;
  int last, total;
  vector<int> scores;
  bool operator<(const person& r) const{
    if(total==r.total) return last<r.last;
    else return total > r.total;
  }
};

int main(){
  int n;
  cin>>n;
  vector<int> l(n);
  rep(i,n) scanf("%d", &l[i]);
  int t;
  cin>>t;
  map<string, vector<int> > vec;
  // 名前-> 各問の回答順, vec[n]は最後の回答順番
  vector<int> solved(n,0);
  // 各問題でこれまで何人正解者がいるか

  //  入力受け取る
  rep(i,t){
    string str1, str2;
    cin>>str1>>str2;
    if(vec.find(str1)==vec.end()) vec.insert(mp(str1, vector<int>(n+1,INF)) );
    vec[str1][str2[0]-'A'] = solved[str2[0]-'A']++;
    vec[str1][n]=i;
  }

  // 各人のスコアを計算し,ソート
  vector<person> score;
  for(auto v : vec){
    vector<int> nvec(n);
    int total=0;
    rep(i,n){
      if( (v.se)[i] != INF)  nvec[i] = (50*l[i]) + (50.*l[i])/(0.8 + 0.2*((v.se)[i]+1));
      else nvec[i] = 0;
      total += nvec[i];
    }
    score.push_back(person{v.fi, v.se[n], total, nvec});
  }

  sort(all(score));

  // 出力
  rep(i,score.size()){
    cout<<i+1<<" "<<score[i].name;
    rep(j,n) printf(" %d", score[i].scores[j]);
    printf(" %d\n", score[i].total);
  }

  return 0;
}
0