結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | masa |
提出日時 | 2016-11-19 00:25:11 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 1,638 bytes |
コンパイル時間 | 1,515 ms |
コンパイル使用メモリ | 100,156 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-05-04 19:53:27 |
合計ジャッジ時間 | 2,220 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 4 ms
5,376 KB |
testcase_04 | AC | 3 ms
5,376 KB |
testcase_05 | AC | 10 ms
5,376 KB |
testcase_06 | AC | 13 ms
5,376 KB |
testcase_07 | AC | 6 ms
5,376 KB |
testcase_08 | AC | 8 ms
5,376 KB |
testcase_09 | AC | 14 ms
5,376 KB |
testcase_10 | AC | 3 ms
5,376 KB |
testcase_11 | AC | 4 ms
5,376 KB |
testcase_12 | AC | 6 ms
5,376 KB |
testcase_13 | AC | 13 ms
5,376 KB |
testcase_14 | AC | 14 ms
5,376 KB |
testcase_15 | AC | 5 ms
5,376 KB |
testcase_16 | AC | 4 ms
5,376 KB |
testcase_17 | AC | 4 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 16 ms
5,376 KB |
testcase_20 | AC | 14 ms
5,376 KB |
testcase_21 | AC | 4 ms
5,376 KB |
testcase_22 | AC | 4 ms
5,376 KB |
testcase_23 | AC | 5 ms
5,376 KB |
testcase_24 | AC | 11 ms
5,376 KB |
testcase_25 | AC | 15 ms
5,376 KB |
testcase_26 | AC | 7 ms
5,376 KB |
testcase_27 | AC | 8 ms
5,376 KB |
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> #include <string> #include <map> using namespace std; typedef map<string, vector<int>> MSV; typedef pair<string, vector<int>> PSV; int f(int n, int k) { int ret = 50 * n + int(500.0 * n / (8 + 2 * k)); return ret; } int main() { int n, t; cin >> n; vector<int> l(n); for (int i = 0; i < n; i++) { cin >> l[i]; } cin >> t; string user; char problem_code; vector<int> n_ac(n, 0); MSV users; int idx_sum = n; int idx_last_timing = n + 1; for (int i = 0; i < t; i++) { cin >> user >> problem_code; int problem = problem_code - 'A'; n_ac[problem]++; int point = f(l[problem], n_ac[problem]); auto it = users.find(user); if (it == users.end()) { vector<int> v(n + 2, 0); v[problem] = point; v[idx_sum] += point; v[idx_last_timing] = i; users[user] = v; } else { it->second[problem] = point; it->second[idx_sum] += point; it->second[idx_last_timing] = i; } } vector<PSV> user_vec; for (auto p : users) { user_vec.emplace_back(make_pair(p.first, p.second)); } sort(user_vec.begin(), user_vec.end(), [&idx_sum, &idx_last_timing](PSV &p1, PSV&p2) { if (p1.second[idx_sum] == p2.second[idx_sum]) { return p1.second[idx_last_timing] < p2.second[idx_last_timing]; } else { return p1.second[idx_sum] > p2.second[idx_sum]; } return true; } ); for (int i = 0; i < user_vec.size(); i++) { cout << i + 1 << " " << user_vec[i].first; for (int j = 0; j <= n; j++) { cout << " " << user_vec[i].second[j]; } cout << endl; } return 0; }