結果
問題 |
No.3109 Swap members
|
ユーザー |
![]() |
提出日時 | 2025-04-18 21:38:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 192 ms / 2,000 ms |
コード長 | 1,548 bytes |
コンパイル時間 | 1,552 ms |
コンパイル使用メモリ | 135,344 KB |
実行使用メモリ | 13,696 KB |
最終ジャッジ日時 | 2025-04-18 21:38:11 |
合計ジャッジ時間 | 7,372 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <iostream> #include <algorithm> #include <functional> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cstring> #include <chrono> #include <random> #include <bitset> #include <array> #include<utility> #include<stack> #include <iomanip> //#include<atcoder/all> //using namespace atcoder; using namespace std; #define P pair<int,int> #define Graph vector<vector<int>> #define float long double #define rep(i,a,b) for(int i=(a);i<(b);++i) #define repi(itr,m) for(auto itr=(m).begin();itr!=(m).end();itr++) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define vi vector<int> #define int long long const int INF=1e18; int dx[8]={0,1,0,-1,-1,-1,1,1}; int dy[8]={1,0,-1,0,-1,1,-1,1}; 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));} struct point{ int x,y; }; void yn(bool t){ if(t)cout<<"Yes"<<endl; else cout<<"No"<<endl; } int solve(){ int n,k;cin>>n>>k; map<string,int>m; rep(i,1,n+1){ string s;cin>>s;m[s]=i; } rep(i,1,n+1){ string s;cin>>s; int num=m[s]; if(abs(num-i)%k!=0){ cout<<"No"<<endl; return 0; } } cout<<"Yes"<<endl; assert(true); return 0; } signed main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); solve(); }