結果
問題 | No.318 学学学学学 |
ユーザー |
![]() |
提出日時 | 2016-05-07 10:27:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 1,083 bytes |
コンパイル時間 | 2,876 ms |
コンパイル使用メモリ | 173,368 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2024-06-22 17:42:31 |
合計ジャッジ時間 | 5,628 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; class GakuX5 { public: void solve(void) { int n; cin>>n; // // bi が t に置き換えられるのは bi の左右に t が存在するときなので // bi = max{t| l<=i<=r && t == a[l] == a[r]} // vector<ll> a(n); map<ll,int> m; REP(i,n) { cin>>a[i]; m[a[i]] = i; } set<ll> s; REP(i,n) { s.insert(a[i]); cout<<*s.rbegin(); // 最大のものを出力 if (i == m[a[i]]) s.erase(a[i]); if (i != n-1) cout<<" "; } cout<<endl; } }; #if 1 int main(int argc, char *argv[]) { ios::sync_with_stdio(false); auto obj = new GakuX5(); obj->solve(); delete obj; return 0; } #endif