結果

問題 No.318 学学学学学
ユーザー E31415926E31415926
提出日時 2017-02-21 20:59:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 1,795 ms
コンパイル使用メモリ 176,936 KB
実行使用メモリ 11,268 KB
最終ジャッジ日時 2023-09-04 20:39:59
合計ジャッジ時間 5,774 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 18 ms
4,732 KB
testcase_02 AC 22 ms
5,024 KB
testcase_03 AC 15 ms
4,416 KB
testcase_04 AC 20 ms
5,004 KB
testcase_05 AC 136 ms
11,204 KB
testcase_06 AC 140 ms
9,184 KB
testcase_07 AC 127 ms
8,152 KB
testcase_08 AC 111 ms
7,020 KB
testcase_09 AC 95 ms
6,120 KB
testcase_10 AC 72 ms
5,064 KB
testcase_11 AC 129 ms
11,268 KB
testcase_12 AC 98 ms
8,024 KB
testcase_13 AC 82 ms
7,024 KB
testcase_14 AC 72 ms
6,264 KB
testcase_15 AC 63 ms
5,592 KB
testcase_16 AC 54 ms
4,980 KB
testcase_17 AC 90 ms
10,500 KB
testcase_18 AC 75 ms
8,048 KB
testcase_19 AC 88 ms
10,432 KB
testcase_20 AC 39 ms
5,104 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
typedef pair<int, int> pii;
#define FI first
#define SE second
#define all(s) s.begin(),s.end()
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)

int N;
int A[100100];
int B[100100];
map<int, int> last;

signed main() {
	cin >> N;
	rep(i,N)
	{
		cin >> A[i];
		last[A[i]] = i;
	}
	set<int> S;
	rep(i,N)
	{
		S.insert(A[i]);
		B[i] = *S.rbegin();
		if (last[A[i]] == i)
			S.erase(A[i]);
	}
	rep(i,N)
	{
		cout << (i ? " " : "") << B[i];
	}
	cout << endl;
}
0