結果

問題 No.3317 ワロングアンサーロングアンサーンスワロンガー
コンテスト
ユーザー tau1235
提出日時 2025-10-31 23:06:16
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 752 bytes
コンパイル時間 2,803 ms
コンパイル使用メモリ 279,600 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-31 23:06:49
合計ジャッジ時間 32,726 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 55 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  using ll=long long;
  int n,q;
  string s;
  cin>>n>>q>>s;
  int top=-1;
  for (int i=0;i<n;i++){
    if (s[i]=='w'||s[i]=='a'){
      top=i;
      break;
    }
  }
  while (q--){
    ll t,x;
    cin>>t>>x;
    if (x<=top){
      cout<<s[x-1];
      continue;
    }
    t=min(60LL,t);
    string now=s;
    while (t){
      for (char c:now){
        ll len=1;
        if (c=='w'||c=='a') len=(1LL<<t)+(1LL<<(t+2))-4;
        if (x>len) x-=len;
        else{
          string next;
          next+=c;
          if (c=='w') next="warong";
          if (c=='a') next="answer";
          swap(now,next);
          break;
        }
      }
      t--;
    }
    cout<<now[x-1];
  }
  cout<<endl;
}
0