結果
問題 | No.1015 おつりは要らないです |
ユーザー | ntk3264 |
提出日時 | 2020-04-04 16:15:00 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,247 bytes |
コンパイル時間 | 2,118 ms |
コンパイル使用メモリ | 74,196 KB |
実行使用メモリ | 64,972 KB |
最終ジャッジ日時 | 2023-09-16 05:46:19 |
合計ジャッジ時間 | 19,700 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
56,056 KB |
testcase_01 | AC | 121 ms
55,884 KB |
testcase_02 | AC | 121 ms
57,752 KB |
testcase_03 | AC | 122 ms
56,004 KB |
testcase_04 | AC | 122 ms
55,864 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 120 ms
55,976 KB |
testcase_08 | AC | 124 ms
55,724 KB |
testcase_09 | AC | 122 ms
56,024 KB |
testcase_10 | AC | 629 ms
62,712 KB |
testcase_11 | AC | 646 ms
64,040 KB |
testcase_12 | AC | 642 ms
61,436 KB |
testcase_13 | AC | 646 ms
62,560 KB |
testcase_14 | AC | 679 ms
63,564 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,864 KB |
testcase_31 | WA | - |
testcase_32 | AC | 483 ms
60,828 KB |
testcase_33 | AC | 610 ms
61,440 KB |
testcase_34 | AC | 125 ms
55,972 KB |
testcase_35 | WA | - |
testcase_36 | AC | 126 ms
56,108 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) y = cnt; 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"); } } }