結果

問題 No.2732 Similar Permutations
ユーザー 矢澤式WINTER矢澤式WINTER
提出日時 2024-04-19 22:59:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,339 bytes
コンパイル時間 5,769 ms
コンパイル使用メモリ 336,364 KB
実行使用メモリ 14,848 KB
最終ジャッジ日時 2024-04-19 22:59:33
合計ジャッジ時間 23,156 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 48 ms
6,944 KB
testcase_13 AC 50 ms
6,940 KB
testcase_14 AC 46 ms
6,944 KB
testcase_15 AC 47 ms
6,944 KB
testcase_16 AC 34 ms
6,940 KB
testcase_17 AC 32 ms
6,940 KB
testcase_18 AC 43 ms
6,940 KB
testcase_19 AC 45 ms
6,940 KB
testcase_20 AC 45 ms
6,944 KB
testcase_21 AC 46 ms
6,940 KB
testcase_22 AC 27 ms
6,944 KB
testcase_23 AC 48 ms
6,940 KB
testcase_24 AC 29 ms
6,940 KB
testcase_25 AC 46 ms
6,940 KB
testcase_26 AC 42 ms
6,944 KB
testcase_27 AC 46 ms
6,940 KB
testcase_28 AC 36 ms
6,940 KB
testcase_29 AC 46 ms
6,940 KB
testcase_30 AC 33 ms
6,944 KB
testcase_31 AC 46 ms
6,940 KB
testcase_32 AC 44 ms
6,944 KB
testcase_33 AC 46 ms
6,940 KB
testcase_34 AC 32 ms
6,940 KB
testcase_35 AC 46 ms
6,944 KB
testcase_36 AC 49 ms
6,944 KB
testcase_37 AC 46 ms
6,940 KB
testcase_38 AC 40 ms
6,940 KB
testcase_39 AC 45 ms
6,940 KB
testcase_40 AC 38 ms
6,940 KB
testcase_41 AC 46 ms
6,940 KB
testcase_42 AC 35 ms
6,944 KB
testcase_43 AC 48 ms
6,944 KB
testcase_44 AC 26 ms
6,944 KB
testcase_45 AC 54 ms
6,940 KB
testcase_46 AC 43 ms
6,944 KB
testcase_47 AC 45 ms
6,944 KB
testcase_48 AC 28 ms
6,944 KB
testcase_49 AC 45 ms
6,940 KB
testcase_50 AC 29 ms
6,940 KB
testcase_51 AC 44 ms
6,940 KB
testcase_52 AC 38 ms
6,944 KB
testcase_53 AC 45 ms
6,940 KB
testcase_54 AC 47 ms
6,940 KB
testcase_55 AC 50 ms
6,944 KB
testcase_56 AC 47 ms
6,940 KB
testcase_57 AC 25 ms
6,944 KB
testcase_58 AC 34 ms
6,940 KB
testcase_59 AC 31 ms
6,940 KB
testcase_60 AC 27 ms
6,944 KB
testcase_61 AC 26 ms
6,940 KB
testcase_62 AC 41 ms
6,940 KB
testcase_63 AC 2 ms
6,944 KB
testcase_64 AC 2 ms
6,940 KB
testcase_65 AC 2 ms
6,940 KB
testcase_66 AC 1 ms
6,944 KB
testcase_67 AC 2 ms
6,940 KB
testcase_68 AC 2 ms
6,940 KB
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 WA -
testcase_93 WA -
testcase_94 WA -
testcase_95 WA -
testcase_96 WA -
testcase_97 WA -
testcase_98 WA -
testcase_99 WA -
testcase_100 WA -
testcase_101 WA -
testcase_102 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//*/
#include <atcoder/all>
using namespace atcoder;
//*/
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dbgv(x); for(auto now : x) cout << now << " "; cout << endl;
//using P = pair<int,int>;
using ll = long long;
using ull = unsigned long long;
//*/
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vint;
random_device rnd;
mt19937 rng(rnd());
using mint = modint998244353;

void solve(){
  int n; cin >> n;
  vint a(n); rep(i,n) cin >> a[i];
  vint p(n),q(n); rep(i,n) p[i] = i+1,q[i] = i+1;
  set<int> st;
  int tar = -1;
  rep(i,n){
    if(st.find(a[i]) == st.end()) st.insert(a[i]);
    else{
      tar = a[i];
      break;
    }
  }
  if(tar == -1){
    cout << -1 << endl;
    return;
  }
  int ii = -1,jj = -1;
  rep(i,n){
    if(a[i] == tar){
      if(ii == -1) ii = i;
      else if(jj == -1) jj = i;
    } 
  }
  swap(q[ii],q[jj]);
  dbgv(p);
  dbgv(q);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1; //cin >> t;
  rep(dirc,t) solve();
}
0