結果
| 問題 | No.318 学学学学学 |
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-12-12 16:40:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 698 bytes |
| 記録 | |
| コンパイル時間 | 2,480 ms |
| コンパイル使用メモリ | 87,400 KB |
| 実行使用メモリ | 65,208 KB |
| 最終ジャッジ日時 | 2024-09-15 08:45:16 |
| 合計ジャッジ時間 | 8,626 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | RE * 17 TLE * 1 -- * 8 |
ソースコード
import java.util.*;
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);
int n = sc.nextInt();
int[] a = new int[n];
int[] last = new int[101010];
for(int i=0;i<n;i++){
a[i] = sc.nextInt();
last[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[a[i]]==i) s.remove(a[i]);
if(i==n-1){
System.out.println();
}else{
System.out.print(" ");
}
}
}
}
kou6839