Submission #308053


Source Code Expand

Copy
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
vector<string> v;
vector<P> g[400];
map<string,int> mp;
char large[11],small[11];
P memo[400];
P solve(int idx) {
	if(memo[idx].first!=1) {
		return memo[idx];
	}
	for(int i=0;i<g[idx].size();i++) {
		P ret=solve(g[idx][i].first);
		ret.first*=g[idx][i].second;
		memo[idx]=max(memo[idx],ret);
	}
	return memo[idx];
}
int main() {
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		int m;
		scanf("%s %d %s",large,&m,small);
		int l , s;
		if(mp.find(large)==mp.end()) {
			l=mp.size();
			v.push_back(large);
			mp[large]=l;
		}else {
			l=mp[large];
		}
		if(mp.find(small)==mp.end()) {
			s=mp.size();
			v.push_back(small);
			mp[small]=s;
		}else {
			s=mp[small];
		}
		g[l].push_back(P(s,m));
	}
	for(int i=0;i<v.size();i++) {
		memo[i]=P(1,i);
	}
	int ans=0;
	int l ,r;
	for(int i=0;i<v.size();i++) {
		P ret=solve(i);
		if(ans<ret.first) {
			ans=ret.first;
			l=i,r=ret.second;
		}
	}
	printf("1week=604800sec\n");
	//printf("1%s=%d%s\n",v[l].c_str(),ans,v[r].c_str());
}

Submission Info

Submission Time
Task C - 変わった単位
User Div9851
Language C++ (G++ 4.6.4)
Score 0
Code Size 1217 Byte
Status
Exec Time 312 ms
Memory 16952 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:31:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

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 26 ms 1044 KB
00_sample_02.txt 25 ms 1048 KB
00_sample_03.txt 25 ms 1044 KB
chokudai_solo_01.txt 27 ms 1044 KB
chokudai_solo_02.txt 308 ms 16952 KB
chokudai_solo_03.txt 309 ms 16952 KB
chokudai_vs_cucumber_01.txt 28 ms 1172 KB
chokudai_vs_cucumber_02.txt 308 ms 16948 KB
chokudai_vs_cucumber_03.txt 308 ms 16928 KB
chokudai_vs_cucumber_04.txt 304 ms 16952 KB
chokudai_vs_cucumber_05.txt 309 ms 16944 KB
chokudai_vs_kensho_01.txt 28 ms 1048 KB
chokudai_vs_kensho_02.txt 27 ms 1052 KB
chokudai_vs_kensho_03.txt 29 ms 1060 KB
chokudai_vs_kensho_04.txt 28 ms 1048 KB
chokudai_vs_kensho_05.txt 312 ms 16936 KB
chokudai_vs_kensho_06.txt 311 ms 16936 KB
chokudai_vs_kensho_07.txt 30 ms 996 KB
chokudai_vs_kensho_08.txt 304 ms 16932 KB
chokudai_vs_kensho_09.txt 303 ms 16952 KB
chokudai_vs_laycurse_01.txt 27 ms 1164 KB
chokudai_vs_laycurse_02.txt 27 ms 1052 KB
chokudai_vs_laycurse_03.txt 27 ms 1072 KB
chokudai_vs_sanagipp_01.txt 27 ms 1172 KB
chokudai_vs_sanagipp_02.txt 26 ms 1052 KB
chokudai_vs_sanagipp_03.txt 26 ms 1056 KB
chokudai_vs_sanagipp_04.txt 28 ms 1060 KB
chokudai_vs_takahashikun_01.txt 28 ms 1052 KB
chokudai_vs_takahashikun_02.txt 28 ms 936 KB
chokudai_vs_takahashikun_03.txt 26 ms 1060 KB
chokudai_vs_takahashikun_04.txt 28 ms 1060 KB
chokudai_vs_uwitenpen_01.txt 28 ms 1064 KB
chokudai_vs_uwitenpen_02.txt 28 ms 1060 KB
chokudai_vs_uwitenpen_03.txt 28 ms 1068 KB