結果

問題 No.2240 WAC
ユーザー umezo
提出日時 2023-03-10 22:26:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 731 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 199,364 KB
最終ジャッジ日時 2025-02-11 08:39:09
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 11 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n,m;
  string s;
  cin>>n>>m>>s;
  priority_queue<int> qa,qc;
  priority_queue<int, vector<int>, greater<int> > qw;
  rep(i,n+m){
    if(s[i]=='W') qw.push(i);
    else if(s[i]=='A') qa.push(i);
    else qc.push(i);
  }
  while(qw.size()){
    if(qa.top()<qw.top()){
      cout<<"No"<<endl;
      return 0;
    }
    qa.pop();
    qw.pop();
  }
  while(qc.size()){
    if(qa.top()>qc.top()){
      cout<<"No"<<endl;
      return 0;
    }
    qa.pop();
    qc.pop();
  }
  cout<<"Yes"<<endl;
  
  return 0;
}
0