結果
問題 |
No.3109 Swap members
|
ユーザー |
|
提出日時 | 2025-05-05 13:29:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 3,885 ms |
コンパイル使用メモリ | 290,984 KB |
実行使用メモリ | 21,504 KB |
最終ジャッジ日時 | 2025-05-05 13:29:19 |
合計ジャッジ時間 | 11,541 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; void solve(){ ll N,K; cin>>N>>K; vector<vector<string>> S(K),T(K); for(int i=0;i<N;i++){ string s; cin>>s; S[i%K].push_back(s); } for(int i=0;i<N;i++){ string s; cin>>s; T[i%K].push_back(s); } for(int i=0;i<K;i++){ sort(S[i].begin(),S[i].end()); sort(T[i].begin(),T[i].end()); if(S[i]!=T[i]){ cout<<"No"<<endl; return; } } cout<<"Yes"<<endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll T=1; // cin>>T; while(T--) solve(); }