結果

問題 No.318 学学学学学
ユーザー しらっ亭しらっ亭
提出日時 2015-12-17 03:44:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 155,828 KB
実行使用メモリ 8,628 KB
最終ジャッジ日時 2023-09-04 18:12:53
合計ジャッジ時間 5,244 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,376 KB
testcase_01 AC 14 ms
4,420 KB
testcase_02 AC 17 ms
4,660 KB
testcase_03 AC 11 ms
4,376 KB
testcase_04 AC 14 ms
4,504 KB
testcase_05 AC 104 ms
8,624 KB
testcase_06 AC 128 ms
7,688 KB
testcase_07 AC 105 ms
6,672 KB
testcase_08 AC 91 ms
5,756 KB
testcase_09 AC 74 ms
4,876 KB
testcase_10 AC 50 ms
4,376 KB
testcase_11 AC 103 ms
8,576 KB
testcase_12 AC 70 ms
6,488 KB
testcase_13 AC 58 ms
5,524 KB
testcase_14 AC 47 ms
4,996 KB
testcase_15 AC 37 ms
4,424 KB
testcase_16 AC 28 ms
4,380 KB
testcase_17 AC 63 ms
8,628 KB
testcase_18 AC 50 ms
6,284 KB
testcase_19 AC 67 ms
8,620 KB
testcase_20 AC 26 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define REP(i,n) for (int i = 0; i < (n); i++)
// -------------------------------------

typedef pair<int, int> PII;

int A[100001];

int main() {
  int N;
  cin >> N;

  map<int, int> m;
  REP(i, N) {
    int ai;
    scanf("%d", &ai);
    m[ai] = i;
    A[i] = ai;
  }

  set<int> s;
  REP(i, N) {
    if (i > 0) _P(" ");
    int ai = A[i];
    s.insert(ai);
    _P("%d", *s.rbegin());
    if (m[ai] == i) s.erase(ai);
  }
  _P("\n");

  return 0;
}
0