結果
| 問題 |
No.2716 Falcon Method
|
| コンテスト | |
| ユーザー |
kokosei
|
| 提出日時 | 2024-04-05 22:01:08 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 820 ms |
| コンパイル使用メモリ | 85,172 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 02:16:55 |
| 合計ジャッジ時間 | 3,910 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 WA * 2 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int N, Q;
string S;
int X[202020], Y[202020];
int main(void){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> Q >> S;
for(int i = 0;i < N;i++){
X[i + 1] = X[i] + (S[i] == 'D');
Y[i + 1] = Y[i] + (S[i] == 'R');
}
while(Q--){
int h, w, p; cin >> h >> w >> p;
h += X[p], w += Y[p];
ll l = -1, r = 2e9;
while(r - l > 1){
ll m = (l + r) / 2;
bool f = false;
f |= m / N * X[N] + X[m % N] >= h;
f |= m / N * Y[N] + Y[m % N] >= w;
if(f)r = m;
else l = m;
}
cout << r % N << "\n";
}
return 0;
}
kokosei