結果
問題 | No.2732 Similar Permutations |
ユーザー |
|
提出日時 | 2024-05-05 11:26:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 819 bytes |
コンパイル時間 | 1,963 ms |
コンパイル使用メモリ | 199,888 KB |
最終ジャッジ日時 | 2025-02-21 11:00:47 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 58 RE * 43 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;int c = min(n, 9);vector<int> a(n), p(c);for(auto &&v : a) cin >> v;iota(p.begin(), p.end(), 1);vector<vector<int>> tb(1 << __lg(200010));do{int v = 0;for(int i = 0; i < c; i++){v ^= a[i] + p[i];}if(!tb[v].empty()){for(int i = 0; i < n; i++){cout << (i < c ? tb[v][i] : i + 1) << (i + 1 == n ? '\n' : ' ');}for(int i = 0; i < n; i++){cout << (i < c ? p[i] : i + 1) << (i + 1 == n ? '\n' : ' ');}return 0;}tb[v] = p;}while(next_permutation(p.begin(), p.end()));cout << -1 << '\n';}