結果
問題 | No.1015 おつりは要らないです |
ユーザー | ntk3264 |
提出日時 | 2020-04-04 16:19:41 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,247 bytes |
コンパイル時間 | 2,387 ms |
コンパイル使用メモリ | 74,660 KB |
実行使用メモリ | 63,608 KB |
最終ジャッジ日時 | 2023-09-16 05:45:39 |
合計ジャッジ時間 | 20,005 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
55,912 KB |
testcase_01 | AC | 121 ms
55,952 KB |
testcase_02 | AC | 121 ms
55,784 KB |
testcase_03 | AC | 124 ms
56,104 KB |
testcase_04 | AC | 123 ms
55,784 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 124 ms
55,932 KB |
testcase_08 | AC | 122 ms
55,860 KB |
testcase_09 | AC | 122 ms
55,884 KB |
testcase_10 | AC | 628 ms
63,100 KB |
testcase_11 | AC | 632 ms
62,756 KB |
testcase_12 | AC | 652 ms
60,924 KB |
testcase_13 | AC | 633 ms
63,464 KB |
testcase_14 | AC | 673 ms
63,048 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 123 ms
55,756 KB |
testcase_31 | WA | - |
testcase_32 | AC | 482 ms
60,524 KB |
testcase_33 | AC | 583 ms
61,696 KB |
testcase_34 | AC | 123 ms
56,436 KB |
testcase_35 | WA | - |
testcase_36 | AC | 121 ms
56,208 KB |
ソースコード
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt(); int[] arr = new int[n]; for (int i=0; i<n; i++) arr[i] = sc.nextInt(); boolean[] check = new boolean[n]; int max = 0; label: for (int i=0; i<n; i++) { if (z==0) break label; if (arr[i]>=10000) { int cnt = arr[i]/10000; int remain = arr[i]%10000; if (z<cnt) cnt = z; z -= cnt; arr[i] -= cnt*10000; } } Arrays.sort(arr); if (z>0) { label: for (int i=n-1; i>=0; i--) { arr[i] = 0; check[i] = true; z--; if (z==0) break label; } } label: for (int i=0; i<n; i++) { if (y==0) break label; if (arr[i]>=5000) { int cnt = arr[i]/5000; int remain = arr[i]%5000; if (y<cnt) cnt = y; y -= cnt; arr[i] -= cnt*5000; } } Arrays.sort(arr); if (y>0) { label: for (int i=n-1; i>=0; i--) { arr[i] = 0; check[i] = true; y--; if (y==0) break label; } } label: for (int i=0; i<n; i++) { if (x<=0) break label; int cnt = arr[i]/1000; if (!check[i]) { x -= (cnt+1); check[i] = true; arr[i] = 0; } } int cnt = 0; for (int i=0; i<n; i++) { if (arr[i]==0 && check[i]==true) cnt++; } // for (int i=0; i<n; i++) { // System.out.println(arr[i]); // } // System.out.println("cnt" +cnt); if (cnt==n) { System.out.print("Yes"); } else { System.out.print("No"); } } }