結果
問題 | No.3109 Swap members |
ユーザー |
|
提出日時 | 2025-04-19 05:34:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 277 ms / 2,000 ms |
コード長 | 916 bytes |
コンパイル時間 | 2,492 ms |
コンパイル使用メモリ | 206,840 KB |
実行使用メモリ | 26,772 KB |
最終ジャッジ日時 | 2025-04-19 05:34:12 |
合計ジャッジ時間 | 10,233 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } #define int long long const int INF = (1LL << 60); //const int MOD = 1e9 + 7; vector<int> dx = { 0,1 }; vector<int> dy = { 1,0 }; signed main() { int n,k; cin >> n >> k; vector<string> s(n); vector<string> t(n); rep(i,n) cin >> s[i]; rep(i,n) cin >> t[i]; map<string,pair<int,int>> mp; rep(i,n) { mp[s[i]].first = i; mp[t[i]].second = i; } for(auto p : mp) { if(((p.second.first % k) - (p.second.second % k) + k) % k != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }