結果

問題 No.1026 OGAWA's New Keyboard
ユーザー tnakao0123
提出日時 2020-04-18 23:35:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 841 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 92,864 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-16 05:03:55
合計ジャッジ時間 1,631 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1026.cc:  No.1026 OGAWA's New Keyboard - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

char s[MAX_N * 2 + 4];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int hp = MAX_N, tp = MAX_N;
  while (n--) {
    int t;
    char w[4];
    scanf("%d%s", &t, w);

    if (t == 0) s[tp++] = w[0];
    else s[--hp] = w[0];
  }

  for (int i = hp; i < tp; i++) putchar(s[i]);
  putchar('\n');
  return 0;
}
0