結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
|
提出日時 | 2016-11-18 22:53:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,153 bytes |
コンパイル時間 | 1,857 ms |
コンパイル使用メモリ | 187,012 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 07:33:24 |
合計ジャッジ時間 | 2,977 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int n; scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:12:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | rep(i, n)scanf("%d", &l[i]); | ~~~~~^~~~~~~~~~~~~ main.cpp:15:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | int t; scanf("%d", &t); | ~~~~~^~~~~~~~~~
ソースコード
#include<bits/stdc++.h> #define INF 0x3f3f3f3f #define rep(i,n)for(int i=0;i<n;i++) using namespace std; typedef long long ll; typedef pair<int, int>P; int l[30]; int cnt[30]; int main() { int n; scanf("%d", &n); rep(i, n)scanf("%d", &l[i]); map<string, P>mp; map<string, vector<P>>k; int t; scanf("%d", &t); rep(i, t) { string s; char p; cin >> s >> p; p -= 'A'; cnt[p]++; k[s].push_back(P(p, 50 * l[p] + floor((double)50 * l[p] / (0.8 + 0.2*(double)cnt[p])))); mp[s].first += 50 * l[p] + floor((double)50 * l[p] / (0.8 + 0.2*(double)cnt[p])); mp[s].second = i; } vector<pair<string, P>>v; for (auto p : mp)v.push_back(p); sort(v.begin(), v.end(), [](pair<string, P>a, pair<string, P>b) { if (a.second.first != b.second.first)return a.second.first > b.second.first; return a.second.second < b.second.second; }); rep(i, v.size()) { cout << i + 1 << ' ' << v[i].first; rep(j, n) { auto itr = k[v[i].first].begin(); for (; itr != k[v[i].first].end(); itr++) { if ((*itr).first == j) { cout << ' ' << (*itr).second; goto g; } } cout << " 0"; g:; } cout <<' '<< v[i].second.first << endl; } }