結果
問題 |
No.241 出席番号(1)
|
ユーザー |
![]() |
提出日時 | 2024-12-05 21:46:24 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 818 bytes |
コンパイル時間 | 5,724 ms |
コンパイル使用メモリ | 275,724 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-05 21:46:34 |
合計ジャッジ時間 | 5,397 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int arr[100]; int ans[100]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); // uniform_int_distribution<> gen(0 , 1e9); int n; cin >> n; for(int i = 0 ; i < n ; i++) ans[i] = i , cin >> arr[i]; shuffle(ans, ans+n , mt); int t = 30; bool flag = 0; while(t--) { flag = 0; for(int i = 0 ; i < n ; i++) { if(ans[i] == arr[i]) { shuffle(ans , ans+n , mt); flag = 1; break; } } if(flag) continue; else break; } if(flag==0) { for(int i = 0 ; i < n ; i++) cout << ans[i] << '\n'; }else{ puts("-1"); } return 0; }