結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,380 KB
testcase_01 AC 13 ms
4,380 KB
testcase_02 AC 15 ms
4,376 KB
testcase_03 AC 11 ms
4,380 KB
testcase_04 AC 13 ms
4,384 KB
testcase_05 AC 83 ms
8,508 KB
testcase_06 AC 99 ms
7,544 KB
testcase_07 AC 85 ms
6,760 KB
testcase_08 AC 75 ms
5,600 KB
testcase_09 AC 63 ms
4,804 KB
testcase_10 AC 47 ms
4,380 KB
testcase_11 AC 84 ms
8,488 KB
testcase_12 AC 69 ms
6,064 KB
testcase_13 AC 56 ms
5,336 KB
testcase_14 AC 46 ms
4,756 KB
testcase_15 AC 37 ms
4,380 KB
testcase_16 AC 28 ms
4,384 KB
testcase_17 AC 64 ms
8,500 KB
testcase_18 AC 47 ms
6,068 KB
testcase_19 AC 64 ms
8,560 KB
testcase_20 AC 24 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <map>
#include <cstdio>
using namespace std;
int main(){
	int N,x,i=0;scanf("%d",&N);
	map<int,int>m,s;
	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