結果

問題 No.3109 Swap members
ユーザー umezo
提出日時 2025-04-19 00:03:13
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 3,653 ms
コンパイル使用メモリ 290,180 KB
実行使用メモリ 32,888 KB
最終ジャッジ日時 2025-04-19 00:03:23
合計ジャッジ時間 7,450 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

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;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;//B(n,V<int>(n))

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n,k;
  cin>>n>>k;
  V<string> S(n),T(n);
  rep(i,n) cin>>S[i];
  rep(i,n) cin>>T[i];
  
  VV<string> A(k),B(k);
  rep(i,n){
    A[i%k].push_back(S[i]);
    B[i%k].push_back(T[i]);
  }
  rep(i,k) sort(ALL(A[i])),sort(ALL(B[i]));
  rep(i,k){
    if(A[i]!=B[i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
 
  return 0;
}
0