結果
問題 |
No.318 学学学学学
|
ユーザー |
|
提出日時 | 2020-07-27 08:22:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 126 ms / 2,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 1,681 ms |
コンパイル使用メモリ | 182,704 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-06-28 19:57:20 |
合計ジャッジ時間 | 5,658 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; map<ll, ll> last; int main() { int n; cin >> n; vector<ll> a(n,0); vector<pll> qr; for(int i=0; i<n; i++) { cin >> a[i]; last[a[i]]=i; } set <ll> s; for(int i=0; i<n; i++) { s.insert(a[i]); printf("%lld ", *s.rbegin()); if(last[a[i]]==i) s.erase(a[i]); } printf("\n"); return 0; }