結果

問題 No.318 学学学学学
ユーザー oyas
提出日時 2015-12-11 15:45:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 72,024 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2024-06-22 15:29:28
合計ジャッジ時間 3,662 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <set>

using namespace std;

int main(){
	int n, a[100005];
	map<int, int> r;
	set<int, greater<int> > l;
		
	cin >> n;
	for(int i=0; i<n; i++){
		cin>>a[i];
		r[ a[i] ] = i;
	}

	for(int i=0; i<n; i++){
		l.insert(a[i]);
		while( i > r[ *l.begin() ] ) l.erase( l.begin() );
		cout << *l.begin() << " ";
	}
	cout << endl;

	return 0;
}
0