結果
| 問題 | 
                            No.1133 キムワイプイーター
                             | 
                    
| ユーザー | 
                             CELICA
                         | 
                    
| 提出日時 | 2020-07-29 19:56:41 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 14 ms / 2,000 ms | 
| コード長 | 933 bytes | 
| コンパイル時間 | 1,577 ms | 
| コンパイル使用メモリ | 167,616 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-30 01:39:29 | 
| 合計ジャッジ時間 | 3,386 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 31 | 
ソースコード
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    string s;
    cin >> n >> m >> s;
    ++n;
    int x{ 0 }, y{ 0 };
    int res[n][n];
    for (int i = 0; i < n; ++i)
        fill(res[i], res[i]+n, 1);
    res[0][0] = 0;
    for (const auto& ss : s)
    {
        if (ss == 'U')
        {
            y += 1;
            res[y][x] = 0;
        }
        else if (ss == 'D')
        {
            y -= 1;
            res[y][x] = 0;
        }
        else if (ss == 'R')
        {
            x += 1;
            res[y][x] = 0;
        }
        else if (ss == 'L')
        {
            x -= 1;
            res[y][x] = 0;
        }
    }
    for (int i = n - 1; i >= 0; --i)
    {
        for (int j = 0; j < n - 1; ++j)
            cout << res[i][j] << " ";
        cout << res[i][n - 1] << "\n";
    }
    return 0;
}
            
            
            
        
            
CELICA