結果
| 問題 |
No.3065 Speedrun (Normal)
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2025-03-21 21:23:17 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 153 ms / 2,000 ms |
| コード長 | 739 bytes |
| コンパイル時間 | 2,280 ms |
| コンパイル使用メモリ | 82,952 KB |
| 実行使用メモリ | 54,552 KB |
| 最終ジャッジ日時 | 2025-03-21 21:23:27 |
| 合計ジャッジ時間 | 5,009 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = 4;
Obj[] arr = new Obj[n];
for (int i = 0; i < n; i++) {
Obj o = new Obj();
o.a = sc.nextInt();
arr[i] = o;
}
PriorityQueue<Obj> que = new PriorityQueue<>((o1, o2) -> o1.t - o2.t);
for (int i = 0; i < n; i++) {
arr[i].t = sc.nextInt();
que.add(arr[i]);
}
long t = sc.nextLong();
sc.close();
long ans = 0;
while (!que.isEmpty()) {
Obj o = que.poll();
long lim = t / o.t;
long val = Math.min(lim, o.a);
ans += val;
t -= val * o.t;
}
System.out.println(ans);
}
static class Obj {
int a, t;
}
}
ks2m