제출 #826665

#제출 시각아이디문제언어결과실행 시간메모리
826665powervic08은행 (IZhO14_bank)C++17
컴파일 에러
0 ms0 KiB
import java.util.*; import java.io.*; public class bank { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(f.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); int[] arr = new int[n]; int[] notes = new int[m]; st = new StringTokenizer(f.readLine()); for (int i = 0; i < n; i++) arr[i] = Integer.parseInt(st.nextToken()); st = new StringTokenizer(f.readLine()); for (int j = 0; j < m; j++) notes[j] = Integer.parseInt(st.nextToken()); int[] dp = new int[1 << m]; int[] left = new int[1 << m]; Arrays.fill(dp, -1); Arrays.fill(left, -1); left[0] = dp[0] = 0; boolean good = false; for (int i = 0; i < 1 << m; i++) { for (int j = 0; j < m; j++) { if ((i & (1 << j)) != 0) { if (dp[i ^ (1 << j)] == -1) continue; int amt = notes[j] + left[i ^ (1 << j)]; int need = arr[dp[i ^ (1 << j)]]; if (amt == need) { dp[i] = Math.max(dp[i], dp[i ^ (1 << j)] + 1); left[i] = 0; } else if (amt < need) { dp[i] = Math.max(dp[i], dp[i ^ (1 << j)]); left[i] = amt; } } } if (dp[i] == n) { out.println("YES"); good = true; break; } } if (!good) out.println("NO"); out.close(); f.close(); } }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
bank.cpp:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
bank.cpp:4:1: error: expected unqualified-id before 'public'
    4 | public class bank {
      | ^~~~~~