結果
問題 | No.2732 Similar Permutations |
ユーザー | kureha |
提出日時 | 2024-04-19 22:44:01 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,113 bytes |
コンパイル時間 | 2,237 ms |
コンパイル使用メモリ | 208,280 KB |
実行使用メモリ | 24,072 KB |
最終ジャッジ日時 | 2024-10-11 16:32:40 |
合計ジャッジ時間 | 33,205 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 12 ms
14,848 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
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 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 11 ms
14,976 KB |
testcase_64 | AC | 11 ms
14,976 KB |
testcase_65 | AC | 12 ms
14,848 KB |
testcase_66 | AC | 11 ms
14,848 KB |
testcase_67 | AC | 11 ms
14,976 KB |
testcase_68 | AC | 12 ms
14,976 KB |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | RE | - |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | RE | - |
testcase_81 | WA | - |
testcase_82 | RE | - |
testcase_83 | WA | - |
testcase_84 | RE | - |
testcase_85 | RE | - |
testcase_86 | RE | - |
testcase_87 | RE | - |
testcase_88 | RE | - |
testcase_89 | RE | - |
testcase_90 | RE | - |
testcase_91 | RE | - |
testcase_92 | RE | - |
testcase_93 | RE | - |
testcase_94 | RE | - |
testcase_95 | RE | - |
testcase_96 | RE | - |
testcase_97 | RE | - |
testcase_98 | RE | - |
testcase_99 | RE | - |
testcase_100 | RE | - |
testcase_101 | RE | - |
testcase_102 | RE | - |
ソースコード
#include<bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; template<class T> using V = vector<T>; template<class T> using VV = V<V<T>>; template<class T> using VVV = V<VV<T>>; template<class T> using VVVV = VV<VV<T>>; #define rep(i,n) for(ll i=0ll;i<n;i++) #define REP(i,a,n) for(ll i=a;i<n;i++) const long long INF = (1LL << 60); const long long mod99 = 998244353; const long long mod107 = 1000000007; const long long mod = mod99; #define eb emplace_back #define pb eb #define be(v) (v).begin(),(v).end() #define all(i,v) for(auto& i : v) #define all2(i,j,v) for(auto& [i,j] : v) template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; } template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; } // cin.tie(nullptr); // ios::sync_with_stdio(false); // cout << fixed << setprecision(20); ll Rnd(ll L=0, ll R=mod99){ return rand()%(R-L)+L; } void solve(){ ll n; cin >> n; V<ll> v(n); rep(i,n) cin >> v[i]; VV<ll> pos(200100); rep(i, n) pos[v[i]].eb(i); rep(i, 200100) if(pos[i].size()>=2){ V<ll> ans(n); cout << "Yes" << endl; rep(i, n){ cout << i+1 << " "; ans[i] = i+1; } cout << endl; swap(ans[pos[i][0]],ans[pos[i][1]]); all(i,ans) cout << i << " "; cout << endl; return; } VV<ll> vv(300000); rep(i, n){ ll x = 0, y = 0;; rep(j, 20) if(((v[i]>>j)&1)==0){ if(x){ y += (1<<j); break; } x += (1<<j); } vv[x+y].eb(i); if(vv[x+y].size()<2) continue; if(y>=n+1) continue; V<ll> ans(n, -1); ans[vv[x+y][0]] = x; ans[vv[x+y][1]] = y; ll cnt = 1; rep(i, n) if(ans[i] == -1){ ans[i] = cnt; cnt++; while(cnt == x || cnt==y) cnt++; } rep(i, n) cout << ans[i] << " "; cout << endl; swap(ans[vv[x][0]], ans[vv[x][1]]); rep(i, n) cout << ans[i] << " "; cout << endl; return; } cout << -1 << endl; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int t=1; // cin >> t; rep(i,t) solve(); }