結果
問題 |
No.241 出席番号(1)
|
ユーザー |
![]() |
提出日時 | 2023-12-08 20:46:21 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 930 bytes |
コンパイル時間 | 2,956 ms |
コンパイル使用メモリ | 248,796 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-27 03:05:29 |
合計ジャッジ時間 | 4,013 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 1 |
ソースコード
#include<bits/stdc++.h> #define ll long long #define io ios::sync_with_stdio(0), cin.tie(0); #define endl '\n' #define MXN (int)1e6+5 #define MN (int)1e5+5 constexpr int INF=0x3f3f3f3f; using namespace std; mt19937 gen(hash<string>()(":poop:")); uniform_int_distribution<> dis(0, 1e9); int main(){ io int n; cin>>n; vector<int>v(n); vector<int>ran(n); for(int i=0;i<n;i++){ cin>>v[i]; ran[i]=i; } bool f=false; for(int i=0;i<100;i++){ shuffle(ran.begin(),ran.end(),gen); f=false; for(int j=0;j<n;j++){ if(ran[j]==v[j]){ f=true; break; } } if(f){ continue; } else{ break; } } if(!f){ for(int i=0;i<n;i++){ cout<<ran[i]<<endl; } } else{ cout<<-1<<endl; } return 0; } //test2