結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
koyopro
|
| 提出日時 | 2019-12-19 00:58:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 2,394 bytes |
| コンパイル時間 | 2,206 ms |
| コンパイル使用メモリ | 186,240 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2024-07-06 23:11:51 |
| 合計ジャッジ時間 | 4,349 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) printf(__VA_ARGS__)
typedef pair<int, int> pos;
int pos::*x = &pos::first;
int pos::*y = &pos::second;
int dxy[] = {0, 1, 0, -1, 0};
/*================================*/
int N, T;
signed main()
{
#if DEBUG
std::ifstream in("input.txt");
std::cin.rdbuf(in.rdbuf());
#endif
cin >> N;
int L[N];
REP(i, N) cin >> L[i];
int AC[N];
vector< map<string, int> > POINTS(N);
REP(i, N) AC[i] = 0;
map<string, pos> MAP;
cin >> T;
string name;
char C;
REP(i, T) {
cin >> name >> C;
// 50×★の数+50×★の数 / (0.8+ 0.2×ACの順位)
int problem = C - 'A';
int star = L[problem];
AC[problem]++;
int score = floor(50 * star + (50 * star) / (0.8 + 0.2 * AC[problem]));
if (MAP.count(name) == 0) MAP[name] = *new pos(0, 0);
MAP[name].first += score;
MAP[name].second = i; // order
POINTS[problem][name] = score;
}
struct User
{
std::string name;
int score;
int last;
User(string _name, int _score, int _last)
{
name = _name;
score = _score;
last = _last;
}
};
auto comp = [](User a, User b) { return a.score < b.score || (a.score == b.score && a.last > b.last); };
priority_queue<User, std::vector<User>, decltype(comp)> que(comp);
int rank = 1;
for (auto const& item: MAP)
{
User *u = new User(item.first, item.second.first, item.second.second);
que.push(*u);
}
while (!que.empty()) {
User u = que.top();
que.pop();
// 順位, 名前, 各問題のスコア, スコアの合計点
cout << rank++ << " " << u.name << " ";
REP(i, N) cout << POINTS[i][u.name] << " ";
cout << u.score << endl;
}
return 0;
}
koyopro