結果
| 問題 | No.318 学学学学学 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-11 01:05:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 658 bytes |
| 記録 | |
| コンパイル時間 | 687 ms |
| コンパイル使用メモリ | 67,616 KB |
| 実行使用メモリ | 15,520 KB |
| 最終ジャッジ日時 | 2024-09-15 07:47:31 |
| 合計ジャッジ時間 | 5,329 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 5 TLE * 1 -- * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
int n, input, start, end;
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);
}
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;
}
}
for(int j=n-1; j>=0; --j){
if(a[j]==*it){
end=j;
break;
}
}
for(;start<=end; ++start) b[start]=*it;
}
for(int i=0; i<n; ++i){
cout << b[i] << ' ';
}
cout << "\n";
return 0;
}