結果
問題 | No.1816 MUL-DIV Game |
ユーザー | ripity |
提出日時 | 2022-01-21 22:33:28 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 932 bytes |
コンパイル時間 | 2,231 ms |
コンパイル使用メモリ | 73,828 KB |
実行使用メモリ | 69,268 KB |
最終ジャッジ日時 | 2023-08-17 06:50:39 |
合計ジャッジ時間 | 15,445 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 115 ms
56,212 KB |
testcase_01 | AC | 112 ms
55,872 KB |
testcase_02 | AC | 114 ms
56,088 KB |
testcase_03 | AC | 111 ms
56,260 KB |
testcase_04 | AC | 112 ms
55,796 KB |
testcase_05 | AC | 113 ms
55,988 KB |
testcase_06 | AC | 113 ms
56,408 KB |
testcase_07 | AC | 112 ms
56,080 KB |
testcase_08 | AC | 114 ms
56,248 KB |
testcase_09 | AC | 294 ms
60,508 KB |
testcase_10 | AC | 557 ms
61,272 KB |
testcase_11 | AC | 496 ms
61,036 KB |
testcase_12 | AC | 445 ms
61,172 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
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 | AC | 773 ms
67,440 KB |
testcase_27 | WA | - |
testcase_28 | AC | 779 ms
66,868 KB |
testcase_29 | WA | - |
ソースコード
import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int T = 1; while( T > 0 ) { solve(); T--; } pw.flush(); } static void solve() { int N = sc.nextInt(); PriorityQueue<Long> pqueue = new PriorityQueue<>(Collections.reverseOrder()); for( int i = 0; i < N; i++ ) { long a = sc.nextInt(); pqueue.offer(a); } for( int i = 0; i < N-1; i++ ) { long p = pqueue.poll(); long q = pqueue.poll(); if( i%2 == 0 ) pqueue.offer(p*q); else pqueue.offer((q+p-1)/p); } pw.println(pqueue.poll()); } }