結果

問題 No.2716 Falcon Method
ユーザー tobbietobbie
提出日時 2024-04-18 20:49:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 605 bytes
コンパイル時間 1,865 ms
コンパイル使用メモリ 162,780 KB
実行使用メモリ 10,656 KB
最終ジャッジ日時 2024-04-18 20:49:08
合計ジャッジ時間 7,516 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,528 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 9 ms
6,940 KB
testcase_07 AC 11 ms
6,944 KB
testcase_08 AC 11 ms
6,940 KB
testcase_09 AC 10 ms
6,940 KB
testcase_10 AC 9 ms
6,944 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>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, j, n) for (int i = j; i < (int)n; i++)

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  rep(j, Q) {
    int H, W, P;
    cin >> H >> W >> P;
    int x = 0, y = 0;
    int i = P;
    while (1) {
      if (x == H && y == W) {
	cout << i << endl; break;
      } else if (x == H) {
	y += 1;
      } else if (y == W) {
	x += 1;
      } else if (S[i] == 'D') {
	x += 1; i = (i + 1) % N;
      } else if (S[i] == 'R') {
	y += 1; i = (i + 1) % N;
      }
    }
  }
  return 0;
}
0