結果

問題 No.318 学学学学学
ユーザー oyasoyas
提出日時 2015-12-11 15:45:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 72,228 KB
実行使用メモリ 10,196 KB
最終ジャッジ日時 2023-09-04 17:29:00
合計ジャッジ時間 4,368 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
4,388 KB
testcase_01 AC 20 ms
4,384 KB
testcase_02 AC 26 ms
4,512 KB
testcase_03 AC 16 ms
4,380 KB
testcase_04 AC 21 ms
4,420 KB
testcase_05 AC 151 ms
10,088 KB
testcase_06 AC 112 ms
8,472 KB
testcase_07 AC 103 ms
7,060 KB
testcase_08 AC 94 ms
5,612 KB
testcase_09 AC 83 ms
4,760 KB
testcase_10 AC 66 ms
4,380 KB
testcase_11 AC 144 ms
10,196 KB
testcase_12 AC 101 ms
6,348 KB
testcase_13 AC 85 ms
5,296 KB
testcase_14 AC 73 ms
4,664 KB
testcase_15 AC 63 ms
4,380 KB
testcase_16 AC 51 ms
4,380 KB
testcase_17 AC 82 ms
8,532 KB
testcase_18 AC 75 ms
7,416 KB
testcase_19 AC 71 ms
8,424 KB
testcase_20 AC 36 ms
4,384 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,384 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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