結果

問題 No.1026 OGAWA's New Keyboard
ユーザー otacky
提出日時 2020-04-15 22:39:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,200 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 91,900 KB
最終ジャッジ日時 2025-01-29 21:04:44
合計ジャッジ時間 1,631 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:5: error: ‘uint32_t’ was not declared in this scope
   23 |     uint32_t N;
      |     ^~~~~~~~
main.cpp:19:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
   18 | #include<utility>//pair
  +++ |+#include <cstdint>
   19 | #include<vector>//可変長配列
main.cpp:24:12: error: ‘N’ was not declared in this scope
   24 |     cin >> N;
      |            ^
main.cpp:25:13: error: expected ‘;’ before ‘fidx’
   25 |     uint32_t fidx = N;
      |             ^~~~~
      |             ;
main.cpp:26:13: error: expected ‘;’ before ‘bidx’
   26 |     uint32_t bidx = N;
      |             ^~~~~
      |             ;
main.cpp:27:5: error: ‘uint8_t’ was not declared in this scope
   27 |     uint8_t* arr = new uint8_t[N * 2 + 1];
      |     ^~~~~~~
main.cpp:27:5: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
main.cpp:27:14: error: ‘arr’ was not declared in this scope
   27 |     uint8_t* arr = new uint8_t[N * 2 + 1];
      |              ^~~
main.cpp:27:24: error: ‘uint8_t’ does not name a type
   27 |     uint8_t* arr = new uint8_t[N * 2 + 1];
      |                        ^~~~~~~
main.cpp:27:24: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
main.cpp:32:21: error: ‘bidx’ was not declared in this scope
   32 |         if(T) arr[--bidx] = S;
      |                     ^~~~
main.cpp:33:18: error: ‘fidx’ was not declared in this scope
   33 |         else arr[fidx++] = S;
      |                  ^~~~
main.cpp:36:31: error: ‘bidx’ was not declared in this scope
   36 |     string str = (char *)&arr[bidx];
      |                               ^~~~

ソースコード

diff #

#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;
int main(void){
    // Your code here!
    uint32_t N;
    cin >> N;
    uint32_t fidx = N;
    uint32_t bidx = N;
    uint8_t* arr = new uint8_t[N * 2 + 1];
    while(N--){
        int T;
        char S;
        cin >> T >> S;
        if(T) arr[--bidx] = S;
        else arr[fidx++] = S;
    }
    
    string str = (char *)&arr[bidx];
    cout << str << endl;
    return 0;
}
0