結果

問題 No.318 学学学学学
ユーザー uenokuuenoku
提出日時 2016-09-05 23:19:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 1,903 ms
コンパイル使用メモリ 94,812 KB
実行使用メモリ 8,788 KB
最終ジャッジ日時 2023-09-04 20:24:57
合計ジャッジ時間 5,872 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,380 KB
testcase_01 AC 18 ms
4,384 KB
testcase_02 AC 21 ms
4,404 KB
testcase_03 AC 15 ms
4,384 KB
testcase_04 AC 19 ms
4,384 KB
testcase_05 AC 145 ms
8,564 KB
testcase_06 AC 151 ms
7,180 KB
testcase_07 AC 135 ms
6,564 KB
testcase_08 AC 116 ms
5,560 KB
testcase_09 AC 96 ms
4,716 KB
testcase_10 AC 72 ms
4,384 KB
testcase_11 AC 149 ms
8,788 KB
testcase_12 AC 95 ms
6,008 KB
testcase_13 AC 80 ms
5,396 KB
testcase_14 AC 68 ms
4,772 KB
testcase_15 AC 59 ms
4,384 KB
testcase_16 AC 49 ms
4,380 KB
testcase_17 AC 80 ms
8,456 KB
testcase_18 AC 66 ms
6,344 KB
testcase_19 AC 81 ms
8,736 KB
testcase_20 AC 34 ms
4,384 KB
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,384 KB
testcase_28 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
#include "math.h"
#include <complex>
#include <iomanip>
#include <map>
#include <set>
#define ifor(i,a,b) for (int i=(a);i<(b);i++)
#define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
using namespace std;
typedef long double ld;
typedef long long int  lli;
typedef complex <double> P;
const double eps = 1e-11;
int vex[4]={1,0,-1,0};
int vey[4]={0,1,0,-1};
typedef vector<double> Vec;
typedef vector<int> vec;
typedef vector<Vec> MAT;
typedef vector<vec> mat;
lli MOD=1000000007;
int main(){
  int n;
  cin >> n;
  int a[1000004];
  map<int,int> tr;
  rep(i,n){cin>>a[i];tr[a[i]]=i;}
  set<int> d;
  rep(i,n){
    d.insert(a[i]);
    cout<<*d.rbegin();//2分探索木の一番
    if(i==tr[a[i]])d.erase(a[i]);
    printf("%c",(i==n-1)?'\n':' ');
  }
}
0