結果

問題 No.3109 Swap members
ユーザー lk step
提出日時 2025-04-18 20:39:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 2,359 ms
コンパイル使用メモリ 204,996 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2025-04-18 20:39:53
合計ジャッジ時間 7,250 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int N,K;
  string S[100000];
  string T[100000];
  cin>>N>>K;
  for(int i=0;i<N;i++)cin>>S[i];
  for(int i=0;i<N;i++)cin>>T[i];
  
  for(int i=0;i<K;i++){
    vector<string> A,B;
    for(int j=i;j<N;j+=K){
      A.push_back(S[j]);
      B.push_back(T[j]);
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    if(A!=B){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

0