結果
問題 |
No.2732 Similar Permutations
|
ユーザー |
|
提出日時 | 2024-04-19 22:52:15 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
CE
(最初)
|
実行時間 | - |
コード長 | 1,093 bytes |
コンパイル時間 | 15,164 ms |
コンパイル使用メモリ | 262,620 KB |
最終ジャッジ日時 | 2025-02-21 05:06:55 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 57 WA * 44 |
ソースコード
#ifdef LOCAL #include <local.hpp> #else #include <bits/stdc++.h> #define debug(...) ((void)0) #define postprocess(...) ((void)0) #endif using namespace std; using ll = long long; using ld = long double; void solve([[maybe_unused]] int test) { int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } map<int, int> prev; for (int i = 0; i < N; i++) { if (prev.contains(A[i])) { vector<int> P1(N); iota(P1.begin(), P1.end(), 1); auto P2 = P1; swap(P2[i], P2[prev[A[i]]]); for (int i = 0; i < N; i++) { cout << P1[i] << (i == N - 1 ? "\n" : " "); } for (int i = 0; i < N; i++) { cout << P2[i] << (i == N - 1 ? "\n" : " "); } return; } prev[A[i]] = i; } cout << "-1" << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(i); } postprocess(); }