結果
| 問題 |
No.2372 既視感
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2023-07-07 21:29:36 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,119 bytes |
| コンパイル時間 | 2,327 ms |
| コンパイル使用メモリ | 78,288 KB |
| 実行使用メモリ | 57,980 KB |
| 最終ジャッジ日時 | 2024-07-21 17:11:46 |
| 合計ジャッジ時間 | 8,591 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 17 |
ソースコード
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int q = sc.nextInt();
List<String> list = new ArrayList<>();
PrintWriter pw = new PrintWriter(System.out);
for (int i = 0; i < q; i++) {
int tp = sc.nextInt();
if (tp == 1) {
list.add(sc.next());
} else {
int[] t = new int[6];
String[] d = new String[6];
for (int j = 0; j < 6; j++) {
d[j] = sc.next();
t[j] = sc.nextInt();
}
int sum = 0;
int m = list.size();
int ans = 6;
for (int j = 0; j < 6; j++) {
boolean flg = false;
for (int j2 = Math.max(m - n, 0); j2 < m; j2++) {
if (list.get(j2).equals(d[j])) {
flg = true;
break;
}
}
if (flg) {
sum += Math.min(t[j], k);
} else {
sum += t[j];
}
if (sum > 60) {
ans = j;
break;
}
}
pw.println(ans);
}
}
pw.flush();
sc.close();
}
}
ks2m