結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー autumn-eelautumn-eel
提出日時 2016-11-18 23:14:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,151 bytes
コンパイル時間 2,147 ms
コンパイル使用メモリ 187,212 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-04 18:47:19
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |                ~~~~~^~~~~~~~~~

ソースコード

diff #

#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)cin >> l[i];
	map<string, P>mp;
	map<string, vector<P>>k;
	int t; cin >> t;
	rep(i, t) {
		string s; char c; cin >> s >> c; int p = (int)c;
		p -= 'A';
		cnt[p]++;
		k[s].push_back(P(p, 50 * l[p] + (int)floor((50. * (double)l[p]) / (0.8 + 0.2*(double)cnt[p]))));
		mp[s].first += 50 * l[p] + (int)floor((50. * (double)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) {
			bool flag = false;
			for (auto p : k[v[i].first]) {
				if (p.first == j) {
					cout << ' ' << p.second; flag = true; break;
				}
			}
			if (!flag)cout << " 0";
		}
		cout << ' ' << v[i].second.first << endl;
	}
}
0