結果

問題 No.2254 Reverse Only
ユーザー umezoumezo
提出日時 2023-03-24 23:21:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 2,664 ms
コンパイル使用メモリ 207,532 KB
実行使用メモリ 23,520 KB
最終ジャッジ日時 2023-10-18 21:35:40
合計ジャッジ時間 10,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 156 ms
23,520 KB
testcase_11 WA -
testcase_12 AC 274 ms
23,520 KB
testcase_13 AC 257 ms
23,520 KB
testcase_14 AC 249 ms
23,520 KB
testcase_15 AC 259 ms
23,520 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 248 ms
23,520 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 5 ms
4,348 KB
testcase_28 WA -
testcase_29 AC 92 ms
12,696 KB
testcase_30 WA -
testcase_31 AC 37 ms
7,944 KB
testcase_32 AC 49 ms
8,480 KB
testcase_33 AC 20 ms
6,048 KB
testcase_34 AC 129 ms
15,336 KB
testcase_35 AC 66 ms
11,172 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 28 ms
6,976 KB
testcase_39 WA -
testcase_40 AC 5 ms
4,348 KB
testcase_41 AC 62 ms
10,320 KB
testcase_42 AC 30 ms
7,280 KB
testcase_43 AC 126 ms
16,128 KB
testcase_44 AC 230 ms
22,200 KB
testcase_45 WA -
testcase_46 AC 5 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0