結果
問題 |
No.2254 Reverse Only
|
ユーザー |
![]() |
提出日時 | 2023-03-24 23:21:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 816 bytes |
コンパイル時間 | 2,013 ms |
コンパイル使用メモリ | 199,628 KB |
最終ジャッジ日時 | 2025-02-11 17:44:27 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 20 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,k; cin>>n>>k; vector<int> A(n),B(n); multiset<int> c,d; bool b=true; rep(i,n){ cin>>A[i]; c.insert(A[i]); } rep(i,n){ cin>>B[i]; if(B[i]!=A[i]) b=false; d.insert(B[i]); } if(b){ cout<<"Yes"<<endl; return 0; } if(k>n || c!=d){ cout<<"No"<<endl; return 0; } if(k==n){ reverse(ALL(B)); b=true; rep(i,n){ if(A[i]!=B[i]) b=false; if(b) cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0; } } if(k<n-1){ cout<<1<<endl; return 0; } cout<<1<<endl; return 0; }