結果

問題 No.3109 Swap members
ユーザー t98slider
提出日時 2025-04-19 14:03:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 2,509 ms
コンパイル使用メモリ 203,536 KB
実行使用メモリ 26,232 KB
最終ジャッジ日時 2025-04-19 14:03:58
合計ジャッジ時間 6,766 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<string> s(n), t(n);
    for(auto &&v : s) cin >> v;
    for(auto &&v : t) cin >> v;
    for(int i = n - k; i < k; i++){
        if(s[i] != t[i]){
            cout << "No\n";
            return 0;
        }
    }
    vector<string> s2(n), t2(n);
    for(int i = 0; i < n; i++){
        if(n - k <= i && i < k) continue;
        s2[i] = s[i];
        t2[i] = t[i];
    }
    sort(s2.begin(), s2.end());
    sort(t2.begin(), t2.end());
    cout << (s2 == t2 ? "Yes" : "No") << '\n';
}
0