結果

問題 No.318 学学学学学
ユーザー kou6839kou6839
提出日時 2015-12-12 16:43:56
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 770 bytes
コンパイル時間 4,111 ms
コンパイル使用メモリ 83,504 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-10-13 11:48:31
合計ジャッジ時間 12,456 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 419 ms
65,652 KB
testcase_01 AC 610 ms
64,176 KB
testcase_02 AC 671 ms
68,068 KB
testcase_03 AC 539 ms
60,868 KB
testcase_04 AC 630 ms
67,100 KB
testcase_05 AC 1,714 ms
76,944 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

import javax.print.attribute.HashAttributeSet;

public class Main {
	static long gcd(long a,long b){
		return b == 0 ? a : gcd(b, a%b);
	}
	static long lcm(long a, long b){
		return a*b/gcd(a, b);
	}
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		HashMap<Integer, Integer> last = new HashMap<>();
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
			last.put(a[i], i);
		}
		PriorityQueue<Integer> s = new PriorityQueue<>((x,y)->y-x);
		for(int i=0;i<n;i++){
			if(!s.contains(a[i]))s.add(a[i]);
			System.out.print(s.peek());
			if(last.get(a[i])==i) s.remove(a[i]);
			if(i==n-1){
				System.out.println();
			}else{
				System.out.print(" ");
			}
		}
		
	}
}
0