結果

問題 No.3798 algo to goal
ユーザー yuunegi
提出日時 2026-11-13 23:06:37
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 990 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,472 ms
コンパイル使用メモリ 339,852 KB
実行使用メモリ 9,916 KB
最終ジャッジ日時 2026-11-13 23:07:02
合計ジャッジ時間 10,577 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int q;
    cin>>q;
    while(q--){
        vector<int>vs1(26,0),vs2(26,0),vt1(26,0),vt2(26,0);
        string s,t;
        cin>>s>>t;
        long long rs1=0,rs2=0,rt1=0,rt2=0;
        for(int i=0;i<s.size();i+=2){
            int tmp=s[i]-'a';
            for(int j=tmp+1;j<26;j++){
                rs1+=vs1[j];
            }
            vs1[tmp]++;
            tmp=t[i]-'a';
            for(int j=tmp+1;j<26;j++){
                rt1+=vt1[j];
            }
            vt1[tmp]++;
        }
        for(int i=1;i<s.size();i+=2){
            int tmp=s[i]-'a';
            for(int j=tmp+1;j<26;j++){
                rs2+=vs2[j];
            }
            vs2[tmp]++;
            tmp=t[i]-'a';
            for(int j=tmp+1;j<26;j++){
                rt2+=vt2[j];
            }
            vt2[tmp]++;
        }
        cout<<(vs1==vt1&&vs2==vt2&&((rs1%2)==(rs2%2))==((rt1%2)==(rt2%2))?"Yes":"No")<<endl;
    }
    return 0;
}
0