結果

問題 No.2716 Falcon Method
ユーザー Nzt3Nzt3
提出日時 2024-04-05 22:16:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 893 bytes
コンパイル時間 2,889 ms
コンパイル使用メモリ 204,600 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-05 22:16:15
合計ジャッジ時間 4,938 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 WA -
testcase_08 AC 3 ms
6,676 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 37 ms
6,676 KB
testcase_12 AC 55 ms
6,676 KB
testcase_13 WA -
testcase_14 AC 65 ms
6,676 KB
testcase_15 AC 46 ms
6,676 KB
testcase_16 AC 57 ms
6,676 KB
testcase_17 AC 65 ms
6,676 KB
testcase_18 WA -
testcase_19 AC 56 ms
6,676 KB
testcase_20 WA -
testcase_21 AC 31 ms
6,676 KB
testcase_22 AC 41 ms
6,676 KB
testcase_23 AC 80 ms
6,676 KB
testcase_24 AC 41 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 AC 78 ms
6,676 KB
testcase_28 AC 77 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,Q;
  cin>>N>>Q;
  string S;
  cin>>S;
  vector R(N+1,0),D(N+1,0);
  for(int i=0;i<N;i++){
    R[i+1]=R[i];
    D[i+1]=D[i];
    if(S[i]=='R'){
      R[i+1]+=1;
    }else{
      D[i+1]+=1;
    }
  }
  if(D[N]==0){
    while(Q--){
      ll H,W,P;
      cin>>H>>W>>P;
      cout<<(W+P)%N<<'\n';
    }
  }else if(R[N]==0){
    while(Q--){
      ll H,W,P;
      cin>>H>>W>>P;
      cout<<(H+P)%N<<'\n';
    }
  }else{
    while(Q--){
      ll H,W,P;
      cin>>H>>W>>P;
      H+=D[P];
      W+=R[P];
      ll cntH=H/D[N]*N+ll(lower_bound(D.begin(),D.end(),H%D[N])-D.begin());
      ll cntW=W/R[N]*N+ll(lower_bound(R.begin(),R.end(),W%R[N])-R.begin());
      if(cntH<cntW){
        cout<<cntH%N<<'\n';
      }else{
        cout<<cntW%N<<'\n';
      }
    }
  }
}
0