結果
問題 | No.318 学学学学学 |
ユーザー | ciel |
提出日時 | 2015-12-11 07:07:00 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 464 ms |
コンパイル使用メモリ | 62,268 KB |
実行使用メモリ | 13,644 KB |
最終ジャッジ日時 | 2023-10-13 10:52:57 |
合計ジャッジ時間 | 4,975 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | TLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
ソースコード
#include <vector> #include <map> #include <cstdio> using namespace std; int main(){ int N; map<int,pair<int,int> >m; scanf("%d",&N); for(int i=0,x;i<N;i++){ scanf("%d",&x); if(m.find(x)==m.end())m[x]=make_pair(i,i); else m[x].second=i; } vector<int> v(N); auto it=m.rbegin(); int xstart=it->second.first,xend=it->second.second; for(int i=xstart;i<=xend;i++)v[i]=it->first; for(auto &e:m){ int start=e.second.first,end=e.second.second; for(int i=start;i<xstart;i++)v[i]=e.first; for(int i=xend+1;i<=end;i++)v[i]=e.first; } for(int i=0;i<N;i++)printf(i<N-1?"%d ":"%d\n",v[i]); }