結果

問題 No.318 学学学学学
ユーザー airisairis
提出日時 2015-12-12 21:25:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 1,085 bytes
コンパイル時間 1,444 ms
コンパイル使用メモリ 82,916 KB
実行使用メモリ 9,080 KB
最終ジャッジ日時 2023-09-04 17:55:03
合計ジャッジ時間 5,717 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
4,384 KB
testcase_01 AC 19 ms
4,508 KB
testcase_02 AC 24 ms
4,412 KB
testcase_03 AC 16 ms
4,380 KB
testcase_04 AC 20 ms
4,384 KB
testcase_05 AC 136 ms
8,928 KB
testcase_06 AC 182 ms
8,780 KB
testcase_07 AC 168 ms
8,748 KB
testcase_08 AC 166 ms
8,928 KB
testcase_09 AC 153 ms
8,724 KB
testcase_10 AC 131 ms
8,800 KB
testcase_11 AC 132 ms
8,800 KB
testcase_12 AC 121 ms
8,772 KB
testcase_13 AC 115 ms
8,792 KB
testcase_14 AC 106 ms
8,928 KB
testcase_15 AC 97 ms
9,080 KB
testcase_16 AC 79 ms
8,924 KB
testcase_17 AC 81 ms
8,740 KB
testcase_18 AC 65 ms
8,732 KB
testcase_19 AC 84 ms
8,796 KB
testcase_20 AC 62 ms
8,728 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 1 ms
4,384 KB
testcase_26 AC 1 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#include <bitset>
#include <complex>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)
#define EPS (1e-14)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

int N;
int A[100005];
int b[100005];

set<int> S;
multiset<int> mS;

void solve() {
	rep(i, N) mS.insert(A[i]);
	rep(i, N) {
		S.insert(A[i]);
		b[i] = (*--S.end());
		// cout << (*--S.end()) << " hoge" << endl;
		mS.erase(mS.find(A[i]));
		if (mS.find(A[i]) == mS.end()) {
			S.erase(A[i]);
		}
	}
	rep(i, N) {
		cout << b[i] << " ";
	}
	cout << endl;
}

int main() {
	cin >> N;
	rep(i, N) cin >> A[i];
	solve();
	return 0;
}


0