結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2020-04-03 22:39:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,413 bytes |
| コンパイル時間 | 2,745 ms |
| コンパイル使用メモリ | 78,164 KB |
| 実行使用メモリ | 63,136 KB |
| 最終ジャッジ日時 | 2024-07-03 04:59:56 |
| 合計ジャッジ時間 | 10,373 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 12 |
ソースコード
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] sa = br.readLine().split(" ");
int n = Integer.parseInt(sa[0]);
int x = Integer.parseInt(sa[1]);
int y = Integer.parseInt(sa[2]);
int z = Integer.parseInt(sa[3]);
sa = br.readLine().split(" ");
Obj[] arr = new Obj[n];
for (int i = 0; i < n; i++) {
Obj o = new Obj();
o.a = Integer.parseInt(sa[i]);
o.x = o.a % 5000 / 1000 + 1;
o.y = o.a % 10000 / 5000;
o.z = o.a / 10000;
arr[i] = o;
}
br.close();
Arrays.parallelSort(arr);
for (int i = 0; i < n; i++) {
int v = Math.min(arr[i].x, x);
arr[i].x -= v;
x -= v;
if (arr[i].x > 0) {
arr[i].y++;
}
}
if (x != 0) {
y += x / 5;
}
for (int i = 0; i < n; i++) {
int v = Math.min(arr[i].y, y);
arr[i].y -= v;
y -= v;
if (arr[i].y > 0) {
arr[i].z++;
}
}
if (y != 0) {
z += y / 2;
}
for (int i = 0; i < n; i++) {
z -= arr[i].z;
if (z < 0) {
System.out.println("No");
return;
}
}
System.out.println("Yes");
}
static class Obj implements Comparable<Obj> {
int a, x, y, z;
@Override
public int compareTo(Obj o) {
if (x != o.x) {
return x - o.x;
}
return y - o.y;
}
}
}
ks2m