結果

問題 No.2716 Falcon Method
ユーザー rerurenairerurenai
提出日時 2024-04-05 21:47:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,025 bytes
コンパイル時間 3,243 ms
コンパイル使用メモリ 229,596 KB
実行使用メモリ 10,388 KB
最終ジャッジ日時 2024-04-05 21:47:28
合計ジャッジ時間 7,204 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 8 ms
6,676 KB
testcase_07 AC 8 ms
6,676 KB
testcase_08 AC 9 ms
6,676 KB
testcase_09 AC 8 ms
6,676 KB
testcase_10 AC 7 ms
6,676 KB
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>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const vector<int> dx = {0,0,1,-1};
const vector<int> dy = {1,-1,0,0};
const ll INF = 1e18;
const ll MOD = 998244353;

int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    for(int i = 0; i < q; i++){
        int h,w,p;
        cin >> h >> w >> p;
        int x = 0, y = 0;
        while(x != h && y != w){
            if(x == h){
                y++;
            }else if(y == w){
                x++;
            }else{
                if(s[p] == 'D'){
                    x++;
                    p = (p+1)%n;
                }else{
                    y++;
                    p = (p+1)%n;
                }
            }
        }
        cout << p << endl;
    }
}
0