結果

問題 No.1133 キムワイプイーター
ユーザー ooooobaoooooba
提出日時 2021-06-14 21:32:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 1,025 ms
コンパイル使用メモリ 119,644 KB
最終ジャッジ日時 2025-01-22 08:15:17
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t n, m;
    string s;
    cin >> n >> m >> s;
    vector<vector<bool>> mat(n + 1, vector<bool>(n + 1));
    int32_t x = 0, y = 0;
    mat[0][0] = true;
    for (auto c : s) {
        if (c == 'U')
            ++y;
        else if (c == 'R')
            ++x;
        else if (c == 'L')
            --x;
        else
            --y;
        mat[x][y] = true;
    }
    for (auto yi = n; yi >= 0; --yi) {
        for (auto xi = 0; xi <= n; ++xi) {
            cout << !mat[xi][yi] << (xi == n ? '\n' : ' ');
        }
    }
    return 0;
}
0