結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー kurenai3110kurenai3110
提出日時 2016-11-18 23:27:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,477 bytes
コンパイル時間 1,045 ms
コンパイル使用メモリ 89,904 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 12:08:49
合計ジャッジ時間 2,431 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 25 ms
4,380 KB
testcase_06 AC 26 ms
4,380 KB
testcase_07 AC 11 ms
4,376 KB
testcase_08 AC 15 ms
4,380 KB
testcase_09 AC 31 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 8 ms
4,380 KB
testcase_13 AC 26 ms
4,376 KB
testcase_14 AC 36 ms
4,376 KB
testcase_15 AC 5 ms
4,376 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 32 ms
4,380 KB
testcase_20 AC 36 ms
4,380 KB
testcase_21 AC 6 ms
4,380 KB
testcase_22 AC 6 ms
4,380 KB
testcase_23 AC 7 ms
4,376 KB
testcase_24 AC 20 ms
4,376 KB
testcase_25 AC 29 ms
4,376 KB
testcase_26 AC 11 ms
4,380 KB
testcase_27 AC 10 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:7: warning: ‘num’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   int num;
       ^~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <map>
using namespace std;

int main()
{
	int n; cin >> n;
	vector<int>L(n);
	vector<int>Speed(n);
	for (int i = 0; i < n; i++)cin >> L[i];
	int T; cin >> T;
	vector<string>Name;
	vector<int>P(T);

	vector<vector<int>>Score;
	vector<pair<pair<int, int>,int>>Rank;
	for (int i = 0; i < T; i++) {
		string name;
		char c;
		cin >> name >> c;
		P[i] = c - 'A';

		int num;
		if (Name.size() == 0) {
			Name.push_back(name);
			num = 0;
			vector<int>l(n);
			Score.push_back(l);
			Rank.push_back(make_pair(make_pair(0, i),0));
		}
		else {
			for (int j = 0; j < Name.size(); j++) {
				if (Name[j] == name) {
					num = j;
					break;
				}
				if (j == Name.size() - 1) {
					Name.push_back(name);
					num = j+1;
					vector<int>l(n);
					Score.push_back(l);
					Rank.push_back(make_pair(make_pair(0, i),j+1));
				}
			}
		}

		int score = 50 * L[P[i]] + 50 * L[P[i]] / (0.8 + 0.2*(float)(Speed[P[i]]+1));
		Speed[P[i]]++;

		Score[num][P[i]] = score;
		Rank[num].first.first += score;
		Rank[num].first.second = T-i;
	}

	sort(Rank.begin(), Rank.end());
	reverse(Rank.begin(), Rank.end());

	for (int i = 0; i < Score.size(); i++) {
		cout << i + 1 << " " << Name[Rank[i].second] << " ";
		for (int j = 0; j < n; j++) {
			if (j)cout << " ";
			cout << Score[Rank[i].second][j];
		}
		cout << " " << Rank[i].first.first << endl;
	}
	
    return 0;
}
0