結果
問題 |
No.3109 Swap members
|
ユーザー |
|
提出日時 | 2025-04-18 21:29:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 120 ms / 2,000 ms |
コード長 | 774 bytes |
コンパイル時間 | 2,489 ms |
コンパイル使用メモリ | 211,876 KB |
実行使用メモリ | 32,000 KB |
最終ジャッジ日時 | 2025-04-18 21:29:30 |
合計ジャッジ時間 | 6,726 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef pair<int, pair<int, int> > piii; typedef long long ll; const int N = 2000086, MOD = 1e9 + 7, INF = 0x3f3f3f3f; ll res; int n, m, cnt, w[N]; int main() { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> m; map<int, vector<string> > ma, mb; string s; for (int i = 1; i < n + 1; i++) cin >> s, ma[i % m].push_back(s); for (int i = 1; i < n + 1; i++) cin >> s, mb[i % m].push_back(s); for (auto& u : ma) sort(u.second.begin(), u.second.end()); for (auto& u : mb) sort(u.second.begin(), u.second.end()); for (auto& u : ma) { if (mb[u.first] != u.second) { puts("No"); return 0; } } puts("Yes"); return 0; }