結果

問題 No.318 学学学学学
ユーザー PulmnPulmn
提出日時 2018-07-18 19:21:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 1,270 bytes
コンパイル時間 2,519 ms
コンパイル使用メモリ 166,464 KB
実行使用メモリ 19,948 KB
最終ジャッジ日時 2023-09-04 21:08:21
合計ジャッジ時間 6,742 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
4,380 KB
testcase_01 AC 26 ms
5,924 KB
testcase_02 AC 32 ms
6,376 KB
testcase_03 AC 20 ms
5,488 KB
testcase_04 AC 29 ms
6,176 KB
testcase_05 AC 216 ms
19,840 KB
testcase_06 AC 191 ms
15,728 KB
testcase_07 AC 157 ms
13,008 KB
testcase_08 AC 127 ms
10,612 KB
testcase_09 AC 97 ms
8,768 KB
testcase_10 AC 67 ms
6,756 KB
testcase_11 AC 208 ms
19,948 KB
testcase_12 AC 144 ms
14,708 KB
testcase_13 AC 119 ms
11,764 KB
testcase_14 AC 96 ms
9,984 KB
testcase_15 AC 78 ms
8,316 KB
testcase_16 AC 58 ms
6,820 KB
testcase_17 AC 108 ms
17,028 KB
testcase_18 AC 89 ms
14,556 KB
testcase_19 AC 110 ms
16,908 KB
testcase_20 AC 44 ms
6,968 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ull mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	map<int,int> m;
	vi M;
	int N=0;
	for(int i=0;i<n;i++) cin>>a[i];
	vi a_=a;
	sort(a_.rbegin(),a_.rend());
	for(int i=0;i<n;i++){
		if(m.find(a_[i])==m.end()){
			m[a_[i]]=N++;
			M.push_back(a_[i]);
		}
	}
	vvi b(N);
	vvi c(n);
	for(int i=0;i<n;i++) b[m[a[i]]].push_back(i);
	for(int i=0;i<N;i++){
		c[b[i][0]].push_back(i);
		c[b[i].back()].push_back(i);
	}
	set<int> st;
	for(int i=0;i<n;i++){
		bool B=1;
		for(auto j:c[i]) if(j>-1) B=st.insert(j).second;
		if(i) cout<<' ';
		cout<<M[*st.begin()];
		if(!B) st.erase(c[i][0]);
	}
	cout<<endl;
}
0