結果

問題 No.318 学学学学学
ユーザー cielciel
提出日時 2015-12-11 18:20:13
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 62,624 KB
実行使用メモリ 8,556 KB
最終ジャッジ日時 2023-09-04 17:29:49
合計ジャッジ時間 3,885 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,376 KB
testcase_01 AC 13 ms
4,376 KB
testcase_02 AC 16 ms
4,380 KB
testcase_03 AC 11 ms
4,380 KB
testcase_04 AC 14 ms
4,376 KB
testcase_05 AC 88 ms
8,528 KB
testcase_06 AC 99 ms
7,456 KB
testcase_07 AC 86 ms
6,692 KB
testcase_08 AC 74 ms
5,588 KB
testcase_09 AC 64 ms
4,792 KB
testcase_10 AC 47 ms
4,380 KB
testcase_11 AC 91 ms
8,448 KB
testcase_12 AC 72 ms
6,148 KB
testcase_13 AC 58 ms
5,272 KB
testcase_14 AC 46 ms
4,780 KB
testcase_15 AC 38 ms
4,376 KB
testcase_16 AC 29 ms
4,376 KB
testcase_17 AC 64 ms
8,484 KB
testcase_18 AC 47 ms
6,060 KB
testcase_19 AC 66 ms
8,556 KB
testcase_20 AC 25 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <map>
#include <cstdio>
int main(){
	int N,x,i=0;scanf("%d",&N);
	std::map<int,int>m,s;
	std::vector<int>v(N),sa(N),sb(N);
	for(;i<N;i++){
		scanf("%d",&x);
		v[i]=x;
		if(m.find(x)==m.end())sa[i]++;else sb[m[x]]--;
		m[x]=i,sb[i]++;
	}
	for(i=0;i<N;i++){
		if(sa[i])s[v[i]]=1;
		printf(i<N-1?"%d ":"%d\n",s.rbegin()->first);
		if(sb[i])s.erase(v[i]);
	}
}
0