結果
問題 |
No.2716 Falcon Method
|
ユーザー |
|
提出日時 | 2024-04-05 21:47:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,025 bytes |
コンパイル時間 | 4,182 ms |
コンパイル使用メモリ | 229,684 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-10-01 02:02:28 |
合計ジャッジ時間 | 7,723 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 TLE * 1 -- * 17 |
ソースコード
#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; } }