結果
問題 |
No.318 学学学学学
|
ユーザー |
|
提出日時 | 2015-12-11 00:37:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 790 bytes |
コンパイル時間 | 920 ms |
コンパイル使用メモリ | 67,376 KB |
実行使用メモリ | 14,080 KB |
最終ジャッジ日時 | 2024-09-15 07:46:22 |
合計ジャッジ時間 | 6,208 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 5 TLE * 1 -- * 20 |
ソースコード
#include <iostream> #include <vector> #include <set> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n, input, start, end, num_kind; cin >> n; vector<int> a(n); vector<int> b(n,0); set<int> num; for(int i=0; i<n; ++i){ cin >> input; a[i] = input; num.insert(input); } num_kind=num.size(); for(set<int>::iterator it=num.begin(); it!=num.end(); ++it){ start=-1; end=-1; for(int j=0; j<n; ++j){ if(a[j]==*it){ start=j; break; } } if(start==-1) continue; for(int j=n-1; j>=0; --j){ if(a[j]==*it){ end=j; break; } } if(end==-1) continue; for(;start<=end; ++start) b[start]=*it; } for(int i=0; i<n; ++i){ cout << b[i] << ' '; } cout << "\n"; return 0; }