結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
|
| 提出日時 | 2018-09-19 15:15:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 1,499 bytes |
| コンパイル時間 | 1,540 ms |
| コンパイル使用メモリ | 104,044 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 08:15:31 |
| 合計ジャッジ時間 | 2,834 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int n;
struct data{
public:
string name;
int lastsub, sum;
vector<int> score;
data() {};
data(string na, int ls, int s){
name = na;
lastsub = ls;
sum = s;
score.resize(26, 0);
};
bool operator<(const data other) const{
if(sum != other.sum) return sum > other.sum;
else return lastsub < other.lastsub;
}
void print(){
cout << name;
for(int i = 0; i < n; i++) cout << " " << score[i];
cout << " " << sum << endl;
}
};
int main(){
cin >> n;
int l[n];
for(int i = 0; i < n; i++) cin >> l[i];
int t;
cin >> t;
map<string, data> res;
string name;
char p;
int ac[26] = {};
for(int i = 0; i < t; i++){
cin >> name >> p;
int problem = p-'A';
int getsc = 50*l[problem] + 250*l[problem]/(4 + ac[problem]+1);
ac[problem]++;
if(res.count(name)){
res[name].lastsub = i;
res[name].score[problem] = getsc;
res[name].sum += getsc;
}else{
res[name] = data(name, i, getsc);
res[name].score[problem] = getsc;
}
}
vector<data> v;
for(auto x : res) v.push_back(x.second);
sort(v.begin(), v.end());
for(int i = 0; i < v.size(); i++){
cout << i+1 << " ";
v[i].print();
}
return 0;
}