結果
| 問題 | No.318 学学学学学 |
| コンテスト | |
| ユーザー |
airis
|
| 提出日時 | 2015-12-12 21:25:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 2,000 ms |
| コード長 | 1,085 bytes |
| 記録 | |
| コンパイル時間 | 1,270 ms |
| コンパイル使用メモリ | 89,148 KB |
| 実行使用メモリ | 8,960 KB |
| 最終ジャッジ日時 | 2024-06-22 15:51:22 |
| 合計ジャッジ時間 | 4,328 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#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;
}
airis