結果

問題 No.3109 Swap members
ユーザー takoyaki782
提出日時 2025-07-17 18:17:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 1,001 bytes
コンパイル時間 3,714 ms
コンパイル使用メモリ 257,648 KB
実行使用メモリ 15,236 KB
最終ジャッジ日時 2025-07-17 18:17:59
合計ジャッジ時間 11,816 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll inf_ll = 9223372036854775807;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using mint = atcoder::modint998244353;
using mint1 = atcoder::modint1000000007;
using Pa = std::pair<ll, ll>;

int Yes(bool x){
    if(x) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

int main(){
    ll N, K;
    cin >> N >> K;
    vector<string> S(N), T(N);
    rep(i, N) cin >> S[i];
    rep(i, N) cin >> T[i];
    bool ans = true;
    rep(i, K){
        set<string> A, B;
        for(ll j = i; j < N; j += K){
            A.insert(S[j]);
            B.insert(T[j]);
        }
        if(A != B){
            ans = false;
            break;
        }
    }
    Yes(ans);
}
0