結果

問題 No.318 学学学学学
ユーザー cielciel
提出日時 2015-12-11 11:34:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 68,068 KB
実行使用メモリ 10,080 KB
最終ジャッジ日時 2023-09-04 17:25:29
合計ジャッジ時間 5,414 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,384 KB
testcase_01 AC 13 ms
4,384 KB
testcase_02 AC 16 ms
4,572 KB
testcase_03 AC 11 ms
4,380 KB
testcase_04 AC 14 ms
4,432 KB
testcase_05 AC 91 ms
10,080 KB
testcase_06 AC 100 ms
8,324 KB
testcase_07 AC 87 ms
7,284 KB
testcase_08 AC 75 ms
5,880 KB
testcase_09 AC 64 ms
4,796 KB
testcase_10 AC 48 ms
4,380 KB
testcase_11 AC 93 ms
10,032 KB
testcase_12 AC 73 ms
6,916 KB
testcase_13 AC 59 ms
5,824 KB
testcase_14 AC 48 ms
5,068 KB
testcase_15 AC 38 ms
4,532 KB
testcase_16 AC 28 ms
4,380 KB
testcase_17 AC 73 ms
9,296 KB
testcase_18 AC 57 ms
6,916 KB
testcase_19 AC 74 ms
9,344 KB
testcase_20 AC 25 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <map>
#include <set>
#include <cstdio>
using namespace std;
int main(){
	int N,x,i=0;scanf("%d",&N);
	map<int,pair<int,int>>m;
	vector<int>v(N),sa(N),sb(N);
	set<int>s;
	for(;i<N;i++){
		scanf("%d",&x);
		v[i]=x;
		if(m.find(x)==m.end())sa[i]++,m[x]={i,i},sb[i]++;
		else sb[m[x].second]--,m[x].second=i,sb[i]++;
	}
	for(i=0;i<N;i++){
		if(sa[i])s.insert(v[i]);
		printf(i<N-1?"%d ":"%d\n",*s.rbegin());
		if(sb[i])s.erase(v[i]);
	}
}
0