結果

問題 No.2716 Falcon Method
ユーザー mintmint
提出日時 2024-04-06 11:44:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 2,399 ms
コンパイル使用メモリ 201,144 KB
実行使用メモリ 13,480 KB
最終ジャッジ日時 2024-04-06 11:44:43
合計ジャッジ時間 6,481 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,480 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q; cin >> n >> q;
    string s; cin >> s;
    for(int i = 0; i < q; i++){
        int h, w, p, x = 0, y = 0, c; cin >> h >> w >> p;
        c = p;
        for(int j = 0; j < (int)s.size(); j++){
            if(x == h && y == w) break;
            if(x == h && y != w) y++;
            else if(x != h && y == w) x++;
            else {
                if(s[j] == 'D'){
                    x++;
                    c++;
                    c %= n;
                }else if(s[j] == 'R'){
                    y++;
                    c++;
                    c %= n;
                }
            }
        }
        cout << c << '\n';
    }

    return 0;
}
0