Submission #429404

#TimeUsernameProblemLanguageResultExecution timeMemory
429404SansPapyrus683Bank (IZhO14_bank)Cpython 3
Compilation error
0 ms0 KiB
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class bank { public static void main(String[] args) throws IOException { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer initial = new StringTokenizer(read.readLine()); int peopleNum = Integer.parseInt(initial.nextToken()); int noteNum = Integer.parseInt(initial.nextToken()); int[] people = Arrays.stream(read.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); int[] banknotes = Arrays.stream(read.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); int[] leftover = new int[1 << noteNum]; int[] peopleCovered = new int[1 << noteNum]; Arrays.fill(leftover, -1); Arrays.fill(peopleCovered, -1); leftover[0] = 0; peopleCovered[0] = 0; for (int s = 0; s < (1 << noteNum); s++) { for (int last = 0; last < noteNum; last++) { if ((s & (1 << last)) == 0) { continue; } int prev = s & ~(1 << last); if (peopleCovered[prev] == -1) { continue; } int new_amt = leftover[prev] + banknotes[last]; int curr_target = people[peopleCovered[prev]]; if (new_amt < curr_target) { peopleCovered[s] = peopleCovered[prev]; leftover[s] = new_amt; } else if (new_amt == curr_target) { peopleCovered[s] = peopleCovered[prev] + 1; leftover[s] = 0; } } if (peopleCovered[s] == peopleNum) { System.out.println("YES"); return; } } System.out.println("NO"); } }

Compilation message (stderr)

File "bank.py", line 7
    public class bank {
           ^
SyntaxError: invalid syntax