結果

問題 No.318 学学学学学
ユーザー cielciel
提出日時 2015-12-11 11:36:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 67,700 KB
実行使用メモリ 10,052 KB
最終ジャッジ日時 2023-09-04 17:26:49
合計ジャッジ時間 3,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,380 KB
testcase_01 AC 13 ms
4,392 KB
testcase_02 AC 16 ms
4,568 KB
testcase_03 AC 10 ms
4,384 KB
testcase_04 AC 14 ms
4,436 KB
testcase_05 AC 91 ms
10,048 KB
testcase_06 AC 101 ms
8,240 KB
testcase_07 AC 90 ms
7,252 KB
testcase_08 AC 79 ms
5,960 KB
testcase_09 AC 64 ms
4,860 KB
testcase_10 AC 47 ms
4,380 KB
testcase_11 AC 84 ms
10,052 KB
testcase_12 AC 71 ms
6,916 KB
testcase_13 AC 60 ms
5,876 KB
testcase_14 AC 48 ms
5,012 KB
testcase_15 AC 38 ms
4,500 KB
testcase_16 AC 28 ms
4,380 KB
testcase_17 AC 73 ms
9,360 KB
testcase_18 AC 56 ms
6,916 KB
testcase_19 AC 73 ms
9,352 KB
testcase_20 AC 24 ms
4,384 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,384 KB
testcase_25 AC 1 ms
4,384 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,384 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,pair<int,int>>m;
	vector<int>v(N),sa(N),sb(N);
	map<int,int>s;
	for(;i<N;i++){
		scanf("%d",&x);
		v[i]=x;
		if(m.find(x)==m.end())sa[i]++,m[x]={i,i},sb[i]++;
		else sb[m[x].second]--,m[x].second=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