結果

問題 No.318 学学学学学
ユーザー kurenai3110
提出日時 2016-09-02 00:14:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 75,148 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-11-15 17:07:06
合計ジャッジ時間 3,956 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 8 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

void repeat() {

}

int main()
{
	int n;
	cin >> n;
	n++;
	vector<int> a(n);
	map<int, pair<int, int> > range;

	for (int i = 1; i < n; i++) {
		cin >> a[i];
		if (range[a[i]].first) range[a[i]] = make_pair(range[a[i]].first,i);
		else {
			range[a[i]] = make_pair(i, i);
		}
	}

	for (int i = 1; i < n;) {
		int j;
		for (j = i; j<n && j <= range[a[i]].second; j++) {
			if (a[j] > a[i])	break;
			else {
				if (i-1) cout << " ";
				cout << a[i];
			}
		}
		i = j;
	}

	cout << endl;

    return 0;
}
0