All submissions for this problem are available.The ‘Money Heists’ have robbed gold bars from 8 banks. But soon the professor finds out that, to trap them, a few banks have started cooperating. The banks have embedded a special kind of detector into the gold bar such that if gold from their bank is placed inside the same container as that of the co-operating bank, the police will be alerted. Since no one wants the ‘Money Heists’ to be caught your task is to write a program to help ‘Money Heists’ evade the police and also maximize the amount of gold that can be placed into a single container for easy transportation. ###Input : First Line will contains 8 space-separated integers denoting the amount of gold(in Kilogram) stolen from each bank. The next line will contain the total number of pairs $p$ denoting the banks having co-operation between them. The next $p$ lines will contain 2 space-separated numbers denoting the co-operating banks. Numbers used to denote banks will be from ( 1-8 ) for each 8 banks. ###Output : Output the maximum amount of Gold that can be placed in a single container. ###Constraints: Everything is guaranteed to easily fit in 32 bit integer type. ###Sample Input : 3 14 5 2 3 4 1 9 4 1 2 2 3 4 5 7 8 ###Sample Output : 30
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.