Submission #105189


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 A - Celsius と Fahrenheit
User Sei
Language C++ (GCC 4.4.7)
Score 0
Code Size 1127 Byte
Status
Exec Time 24 ms
Memory 932 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, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt
Case Name Status Exec Time Memory
00_sample_01.txt 22 ms 800 KB
00_sample_02.txt 23 ms 804 KB
00_sample_03.txt 23 ms 740 KB
test_01.txt 22 ms 808 KB
test_02.txt 23 ms 808 KB
test_03.txt 23 ms 804 KB
test_04.txt 22 ms 920 KB
test_05.txt 22 ms 808 KB
test_06.txt 22 ms 796 KB
test_07.txt 24 ms 924 KB
test_08.txt 22 ms 928 KB
test_09.txt 24 ms 808 KB
test_10.txt 23 ms 804 KB
test_11.txt 21 ms 804 KB
test_12.txt 23 ms 808 KB
test_13.txt 20 ms 804 KB
test_14.txt 23 ms 804 KB
test_15.txt 21 ms 792 KB
test_16.txt 20 ms 800 KB
test_17.txt 21 ms 920 KB
test_18.txt 24 ms 808 KB
test_19.txt 21 ms 928 KB
test_20.txt 22 ms 932 KB