結果

問題 No.1133 キムワイプイーター
ユーザー kpinkcat
提出日時 2023-08-27 01:14:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 106,772 KB
最終ジャッジ日時 2025-02-16 14:56:57
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    int n, m, x = 0, y = 0, cnt = 0;
    string s;
    cin >> n >> m >> s;
    vector<vector<int>> v(n+1, vector<int>(n+1, 1));
    v[0][0] = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'R') x++;
        else if (s[i] == 'L') x--;
        else if (s[i] == 'U') y++;
        else y--;
        if (v[y][x]) v[y][x]--;
    }
    string delim = "";
    for (int i = n; i >= 0; i--){
        for (auto p : v[i]){
        cout << delim << p;
        delim = " ";
        cnt++;
        if (!(cnt % (n+1))){
            cout << endl;
            delim = "";
        }
        }
    }
}
0