結果

問題 No.318 学学学学学
ユーザー ei1333333ei1333333
提出日時 2016-02-18 12:52:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 1,944 ms
コンパイル使用メモリ 157,888 KB
実行使用メモリ 10,312 KB
最終ジャッジ日時 2023-09-04 18:29:37
合計ジャッジ時間 5,160 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,376 KB
testcase_01 AC 14 ms
4,492 KB
testcase_02 AC 16 ms
4,816 KB
testcase_03 AC 11 ms
4,444 KB
testcase_04 AC 15 ms
4,596 KB
testcase_05 AC 105 ms
10,308 KB
testcase_06 AC 117 ms
9,116 KB
testcase_07 AC 108 ms
8,192 KB
testcase_08 AC 88 ms
7,276 KB
testcase_09 AC 72 ms
6,464 KB
testcase_10 AC 48 ms
5,688 KB
testcase_11 AC 101 ms
10,312 KB
testcase_12 AC 70 ms
8,004 KB
testcase_13 AC 56 ms
7,264 KB
testcase_14 AC 45 ms
6,592 KB
testcase_15 AC 36 ms
6,120 KB
testcase_16 AC 27 ms
5,692 KB
testcase_17 AC 61 ms
8,660 KB
testcase_18 AC 48 ms
7,264 KB
testcase_19 AC 61 ms
8,860 KB
testcase_20 AC 24 ms
4,860 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int N, A[100000];
  map< int, int > last;

  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    last[A[i]] = i;
  }
  stringstream sss;
  set< int > sets;
  for(int i = 0; i < N; i++) {
    if(i > 0) sss << " ";
    sets.insert(A[i]);
    sss << *sets.rbegin();
    if(last[A[i]] == i) sets.erase(A[i]);
  }
  printf("%s\n", sss.str().c_str());
}
0