結果

問題 No.2757 Pin Game
ユーザー tomoya
提出日時 2024-05-24 00:03:27
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 620 bytes
コンパイル時間 2,199 ms
コンパイル使用メモリ 74,088 KB
実行使用メモリ 70,968 KB
最終ジャッジ日時 2024-12-20 19:09:42
合計ジャッジ時間 7,860 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.2757 Pin Game
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] pins = new int[n];
        for (int i = 0; i < n; i++) {
            pins[i] = sc.nextInt();
        }

        int score = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (pins[x - 1] > 0) {
                score += y;
                pins[x - 1]--;
            }
        }

        System.out.println(score);
    }
}
0