結果

問題 No.3109 Swap members
ユーザー 沙耶花
提出日時 2025-04-18 20:02:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 4,697 ms
コンパイル使用メモリ 261,484 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2025-04-18 20:02:54
合計ジャッジ時間 11,898 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001LL

int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<vector<string>> s(K),t(K);
	rep(i,N){
		string a;
		cin>>a;
		s[i%K].push_back(a);
	}
	rep(i,N){
		string a;
		cin>>a;
		t[i%K].push_back(a);
	}
	rep(i,K){
		sort(s[i].begin(),s[i].end());
		sort(t[i].begin(),t[i].end());
		if(s[i]!=t[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}
0