結果
| 問題 | No.2716 Falcon Method |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-05 21:49:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,029 bytes |
| 記録 | |
| コンパイル時間 | 3,460 ms |
| コンパイル使用メモリ | 228,716 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-01 02:05:28 |
| 合計ジャッジ時間 | 7,520 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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){
break;
}else if(y == w){
break;
}else{
if(s[p] == 'D'){
x++;
p = (p+1)%n;
}else{
y++;
p = (p+1)%n;
}
}
}
cout << p << endl;
}
}