結果
| 問題 |
No.318 学学学学学
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-09-02 00:39:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 625 bytes |
| コンパイル時間 | 959 ms |
| コンパイル使用メモリ | 75,984 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-11-15 17:07:31 |
| 合計ジャッジ時間 | 3,955 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 12 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int n,j;
vector<int> a;
map<int, pair<int, int> > range;
void repeat(int i) {
for (j = i; j < n && j <= range[a[i]].second; j++) {
if (a[j] > a[i]) {
repeat(j);
}
else {
if (j - 1) cout << " ";
cout << a[i];
}
}
j--;
}
int main()
{
cin >> n;
n++;
a.resize(n);
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 (j = 1; j < n; j++) {
repeat(j);
}
cout << endl;
return 0;
}
kurenai3110