Submission #105192


Source Code Expand

Copy
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <string>

using namespace std;

int main(void) {
	map<string, vector<pair<double, string> > > map;
	set<string> strs;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int m;
		string large, small;
		cin >> large >> m >> small;
		map[large].push_back(make_pair(m, small));
		strs.insert(large);
	}

	int maxNum = 1;
	string ansMaxStr;
	string ansMinStr;
	for (set<string>::iterator it = strs.begin(); it != strs.end(); it++) {
		for (int i = 0; i < map[(*it)].size(); i++) {
			string maxStr;
			string midStr;
			string minStr;
			midStr = (*it);
			maxStr = (*it);
			int num = 1;
			while (strs.find(midStr) != strs.end() && map[midStr][i].first != 0) {
				cout << midStr << " " << map[midStr][i].second << endl;
				num *= map[midStr][i].first;
				minStr = map[midStr][i].second;
				midStr = map[midStr][i].second;
			}
			if (maxNum < num) {
				maxNum = num;
				ansMaxStr = maxStr;
				ansMinStr = minStr;
			}
		}
	}

	cout << "1" << ansMaxStr << "=" << maxNum << ansMinStr;
	return 0;
}

Submission Info

Submission Time
Task C - 変わった単位
User Sei
Language C++ (GCC 4.4.7)
Score 0
Code Size 1127 Byte
Status
Exec Time 2037 ms
Memory 9852 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 100 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, chokudai_solo_01.txt, chokudai_solo_02.txt, chokudai_solo_03.txt, chokudai_vs_cucumber_01.txt, chokudai_vs_cucumber_02.txt, chokudai_vs_cucumber_03.txt, chokudai_vs_cucumber_04.txt, chokudai_vs_cucumber_05.txt, chokudai_vs_kensho_01.txt, chokudai_vs_kensho_02.txt, chokudai_vs_kensho_03.txt, chokudai_vs_kensho_04.txt, chokudai_vs_kensho_05.txt, chokudai_vs_kensho_06.txt, chokudai_vs_kensho_07.txt, chokudai_vs_kensho_08.txt, chokudai_vs_kensho_09.txt, chokudai_vs_laycurse_01.txt, chokudai_vs_laycurse_02.txt, chokudai_vs_laycurse_03.txt, chokudai_vs_sanagipp_01.txt, chokudai_vs_sanagipp_02.txt, chokudai_vs_sanagipp_03.txt, chokudai_vs_sanagipp_04.txt, chokudai_vs_takahashikun_01.txt, chokudai_vs_takahashikun_02.txt, chokudai_vs_takahashikun_03.txt, chokudai_vs_takahashikun_04.txt, chokudai_vs_uwitenpen_01.txt, chokudai_vs_uwitenpen_02.txt, chokudai_vs_uwitenpen_03.txt
Case Name Status Exec Time Memory
00_sample_01.txt 29 ms 924 KB
00_sample_02.txt 29 ms 928 KB
00_sample_03.txt 24 ms 928 KB
chokudai_solo_01.txt 27 ms 924 KB
chokudai_solo_02.txt 2037 ms 9112 KB
chokudai_solo_03.txt 2036 ms 8984 KB
chokudai_vs_cucumber_01.txt 259 ms 916 KB
chokudai_vs_cucumber_02.txt 255 ms 924 KB
chokudai_vs_cucumber_03.txt 2035 ms 9376 KB
chokudai_vs_cucumber_04.txt 257 ms 920 KB
chokudai_vs_cucumber_05.txt 258 ms 1084 KB
chokudai_vs_kensho_01.txt 29 ms 924 KB
chokudai_vs_kensho_02.txt 29 ms 916 KB
chokudai_vs_kensho_03.txt 29 ms 1020 KB
chokudai_vs_kensho_04.txt 28 ms 1024 KB
chokudai_vs_kensho_05.txt 261 ms 928 KB
chokudai_vs_kensho_06.txt 258 ms 916 KB
chokudai_vs_kensho_07.txt 2036 ms 9108 KB
chokudai_vs_kensho_08.txt 2037 ms 9852 KB
chokudai_vs_kensho_09.txt 2037 ms 4348 KB
chokudai_vs_laycurse_01.txt 251 ms 928 KB
chokudai_vs_laycurse_02.txt 254 ms 956 KB
chokudai_vs_laycurse_03.txt 255 ms 1148 KB
chokudai_vs_sanagipp_01.txt 27 ms 968 KB
chokudai_vs_sanagipp_02.txt 27 ms 952 KB
chokudai_vs_sanagipp_03.txt 28 ms 952 KB
chokudai_vs_sanagipp_04.txt 28 ms 948 KB
chokudai_vs_takahashikun_01.txt 25 ms 1000 KB
chokudai_vs_takahashikun_02.txt 27 ms 952 KB
chokudai_vs_takahashikun_03.txt 27 ms 956 KB
chokudai_vs_takahashikun_04.txt 28 ms 944 KB
chokudai_vs_uwitenpen_01.txt 28 ms 960 KB
chokudai_vs_uwitenpen_02.txt 26 ms 896 KB
chokudai_vs_uwitenpen_03.txt 27 ms 1028 KB