結果
| 問題 | 
                            No.1026 OGAWA's New Keyboard
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-08-15 13:50:53 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 23 ms / 1,000 ms | 
| コード長 | 381 bytes | 
| コンパイル時間 | 354 ms | 
| コンパイル使用メモリ | 40,832 KB | 
| 最終ジャッジ日時 | 2025-01-23 22:26:18 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 21 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d %c",&T,&S);
      |         ~~~~~^~~~~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <algorithm>
int main(){
    int N,T,p=0;
    char ans0[200000+1],ans1[200000+1],S; 
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d %c",&T,&S);
        if(T==0){
            ans0[p++]=S;
        }else ans1[i-p]=S;
    }
    ans0[p]='\0';
    ans1[N-p]='\0';
    std::reverse(ans1,ans1+N-p);
    printf("%s%s\n",ans1,ans0);
    return 0;
}